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

Commit ce3f0c6f authored by Kyle Horimoto's avatar Kyle Horimoto Committed by Android (Google) Code Review
Browse files

Merge "Band selection: Add handling for layout changes."

parents bcd6fc8b 2da6e4ae
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -573,6 +573,9 @@ public class DirectoryFragment extends Fragment {
        }

        mRecView.setLayoutManager(layout);
        // TODO: Once b/23691541 is resolved, use a listener within MultiSelectManager instead of
        // imperatively calling this function.
        mSelectionManager.handleLayoutChanged();
        // setting layout manager automatically invalidates existing ViewHolders.
        mThumbSize = new Point(thumbSize, thumbSize);
    }
+16 −0
Original line number Diff line number Diff line
@@ -250,6 +250,10 @@ public final class MultiSelectManager {
        notifySelectionChanged();
    }

    public void handleLayoutChanged() {
        mBandSelectManager.handleLayoutChanged();
    }

    /**
     * Clears the selection, without notifying anyone.
     */
@@ -1191,6 +1195,18 @@ public final class MultiSelectManager {
            mModel.addOnSelectionChangedListener(this);
        }

        /**
         * Handle a change in layout by cleaning up and getting rid of the old model and creating
         * a new model which will track the new layout.
         */
        public void handleLayoutChanged() {
            mModel.removeOnSelectionChangedListener(this);
            mModel.stopListening();

            mModel = new BandSelectModel((RuntimeRecyclerViewHelper) mHelper);
            mModel.addOnSelectionChangedListener(this);
        }

        /**
         * Processes a MotionEvent by starting, ending, or resizing the band select overlay.
         * @param e