Skip to content

Commit 8d21f09

Browse files
committed
fix: respect isEnabled() in touch and nested scrolling logic and bump version to v1.0.2
1 parent 50ae66c commit 8d21f09

3 files changed

Lines changed: 12 additions & 9 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Platform](https://img.shields.io/badge/platform-Android-blue.svg)](https://developer.android.com/)
44
[![API](https://img.shields.io/badge/API-26%2B-brightgreen.svg)](https://android-arsenal.com/api?level=26)
55
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
6-
[![JitPack](https://img.shields.io/badge/JitPack-1.0.0-green.svg)](https://jitpack.io/#Netsnake-TN/ExpressivepullToRefresh)
6+
[![JitPack](https://img.shields.io/badge/JitPack-1.0.2-green.svg)](https://jitpack.io/#Netsnake-TN/ExpressivepullToRefresh)
77

88
A Material Design 3 Expressive Pull-to-Refresh component for Android. Provides two distinct indicator styles with smooth animations, haptic feedback, and seamless integration for all scrollable views.
99

@@ -62,7 +62,7 @@ dependencyResolutionManagement {
6262

6363
```gradle
6464
dependencies {
65-
implementation 'com.github.Netsnake-TN:ExpressivepullToRefresh:v1.0.1'
65+
implementation 'com.github.Netsnake-TN:ExpressivepullToRefresh:v1.0.2'
6666
}
6767
```
6868

refresh/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ android {
1111
minSdk 26
1212
targetSdk 36
1313
versionCode 1
14-
versionName "1.0"
14+
versionName "1.0.2"
1515

1616
consumerProguardFiles 'consumer-rules.pro'
1717
}
@@ -51,7 +51,7 @@ afterEvaluate {
5151
release(MavenPublication) {
5252
groupId = 'com.github.Netsnake-TN'
5353
artifactId = 'ExpressivepullToRefresh'
54-
version = '1.0.0'
54+
version = '1.0.2'
5555
from components.release
5656
}
5757
}

refresh/src/main/java/com/expressive/refresh/ExpressivePullToRefresh.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
280280
@Override
281281
public boolean onInterceptTouchEvent(MotionEvent ev) {
282282
ensureTarget();
283-
if (!isEnabled() || canChildScrollUp() || mRefreshing) {
283+
if (!isEnabled() || canChildScrollUp() || mRefreshing || mNestedScrollInProgress) {
284284
return false;
285285
}
286286

@@ -343,7 +343,7 @@ private float getMotionEventY(MotionEvent ev, int activePointerId) {
343343

344344
@Override
345345
public boolean onTouchEvent(MotionEvent ev) {
346-
if (!isEnabled() || canChildScrollUp()) {
346+
if (!isEnabled() || canChildScrollUp() || mRefreshing || mNestedScrollInProgress) {
347347
return false;
348348
}
349349

@@ -567,7 +567,7 @@ public void onNestedScroll(@NonNull View target, int dxConsumed, int dyConsumed,
567567

568568
@Override
569569
public boolean onStartNestedScroll(@NonNull View child, @NonNull View target, int axes, int type) {
570-
return (axes & ViewCompat.SCROLL_AXIS_VERTICAL) != 0;
570+
return isEnabled() && !mRefreshing && (axes & ViewCompat.SCROLL_AXIS_VERTICAL) != 0;
571571
}
572572

573573
@Override
@@ -596,7 +596,7 @@ public void onNestedScroll(@NonNull View target, int dxConsumed, int dyConsumed,
596596

597597
@Override
598598
public void onNestedPreScroll(@NonNull View target, int dx, int dy, @NonNull int[] consumed, int type) {
599-
if (dy > 0 && mTotalUnconsumed > 0) {
599+
if (isEnabled() && dy > 0 && mTotalUnconsumed > 0) {
600600
if (dy > mTotalUnconsumed) {
601601
consumed[1] = (int) mTotalUnconsumed;
602602
mTotalUnconsumed = 0;
@@ -705,7 +705,10 @@ public int getNestedScrollAxes() {
705705
}
706706

707707
private void onNestedScrollInternal(int dyUnconsumed, int type, @Nullable int[] consumed) {
708-
if (dyUnconsumed < 0 && !canChildScrollUp()) {
708+
if (!isEnabled() || mRefreshing || canChildScrollUp()) {
709+
return;
710+
}
711+
if (dyUnconsumed < 0) {
709712
mTotalUnconsumed += Math.abs(dyUnconsumed);
710713
moveSpinner(mTotalUnconsumed);
711714

0 commit comments

Comments
 (0)