mirror of https://github.com/M66B/FairEmail.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
3.9 KiB
86 lines
3.9 KiB
5 years ago
|
--- /home/marcel/support/recyclerview/recyclerview-selection/src/main/java/androidx/recyclerview/selection/DefaultSelectionTracker.java 2020-03-23 17:03:46.043122318 +0100
|
||
4 years ago
|
+++ app/src/main/java/androidx/recyclerview/selection/DefaultSelectionTracker.java 2020-06-26 16:48:04.938298254 +0200
|
||
5 years ago
|
@@ -379,6 +379,10 @@ public class DefaultSelectionTracker<K>
|
||
|
return mRange != null;
|
||
|
}
|
||
|
|
||
|
+ boolean isOverlapping(int position, int count) {
|
||
|
+ return (mRange != null && mRange.isOverlapping(position, count));
|
||
|
+ }
|
||
|
+
|
||
|
private boolean canSetState(@NonNull K key, boolean nextState) {
|
||
|
return mSelectionPredicate.canSetStateForKey(key, nextState);
|
||
|
}
|
||
4 years ago
|
@@ -390,7 +394,7 @@ public class DefaultSelectionTracker<K>
|
||
|
|
||
|
@SuppressWarnings({"WeakerAccess", "unchecked"}) /* synthetic access */
|
||
|
void onDataSetChanged() {
|
||
|
- mSelection.clearProvisionalSelection();
|
||
|
+ //mSelection.clearProvisionalSelection();
|
||
|
|
||
|
notifySelectionRefresh();
|
||
|
|
||
5 years ago
|
@@ -601,17 +605,21 @@ public class DefaultSelectionTracker<K>
|
||
|
|
||
|
@Override
|
||
|
public void onItemRangeInserted(int startPosition, int itemCount) {
|
||
|
- mSelectionTracker.endRange();
|
||
|
+ if (mSelectionTracker.isOverlapping(startPosition, itemCount))
|
||
|
+ mSelectionTracker.endRange();
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void onItemRangeRemoved(int startPosition, int itemCount) {
|
||
|
- mSelectionTracker.endRange();
|
||
|
+ if (mSelectionTracker.isOverlapping(startPosition, itemCount))
|
||
|
+ mSelectionTracker.endRange();
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void onItemRangeMoved(int fromPosition, int toPosition, int itemCount) {
|
||
|
- mSelectionTracker.endRange();
|
||
|
+ if (mSelectionTracker.isOverlapping(fromPosition, itemCount) ||
|
||
|
+ mSelectionTracker.isOverlapping(toPosition, itemCount))
|
||
|
+ mSelectionTracker.endRange();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
--- /home/marcel/support/recyclerview/recyclerview-selection/src/main/java/androidx/recyclerview/selection/Range.java 2020-03-23 17:03:46.045122318 +0100
|
||
4 years ago
|
+++ app/src/main/java/androidx/recyclerview/selection/Range.java 2020-06-26 16:36:39.708283142 +0200
|
||
5 years ago
|
@@ -169,6 +169,11 @@ final class Range {
|
||
|
mCallbacks.updateForRange(begin, end, selected, type);
|
||
|
}
|
||
|
|
||
|
+ boolean isOverlapping(int position, int count) {
|
||
|
+ return (position >= mBegin && position <= mEnd) ||
|
||
|
+ (position + count >= mBegin && position + count <= mEnd);
|
||
|
+ }
|
||
|
+
|
||
|
@Override
|
||
|
public String toString() {
|
||
|
return "Range{begin=" + mBegin + ", end=" + mEnd + "}";
|
||
|
--- /home/marcel/support/recyclerview/recyclerview-selection/src/main/java/androidx/recyclerview/selection/SelectionTracker.java 2020-03-23 17:03:46.046122318 +0100
|
||
|
+++ app/src/main/java/androidx/recyclerview/selection/SelectionTracker.java 2020-04-24 21:08:55.544011257 +0200
|
||
|
@@ -503,7 +503,7 @@ public abstract class SelectionTracker<K
|
||
6 years ago
|
private OnContextClickListener mOnContextClickListener;
|
||
|
|
||
|
private BandPredicate mBandPredicate;
|
||
|
- private int mBandOverlayId = R.drawable.selection_band_overlay;
|
||
|
+ private int mBandOverlayId = eu.faircode.email.R.drawable.selection_band_overlay;
|
||
|
|
||
5 years ago
|
// TODO(b/144500333): Remove support for overriding gesture and pointer tooltypes.
|
||
|
private int[] mGestureToolTypes = new int[]{
|
||
5 years ago
|
@@ -815,7 +815,11 @@ public abstract class SelectionTracker<K
|
||
6 years ago
|
@Override
|
||
|
public void run() {
|
||
6 years ago
|
if (mSelectionPredicate.canSelectMultiple()) {
|
||
|
- gestureHelper.start();
|
||
6 years ago
|
+ try {
|
||
|
+ gestureHelper.start();
|
||
5 years ago
|
+ } catch (Throwable ex) {
|
||
|
+ eu.faircode.email.Log.e(ex);
|
||
6 years ago
|
+ }
|
||
6 years ago
|
}
|
||
6 years ago
|
}
|
||
|
},
|