Merge "Keeping the focus indicator on the widget view, while a child is focused" into ub-launcher3-burnaby-polish
diff --git a/src/com/android/launcher3/LauncherAppWidgetHostView.java b/src/com/android/launcher3/LauncherAppWidgetHostView.java
index 34c2943..c49d43f 100644
--- a/src/com/android/launcher3/LauncherAppWidgetHostView.java
+++ b/src/com/android/launcher3/LauncherAppWidgetHostView.java
@@ -244,4 +244,27 @@
}
super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
}
+
+ @Override
+ public void requestChildFocus(View child, View focused) {
+ super.requestChildFocus(child, focused);
+ dispatchChildFocus(focused != null);
+ }
+
+ @Override
+ public void clearChildFocus(View child) {
+ super.clearChildFocus(child);
+ dispatchChildFocus(false);
+ }
+
+ @Override
+ public boolean dispatchUnhandledMove(View focused, int direction) {
+ return mChildrenFocused;
+ }
+
+ private void dispatchChildFocus(boolean focused) {
+ if (getOnFocusChangeListener() != null) {
+ getOnFocusChangeListener().onFocusChange(this, focused || isFocused());
+ }
+ }
}
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index c34ac3a..b6d3cc4 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -1220,7 +1220,17 @@
@Override
public boolean dispatchUnhandledMove(View focused, int direction) {
- // XXX-RTL: This will be fixed in a future CL
+ if (super.dispatchUnhandledMove(focused, direction)) {
+ return true;
+ }
+
+ if (mIsRtl) {
+ if (direction == View.FOCUS_LEFT) {
+ direction = View.FOCUS_RIGHT;
+ } else if (direction == View.FOCUS_RIGHT) {
+ direction = View.FOCUS_LEFT;
+ }
+ }
if (direction == View.FOCUS_LEFT) {
if (getCurrentPage() > 0) {
snapToPage(getCurrentPage() - 1);
@@ -1232,7 +1242,7 @@
return true;
}
}
- return super.dispatchUnhandledMove(focused, direction);
+ return false;
}
@Override