Browse Source

New implement for anti auto-focus in settings page, fix the problem small-screen device will scroll when initial focus to music option

Pal Lockheart 6 years ago
parent
commit
0c9f8c3679

+ 0 - 4
android/app/src/main/java/io/github/sdlpal/SettingsActivity.java

@@ -70,10 +70,6 @@ public class SettingsActivity extends AppCompatActivity {
         setSupportActionBar(toolbar);
         toolbar.setSubtitle(getResources().getString(R.string.title_settings) + " (" + getGitRevision() + ")");
 
-        findViewById(R.id.spMusFmt).setFocusable(true);
-        findViewById(R.id.spMusFmt).setFocusableInTouchMode(true);
-        findViewById(R.id.spMusFmt).requestFocus();
-
         ((SwitchCompat)findViewById(R.id.swMsgFile)).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
             @Override
             public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

+ 5 - 0
android/app/src/main/res/layout/content_settings.xml

@@ -17,9 +17,14 @@
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             android:orientation="vertical"
+            android:focusable="true" 
+            android:focusableInTouchMode="true"
             >
 
             <TextView
+                android:id="@+id/autotext"
+                android:nextFocusUp="@id/autotext" 
+                android:nextFocusLeft="@id/autotext"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:text="@string/label_folder"