Fix focus navigation of All Apps when using external keyboard.
- All apps icons do not show the focus rectangle when focused as mIconFocusListener is null in BaseAllAppsAdapter when onCreateViewHolder is called.
- All apps recyclerview does not scroll down when focus goes from top to bottom of list, as AllAppsToastUiDelegate calls hideKeyboard which clears focus.
- Focus goes behind AllApps into hotseat, so update hotseat setDescendantFocusability.
Flag: NONE
Fix: 296844600
Test: TaplKeyboardFocusTest
Change-Id: I65f6fbb6f4df0be4b4ff922dda267d27da16effe
diff --git a/src/com/android/launcher3/ExtendedEditText.java b/src/com/android/launcher3/ExtendedEditText.java
index 8ec5c18..8ff030e 100644
--- a/src/com/android/launcher3/ExtendedEditText.java
+++ b/src/com/android/launcher3/ExtendedEditText.java
@@ -101,8 +101,14 @@
}
public void hideKeyboard() {
+ hideKeyboard(/* clearFocus= */ true);
+ }
+
+ public void hideKeyboard(boolean clearFocus) {
ActivityContext.lookupContext(getContext()).hideKeyboard();
- clearFocus();
+ if (clearFocus) {
+ clearFocus();
+ }
}
protected void onKeyboardShown() {
diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
index 84d3805..2315111 100644
--- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
+++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
@@ -49,6 +49,7 @@
import android.animation.ValueAnimator;
import android.util.FloatProperty;
import android.view.View;
+import android.view.ViewGroup;
import android.view.animation.Interpolator;
import com.android.launcher3.LauncherState.PageAlphaProvider;
@@ -164,6 +165,8 @@
state.hasFlag(FLAG_HOTSEAT_INACCESSIBLE)
? View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
: View.IMPORTANT_FOR_ACCESSIBILITY_AUTO);
+ hotseat.setDescendantFocusability(state.hasFlag(FLAG_HOTSEAT_INACCESSIBLE)
+ ? ViewGroup.FOCUS_BLOCK_DESCENDANTS : ViewGroup.FOCUS_BEFORE_DESCENDANTS);
Interpolator translationInterpolator =
config.getInterpolator(ANIM_WORKSPACE_TRANSLATE, ZOOM_OUT);
diff --git a/src/com/android/launcher3/allapps/BaseAllAppsAdapter.java b/src/com/android/launcher3/allapps/BaseAllAppsAdapter.java
index 005e6df..7baf7d3 100644
--- a/src/com/android/launcher3/allapps/BaseAllAppsAdapter.java
+++ b/src/com/android/launcher3/allapps/BaseAllAppsAdapter.java
@@ -27,7 +27,6 @@
import androidx.recyclerview.widget.RecyclerView;
import com.android.launcher3.BubbleTextView;
-import com.android.launcher3.Flags;
import com.android.launcher3.R;
import com.android.launcher3.allapps.search.SearchAdapterProvider;
import com.android.launcher3.config.FeatureFlags;
@@ -213,6 +212,7 @@
BubbleTextView icon = (BubbleTextView) holder.itemView;
icon.reset();
icon.applyFromApplicationInfo(adapterItem.itemInfo);
+ icon.setOnFocusChangeListener(mIconFocusListener);
break;
}
case VIEW_TYPE_EMPTY_SEARCH: {