Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c4e3722 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Keeping the focus indicator on the widget view, while a child is focused

Bug: 25199581
Change-Id: Ie08d1438ae0c1b5d4fcaa4d642508c1b9db0f5d4
parent 0c2f0700
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -244,4 +244,27 @@ public class LauncherAppWidgetHostView extends AppWidgetHostView implements Touc
        }
        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());
        }
    }
}
+12 −2
Original line number Diff line number Diff line
@@ -1225,7 +1225,17 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc

    @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);
@@ -1237,7 +1247,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
                return true;
            }
        }
        return super.dispatchUnhandledMove(focused, direction);
        return false;
    }

    @Override