mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-01 22:56:33 +02:00
Updated recyclerview-selection: to version 1.1.0-alpha05
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package androidx.recyclerview.selection;
|
||||
|
||||
import static androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP;
|
||||
import static androidx.core.util.Preconditions.checkArgument;
|
||||
|
||||
import android.content.Context;
|
||||
@@ -28,6 +29,7 @@ import android.view.MotionEvent;
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RestrictTo;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.RecyclerView.AdapterDataObserver;
|
||||
import androidx.recyclerview.widget.RecyclerView.OnItemTouchListener;
|
||||
@@ -177,7 +179,9 @@ public abstract class SelectionTracker<K> {
|
||||
*/
|
||||
public abstract boolean deselect(@NonNull K key);
|
||||
|
||||
abstract AdapterDataObserver getAdapterDataObserver();
|
||||
/** @hide */
|
||||
@RestrictTo(LIBRARY_GROUP)
|
||||
protected abstract AdapterDataObserver getAdapterDataObserver();
|
||||
|
||||
/**
|
||||
* Attempts to establish a range selection at {@code position}, selecting the item
|
||||
@@ -186,8 +190,10 @@ public abstract class SelectionTracker<K> {
|
||||
* @param position The "anchor" position for the range. Subsequent range operations
|
||||
* (primarily keyboard and mouse based operations like SHIFT + click)
|
||||
* work with the established anchor point to define selection ranges.
|
||||
* @hide
|
||||
*/
|
||||
abstract void startRange(int position);
|
||||
@RestrictTo(LIBRARY_GROUP)
|
||||
public abstract void startRange(int position);
|
||||
|
||||
/**
|
||||
* Sets the end point for the active range selection.
|
||||
@@ -200,20 +206,26 @@ public abstract class SelectionTracker<K> {
|
||||
* @param position The new end position for the selection range.
|
||||
* @throws IllegalStateException if a range selection is not active. Range selection
|
||||
* must have been started by a call to {@link #startRange(int)}.
|
||||
* @hide
|
||||
*/
|
||||
abstract void extendRange(int position);
|
||||
@RestrictTo(LIBRARY_GROUP)
|
||||
public abstract void extendRange(int position);
|
||||
|
||||
/**
|
||||
* Clears an in-progress range selection. Provisional range selection established
|
||||
* using {@link #extendProvisionalRange(int)} will be cleared (unless
|
||||
* {@link #mergeProvisionalSelection()} is called first.)
|
||||
* @hide
|
||||
*/
|
||||
abstract void endRange();
|
||||
@RestrictTo(LIBRARY_GROUP)
|
||||
public abstract void endRange();
|
||||
|
||||
/**
|
||||
* @return Whether or not there is a current range selection active.
|
||||
* @hide
|
||||
*/
|
||||
abstract boolean isRangeActive();
|
||||
@RestrictTo(LIBRARY_GROUP)
|
||||
public abstract boolean isRangeActive();
|
||||
|
||||
/**
|
||||
* Establishes the "anchor" at which a selection range begins. This "anchor" is consulted
|
||||
@@ -223,32 +235,42 @@ public abstract class SelectionTracker<K> {
|
||||
* TODO: Reconcile this with startRange. Maybe just docs need to be updated.
|
||||
*
|
||||
* @param position the anchor position. Must already be selected.
|
||||
* @hide
|
||||
*/
|
||||
abstract void anchorRange(int position);
|
||||
@RestrictTo(LIBRARY_GROUP)
|
||||
public abstract void anchorRange(int position);
|
||||
|
||||
/**
|
||||
* Creates a provisional selection from anchor to {@code position}.
|
||||
*
|
||||
* @param position the end point.
|
||||
* @hide
|
||||
*/
|
||||
abstract void extendProvisionalRange(int position);
|
||||
@RestrictTo(LIBRARY_GROUP)
|
||||
protected abstract void extendProvisionalRange(int position);
|
||||
|
||||
/**
|
||||
* Sets the provisional selection, replacing any existing selection.
|
||||
* @param newSelection
|
||||
* @hide
|
||||
*/
|
||||
abstract void setProvisionalSelection(@NonNull Set<K> newSelection);
|
||||
@RestrictTo(LIBRARY_GROUP)
|
||||
protected abstract void setProvisionalSelection(@NonNull Set<K> newSelection);
|
||||
|
||||
/**
|
||||
* Clears any existing provisional selection
|
||||
* @hide
|
||||
*/
|
||||
abstract void clearProvisionalSelection();
|
||||
@RestrictTo(LIBRARY_GROUP)
|
||||
protected abstract void clearProvisionalSelection();
|
||||
|
||||
/**
|
||||
* Converts the provisional selection into primary selection, then clears
|
||||
* provisional selection.
|
||||
* @hide
|
||||
*/
|
||||
abstract void mergeProvisionalSelection();
|
||||
@RestrictTo(LIBRARY_GROUP)
|
||||
protected abstract void mergeProvisionalSelection();
|
||||
|
||||
/**
|
||||
* Preserves selection, if any. Call this method from Activity#onSaveInstanceState
|
||||
@@ -689,7 +711,7 @@ public abstract class SelectionTracker<K> {
|
||||
// of motions and gestures in order to provide gesture driven selection support
|
||||
// when used in conjunction with RecyclerView.
|
||||
final GestureSelectionHelper gestureHelper = GestureSelectionHelper.create(
|
||||
tracker, mDetailsLookup, mRecyclerView, scroller, mMonitor);
|
||||
tracker, mSelectionPredicate, mRecyclerView, scroller, mMonitor);
|
||||
|
||||
// Finally hook the framework up to listening to recycle view events.
|
||||
mRecyclerView.addOnItemTouchListener(eventRouter);
|
||||
|
||||
Reference in New Issue
Block a user