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

Commit a15a9e0c authored by Ben Kwa's avatar Ben Kwa Committed by android-build-merger
Browse files

Merge "Fix focus issues on RV." into nyc-dev

am: 6f4de5b6

* commit '6f4de5b6':
  Fix focus issues on RV.
parents 07197bb4 6f4de5b6
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -199,11 +199,6 @@ public class DirectoryFragment extends Fragment implements DocumentsAdapter.Envi

        mRecView.setItemAnimator(new DirectoryItemAnimator(getActivity()));

        // Make the RecyclerView unfocusable. This is needed in order for the focus search code in
        // FocusManager to work correctly. Setting android:focusable=false in the layout xml doesn't
        // work, for some reason.
        mRecView.setFocusable(false);

        // TODO: Add a divider between views (which might use RecyclerView.ItemDecoration).
        if (DEBUG_ENABLE_DND) {
            setupDragAndDropOnDirectoryView(mRecView);
+7 −0
Original line number Diff line number Diff line
@@ -158,7 +158,14 @@ class FocusManager implements View.OnFocusChangeListener {
        }

        if (searchDir != -1) {
            // Focus search behaves badly if the parent RecyclerView is focused. However, focusable
            // shouldn't be unset on RecyclerView, otherwise focus isn't properly restored after
            // events that cause a UI rebuild (like rotating the device). Compromise: turn focusable
            // off while performing the focus search.
            // TODO: Revisit this when RV focus issues are resolved.
            mView.setFocusable(false);
            View targetView = view.focusSearch(searchDir);
            mView.setFocusable(true);
            // TargetView can be null, for example, if the user pressed <down> at the bottom
            // of the list.
            if (targetView != null) {