Updated libraries

This commit is contained in:
M66B 2019-06-07 08:48:03 +02:00
parent 8815838685
commit c5a3a91221
8 changed files with 57 additions and 56 deletions

View File

@ -113,7 +113,7 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
def appcompat_version = "1.0.2" def appcompat_version = "1.0.2"
def recyclerview_version = "1.0.0" def recyclerview_version = "1.1.0-alpha06"
def coordinatorlayout_version = "1.0.0" def coordinatorlayout_version = "1.0.0"
def constraintlayout_version = "1.1.3" def constraintlayout_version = "1.1.3"
def material_version = "1.1.0-alpha07" def material_version = "1.1.0-alpha07"
@ -122,7 +122,7 @@ dependencies {
def room_version = "2.1.0-rc01" def room_version = "2.1.0-rc01"
def paging_version = "2.1.0" def paging_version = "2.1.0"
def preference_version = "1.0.0" def preference_version = "1.0.0"
def work_version = "2.1.0-alpha02" def work_version = "2.1.0-alpha03"
def exif_version = "1.0.0" def exif_version = "1.0.0"
def billingclient_version = "2.0.0" def billingclient_version = "2.0.0"
def javamail_version = "1.6.3" def javamail_version = "1.6.3"
@ -143,7 +143,7 @@ dependencies {
// https://mvnrepository.com/artifact/androidx.recyclerview/recyclerview // https://mvnrepository.com/artifact/androidx.recyclerview/recyclerview
// https://mvnrepository.com/artifact/androidx.recyclerview/recyclerview-selection // https://mvnrepository.com/artifact/androidx.recyclerview/recyclerview-selection
implementation "androidx.recyclerview:recyclerview:$recyclerview_version" implementation "androidx.recyclerview:recyclerview:$recyclerview_version"
//implementation "androidx.recyclerview:recyclerview-selection:1.1.0-alpha05" //implementation "androidx.recyclerview:recyclerview-selection:1.1.0-alpha06"
// https://mvnrepository.com/artifact/androidx.coordinatorlayout/coordinatorlayout // https://mvnrepository.com/artifact/androidx.coordinatorlayout/coordinatorlayout
implementation "androidx.coordinatorlayout:coordinatorlayout:$coordinatorlayout_version" implementation "androidx.coordinatorlayout:coordinatorlayout:$coordinatorlayout_version"

View File

@ -16,19 +16,22 @@
package androidx.recyclerview.selection; package androidx.recyclerview.selection;
import static androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP; import static androidx.annotation.RestrictTo.Scope.LIBRARY;
import static androidx.annotation.VisibleForTesting.PACKAGE_PRIVATE;
import android.graphics.Point; import android.graphics.Point;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo; import androidx.annotation.RestrictTo;
import androidx.annotation.VisibleForTesting;
/** /**
* Provides support for auto-scrolling a view. * Provides support for auto-scrolling a view.
* *
* @hide * @hide
*/ */
@RestrictTo(LIBRARY_GROUP) @RestrictTo(LIBRARY)
@VisibleForTesting(otherwise = PACKAGE_PRIVATE)
public abstract class AutoScroller { public abstract class AutoScroller {
/** /**

View File

@ -16,7 +16,7 @@
package androidx.recyclerview.selection; package androidx.recyclerview.selection;
import static androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP; import static androidx.annotation.RestrictTo.Scope.LIBRARY;
import static androidx.core.util.Preconditions.checkArgument; import static androidx.core.util.Preconditions.checkArgument;
import static androidx.core.util.Preconditions.checkState; import static androidx.core.util.Preconditions.checkState;
import static androidx.recyclerview.selection.Shared.DEBUG; import static androidx.recyclerview.selection.Shared.DEBUG;
@ -49,7 +49,7 @@ import java.util.Set;
* *
* @hide * @hide
*/ */
@RestrictTo(LIBRARY_GROUP) @RestrictTo(LIBRARY)
public class DefaultSelectionTracker<K> extends SelectionTracker<K> { public class DefaultSelectionTracker<K> extends SelectionTracker<K> {
private static final String TAG = "DefaultSelectionTracker"; private static final String TAG = "DefaultSelectionTracker";
@ -296,6 +296,11 @@ public class DefaultSelectionTracker<K> extends SelectionTracker<K> {
private void extendRange(int position, @RangeType int type) { private void extendRange(int position, @RangeType int type) {
checkState(isRangeActive(), "Range start point not set."); checkState(isRangeActive(), "Range start point not set.");
if (position == RecyclerView.NO_POSITION) {
Log.w(TAG, "Invalid position: Cannot extend selection to: " + position);
return;
}
mRange.extendRange(position, type); mRange.extendRange(position, type);
// We're being lazy here notifying even when something might not have changed. // We're being lazy here notifying even when something might not have changed.

View File

@ -16,7 +16,7 @@
package androidx.recyclerview.selection; package androidx.recyclerview.selection;
import static androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP; import static androidx.annotation.RestrictTo.Scope.LIBRARY;
import static androidx.annotation.VisibleForTesting.PACKAGE_PRIVATE; import static androidx.annotation.VisibleForTesting.PACKAGE_PRIVATE;
import static androidx.core.util.Preconditions.checkArgument; import static androidx.core.util.Preconditions.checkArgument;
import static androidx.recyclerview.selection.Shared.VERBOSE; import static androidx.recyclerview.selection.Shared.VERBOSE;
@ -38,7 +38,7 @@ import androidx.recyclerview.widget.RecyclerView;
* *
* @hide * @hide
*/ */
@RestrictTo(LIBRARY_GROUP) @RestrictTo(LIBRARY)
@VisibleForTesting(otherwise = PACKAGE_PRIVATE) @VisibleForTesting(otherwise = PACKAGE_PRIVATE)
public class EventBridge { public class EventBridge {

View File

@ -94,11 +94,17 @@ final class GestureSelectionHelper implements OnItemTouchListener {
@Override @Override
/** @hide */ /** @hide */
public boolean onInterceptTouchEvent(@NonNull RecyclerView unused, @NonNull MotionEvent e) { public boolean onInterceptTouchEvent(@NonNull RecyclerView unused, @NonNull MotionEvent e) {
// TODO(b/132447183): For some reason we're not receiving an ACTION_UP
// event after a > long-press NOT followed by a ACTION_MOVE < event.
if (mStarted) {
handleTouch(e);
}
switch (e.getActionMasked()) { switch (e.getActionMasked()) {
case MotionEvent.ACTION_MOVE: case MotionEvent.ACTION_MOVE:
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_CANCEL:
return mStarted && mSelectionMgr.isRangeActive(); case MotionEvent.ACTION_UP:
return mStarted;
default: default:
return false; return false;
} }
@ -127,32 +133,25 @@ final class GestureSelectionHelper implements OnItemTouchListener {
* so this methods return value is irrelevant to it. * so this methods return value is irrelevant to it.
* </ol> * </ol>
*/ */
private boolean handleTouch(MotionEvent e) { private void handleTouch(MotionEvent e) {
if (!mStarted) {
return false;
}
if (!mSelectionMgr.isRangeActive()) { if (!mSelectionMgr.isRangeActive()) {
Log.e(TAG, Log.e(TAG,
"Internal state of GestureSelectionHelper out of sync w/ SelectionTracker " "Internal state of GestureSelectionHelper out of sync w/ SelectionTracker "
+ "(isRangeActive is false). Ignoring event and resetting state."); + "(isRangeActive is false). Ignoring event and resetting state.");
endSelection(); endSelection();
return false;
} }
switch (e.getActionMasked()) { switch (e.getActionMasked()) {
case MotionEvent.ACTION_MOVE: case MotionEvent.ACTION_MOVE:
handleMoveEvent(e); handleMoveEvent(e);
return true; break;
case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP:
handleUpEvent(); handleUpEvent();
return true; break;
case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_CANCEL:
handleCancelEvent(); handleCancelEvent();
return true; break;
} }
return false;
} }
@Override @Override

View File

@ -16,7 +16,7 @@
package androidx.recyclerview.selection; package androidx.recyclerview.selection;
import static androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP; import static androidx.annotation.RestrictTo.Scope.LIBRARY;
import android.view.MotionEvent; import android.view.MotionEvent;
@ -72,7 +72,7 @@ public abstract class ItemDetailsLookup<K> {
* @return true if there is an item w/ a stable ID at the event coordinates. * @return true if there is an item w/ a stable ID at the event coordinates.
* @hide * @hide
*/ */
@RestrictTo(LIBRARY_GROUP) @RestrictTo(LIBRARY)
protected boolean overItemWithSelectionKey(@NonNull MotionEvent e) { protected boolean overItemWithSelectionKey(@NonNull MotionEvent e) {
return overItem(e) && hasSelectionKey(getItemDetails(e)); return overItem(e) && hasSelectionKey(getItemDetails(e));
} }

View File

@ -16,7 +16,7 @@
package androidx.recyclerview.selection; package androidx.recyclerview.selection;
import static androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP; import static androidx.annotation.RestrictTo.Scope.LIBRARY;
import static androidx.core.util.Preconditions.checkArgument; import static androidx.core.util.Preconditions.checkArgument;
import android.content.Context; import android.content.Context;
@ -180,7 +180,7 @@ public abstract class SelectionTracker<K> {
public abstract boolean deselect(@NonNull K key); public abstract boolean deselect(@NonNull K key);
/** @hide */ /** @hide */
@RestrictTo(LIBRARY_GROUP) @RestrictTo(LIBRARY)
protected abstract AdapterDataObserver getAdapterDataObserver(); protected abstract AdapterDataObserver getAdapterDataObserver();
/** /**
@ -192,7 +192,7 @@ public abstract class SelectionTracker<K> {
* work with the established anchor point to define selection ranges. * work with the established anchor point to define selection ranges.
* @hide * @hide
*/ */
@RestrictTo(LIBRARY_GROUP) @RestrictTo(LIBRARY)
public abstract void startRange(int position); public abstract void startRange(int position);
/** /**
@ -208,7 +208,7 @@ public abstract class SelectionTracker<K> {
* must have been started by a call to {@link #startRange(int)}. * must have been started by a call to {@link #startRange(int)}.
* @hide * @hide
*/ */
@RestrictTo(LIBRARY_GROUP) @RestrictTo(LIBRARY)
public abstract void extendRange(int position); public abstract void extendRange(int position);
/** /**
@ -217,14 +217,14 @@ public abstract class SelectionTracker<K> {
* {@link #mergeProvisionalSelection()} is called first.) * {@link #mergeProvisionalSelection()} is called first.)
* @hide * @hide
*/ */
@RestrictTo(LIBRARY_GROUP) @RestrictTo(LIBRARY)
public abstract void endRange(); public abstract void endRange();
/** /**
* @return Whether or not there is a current range selection active. * @return Whether or not there is a current range selection active.
* @hide * @hide
*/ */
@RestrictTo(LIBRARY_GROUP) @RestrictTo(LIBRARY)
public abstract boolean isRangeActive(); public abstract boolean isRangeActive();
/** /**
@ -237,7 +237,7 @@ public abstract class SelectionTracker<K> {
* @param position the anchor position. Must already be selected. * @param position the anchor position. Must already be selected.
* @hide * @hide
*/ */
@RestrictTo(LIBRARY_GROUP) @RestrictTo(LIBRARY)
public abstract void anchorRange(int position); public abstract void anchorRange(int position);
/** /**
@ -246,7 +246,7 @@ public abstract class SelectionTracker<K> {
* @param position the end point. * @param position the end point.
* @hide * @hide
*/ */
@RestrictTo(LIBRARY_GROUP) @RestrictTo(LIBRARY)
protected abstract void extendProvisionalRange(int position); protected abstract void extendProvisionalRange(int position);
/** /**
@ -254,14 +254,14 @@ public abstract class SelectionTracker<K> {
* @param newSelection * @param newSelection
* @hide * @hide
*/ */
@RestrictTo(LIBRARY_GROUP) @RestrictTo(LIBRARY)
protected abstract void setProvisionalSelection(@NonNull Set<K> newSelection); protected abstract void setProvisionalSelection(@NonNull Set<K> newSelection);
/** /**
* Clears any existing provisional selection * Clears any existing provisional selection
* @hide * @hide
*/ */
@RestrictTo(LIBRARY_GROUP) @RestrictTo(LIBRARY)
protected abstract void clearProvisionalSelection(); protected abstract void clearProvisionalSelection();
/** /**
@ -269,7 +269,7 @@ public abstract class SelectionTracker<K> {
* provisional selection. * provisional selection.
* @hide * @hide
*/ */
@RestrictTo(LIBRARY_GROUP) @RestrictTo(LIBRARY)
protected abstract void mergeProvisionalSelection(); protected abstract void mergeProvisionalSelection();
/** /**
@ -769,7 +769,7 @@ public abstract class SelectionTracker<K> {
try { try {
gestureHelper.start(); gestureHelper.start();
} catch (IllegalStateException ex) { } catch (IllegalStateException ex) {
ex.printStackTrace(); eu.faircode.email.Log.w(ex);
} }
} }
} }

View File

@ -1,35 +1,29 @@
diff --git a/app/src/main/java/androidx/recyclerview/selection/GestureSelectionHelper.java b/app/src/main/java/androidx/recyclerview/selection/GestureSelectionHelper.java
index 7f2a5bb2..3736ada4 100644
--- a/app/src/main/java/androidx/recyclerview/selection/GestureSelectionHelper.java
+++ b/app/src/main/java/androidx/recyclerview/selection/GestureSelectionHelper.java
@@ -98,7 +98,7 @@ final class GestureSelectionHelper implements OnItemTouchListener {
case MotionEvent.ACTION_MOVE:
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
- return mStarted;
+ return mStarted && mSelectionMgr.isRangeActive();
default:
return false;
}
diff --git a/app/src/main/java/androidx/recyclerview/selection/SelectionTracker.java b/app/src/main/java/androidx/recyclerview/selection/SelectionTracker.java diff --git a/app/src/main/java/androidx/recyclerview/selection/SelectionTracker.java b/app/src/main/java/androidx/recyclerview/selection/SelectionTracker.java
index ae3785df..1591ff4b 100644 index 76087ea4..121fbd14 100644
--- a/app/src/main/java/androidx/recyclerview/selection/SelectionTracker.java --- a/app/src/main/java/androidx/recyclerview/selection/SelectionTracker.java
+++ b/app/src/main/java/androidx/recyclerview/selection/SelectionTracker.java +++ b/app/src/main/java/androidx/recyclerview/selection/SelectionTracker.java
@@ -765,7 +765,13 @@ public abstract class SelectionTracker<K> { @@ -488,7 +488,7 @@ public abstract class SelectionTracker<K> {
new Runnable() { 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;
private int[] mGestureToolTypes = new int[] {
MotionEvent.TOOL_TYPE_FINGER,
@@ -766,7 +766,11 @@ public abstract class SelectionTracker<K> {
@Override @Override
public void run() { public void run() {
- gestureHelper.start(); if (mSelectionPredicate.canSelectMultiple()) {
+ if (mSelectionPredicate.canSelectMultiple()) { - gestureHelper.start();
+ try { + try {
+ gestureHelper.start(); + gestureHelper.start();
+ } catch (IllegalStateException ex) { + } catch (IllegalStateException ex) {
+ ex.printStackTrace(); + ex.printStackTrace();
+ } + }
+ } }
} }
}, },
mOnDragInitiatedListener,
diff --git a/app/src/main/java/androidx/recyclerview/selection/TouchInputHandler.java b/app/src/main/java/androidx/recyclerview/selection/TouchInputHandler.java diff --git a/app/src/main/java/androidx/recyclerview/selection/TouchInputHandler.java b/app/src/main/java/androidx/recyclerview/selection/TouchInputHandler.java
index d82812cc..48db78ec 100644 index d82812cc..48db78ec 100644
--- a/app/src/main/java/androidx/recyclerview/selection/TouchInputHandler.java --- a/app/src/main/java/androidx/recyclerview/selection/TouchInputHandler.java