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'])
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 constraintlayout_version = "1.1.3"
def material_version = "1.1.0-alpha07"
@ -122,7 +122,7 @@ dependencies {
def room_version = "2.1.0-rc01"
def paging_version = "2.1.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 billingclient_version = "2.0.0"
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-selection
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
implementation "androidx.coordinatorlayout:coordinatorlayout:$coordinatorlayout_version"

View File

@ -16,19 +16,22 @@
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 androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import androidx.annotation.VisibleForTesting;
/**
* Provides support for auto-scrolling a view.
*
* @hide
*/
@RestrictTo(LIBRARY_GROUP)
@RestrictTo(LIBRARY)
@VisibleForTesting(otherwise = PACKAGE_PRIVATE)
public abstract class AutoScroller {
/**

View File

@ -16,7 +16,7 @@
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.checkState;
import static androidx.recyclerview.selection.Shared.DEBUG;
@ -49,7 +49,7 @@ import java.util.Set;
*
* @hide
*/
@RestrictTo(LIBRARY_GROUP)
@RestrictTo(LIBRARY)
public class DefaultSelectionTracker<K> extends SelectionTracker<K> {
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) {
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);
// We're being lazy here notifying even when something might not have changed.

View File

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

View File

@ -94,11 +94,17 @@ final class GestureSelectionHelper implements OnItemTouchListener {
@Override
/** @hide */
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()) {
case MotionEvent.ACTION_MOVE:
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
return mStarted && mSelectionMgr.isRangeActive();
case MotionEvent.ACTION_UP:
return mStarted;
default:
return false;
}
@ -127,32 +133,25 @@ final class GestureSelectionHelper implements OnItemTouchListener {
* so this methods return value is irrelevant to it.
* </ol>
*/
private boolean handleTouch(MotionEvent e) {
if (!mStarted) {
return false;
}
private void handleTouch(MotionEvent e) {
if (!mSelectionMgr.isRangeActive()) {
Log.e(TAG,
"Internal state of GestureSelectionHelper out of sync w/ SelectionTracker "
+ "(isRangeActive is false). Ignoring event and resetting state.");
endSelection();
return false;
}
switch (e.getActionMasked()) {
case MotionEvent.ACTION_MOVE:
handleMoveEvent(e);
return true;
break;
case MotionEvent.ACTION_UP:
handleUpEvent();
return true;
break;
case MotionEvent.ACTION_CANCEL:
handleCancelEvent();
return true;
break;
}
return false;
}
@Override

View File

@ -16,7 +16,7 @@
package androidx.recyclerview.selection;
import static androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import static androidx.annotation.RestrictTo.Scope.LIBRARY;
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.
* @hide
*/
@RestrictTo(LIBRARY_GROUP)
@RestrictTo(LIBRARY)
protected boolean overItemWithSelectionKey(@NonNull MotionEvent e) {
return overItem(e) && hasSelectionKey(getItemDetails(e));
}

View File

@ -16,7 +16,7 @@
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 android.content.Context;
@ -180,7 +180,7 @@ public abstract class SelectionTracker<K> {
public abstract boolean deselect(@NonNull K key);
/** @hide */
@RestrictTo(LIBRARY_GROUP)
@RestrictTo(LIBRARY)
protected abstract AdapterDataObserver getAdapterDataObserver();
/**
@ -192,7 +192,7 @@ public abstract class SelectionTracker<K> {
* work with the established anchor point to define selection ranges.
* @hide
*/
@RestrictTo(LIBRARY_GROUP)
@RestrictTo(LIBRARY)
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)}.
* @hide
*/
@RestrictTo(LIBRARY_GROUP)
@RestrictTo(LIBRARY)
public abstract void extendRange(int position);
/**
@ -217,14 +217,14 @@ public abstract class SelectionTracker<K> {
* {@link #mergeProvisionalSelection()} is called first.)
* @hide
*/
@RestrictTo(LIBRARY_GROUP)
@RestrictTo(LIBRARY)
public abstract void endRange();
/**
* @return Whether or not there is a current range selection active.
* @hide
*/
@RestrictTo(LIBRARY_GROUP)
@RestrictTo(LIBRARY)
public abstract boolean isRangeActive();
/**
@ -237,7 +237,7 @@ public abstract class SelectionTracker<K> {
* @param position the anchor position. Must already be selected.
* @hide
*/
@RestrictTo(LIBRARY_GROUP)
@RestrictTo(LIBRARY)
public abstract void anchorRange(int position);
/**
@ -246,7 +246,7 @@ public abstract class SelectionTracker<K> {
* @param position the end point.
* @hide
*/
@RestrictTo(LIBRARY_GROUP)
@RestrictTo(LIBRARY)
protected abstract void extendProvisionalRange(int position);
/**
@ -254,14 +254,14 @@ public abstract class SelectionTracker<K> {
* @param newSelection
* @hide
*/
@RestrictTo(LIBRARY_GROUP)
@RestrictTo(LIBRARY)
protected abstract void setProvisionalSelection(@NonNull Set<K> newSelection);
/**
* Clears any existing provisional selection
* @hide
*/
@RestrictTo(LIBRARY_GROUP)
@RestrictTo(LIBRARY)
protected abstract void clearProvisionalSelection();
/**
@ -269,7 +269,7 @@ public abstract class SelectionTracker<K> {
* provisional selection.
* @hide
*/
@RestrictTo(LIBRARY_GROUP)
@RestrictTo(LIBRARY)
protected abstract void mergeProvisionalSelection();
/**
@ -769,7 +769,7 @@ public abstract class SelectionTracker<K> {
try {
gestureHelper.start();
} 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
index ae3785df..1591ff4b 100644
index 76087ea4..121fbd14 100644
--- a/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> {
new Runnable() {
@@ -488,7 +488,7 @@ public abstract class SelectionTracker<K> {
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
public void run() {
- gestureHelper.start();
+ if (mSelectionPredicate.canSelectMultiple()) {
if (mSelectionPredicate.canSelectMultiple()) {
- gestureHelper.start();
+ try {
+ gestureHelper.start();
+ } catch (IllegalStateException ex) {
+ 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
index d82812cc..48db78ec 100644
--- a/app/src/main/java/androidx/recyclerview/selection/TouchInputHandler.java