summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/launcher3/settings/SettingsActivity.java30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/com/android/launcher3/settings/SettingsActivity.java b/src/com/android/launcher3/settings/SettingsActivity.java
index 18b6094fb..8d2db78c7 100644
--- a/src/com/android/launcher3/settings/SettingsActivity.java
+++ b/src/com/android/launcher3/settings/SettingsActivity.java
@@ -16,6 +16,8 @@
package com.android.launcher3.settings;
+import static androidx.core.view.accessibility.AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS;
+
import static com.android.launcher3.SessionCommitReceiver.ADD_ICON_PREFERENCE_KEY;
import static com.android.launcher3.states.RotationHelper.ALLOW_ROTATION_PREFERENCE_KEY;
import static com.android.launcher3.states.RotationHelper.getAllowRotationDefaultValue;
@@ -32,14 +34,7 @@ import android.os.Bundle;
import android.provider.Settings;
import android.text.TextUtils;
-import com.android.launcher3.LauncherFiles;
-import com.android.launcher3.R;
-import com.android.launcher3.Utilities;
-import com.android.launcher3.config.FeatureFlags;
-import com.android.launcher3.graphics.GridOptionsProvider;
-import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper;
-import com.android.launcher3.util.SecureSettingsObserver;
-
+import androidx.annotation.NonNull;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragment;
import androidx.preference.PreferenceFragment.OnPreferenceStartFragmentCallback;
@@ -48,6 +43,14 @@ import androidx.preference.PreferenceGroup.PreferencePositionCallback;
import androidx.preference.PreferenceScreen;
import androidx.recyclerview.widget.RecyclerView;
+import com.android.launcher3.LauncherFiles;
+import com.android.launcher3.R;
+import com.android.launcher3.Utilities;
+import com.android.launcher3.config.FeatureFlags;
+import com.android.launcher3.graphics.GridOptionsProvider;
+import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper;
+import com.android.launcher3.util.SecureSettingsObserver;
+
/**
* Settings activity for Launcher. Currently implements the following setting: Allow rotation
*/
@@ -248,6 +251,8 @@ public class SettingsActivity extends Activity
if (highlighter != null) {
getView().postDelayed(highlighter, DELAY_HIGHLIGHT_DURATION_MILLIS);
mPreferenceHighlighted = true;
+ } else {
+ requestAccessibilityFocus(getListView());
}
}
}
@@ -268,6 +273,15 @@ public class SettingsActivity extends Activity
return position >= 0 ? new PreferenceHighlighter(list, position) : null;
}
+ private void requestAccessibilityFocus(@NonNull final RecyclerView rv) {
+ rv.post(() -> {
+ if (!rv.hasFocus() && rv.getChildCount() > 0) {
+ rv.getChildAt(0)
+ .performAccessibilityAction(ACTION_ACCESSIBILITY_FOCUS, null);
+ }
+ });
+ }
+
@Override
public void onDestroy() {
if (mNotificationDotsObserver != null) {