Skip to content

Commit fcd6d00

Browse files
committed
Fix the touch event bug in the sample app
1 parent ac67b2d commit fcd6d00

5 files changed

Lines changed: 11 additions & 11 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ a simple pinch zoom in / out for image view.
44

55
[![Platform](https://img.shields.io/badge/platform-android-green.svg)](http://developer.android.com/index.html)
66
![SDK](https://img.shields.io/badge/SDK-16%2B-green.svg)
7-
![Release](https://img.shields.io/badge/release-0.0.5-green.svg)
7+
![Release](https://img.shields.io/badge/release-0.0.6-green.svg)
88
[![Jitpack](https://jitpack.io/v/metagalactic/ScalableImageView.svg)](https://jitpack.io/#metagalactic/ScalableImageView)
99
[![Build Status](https://travis-ci.org/metagalactic/ScalableImageView.svg?branch=master)](https://github.com/metagalactic/ScalableImageView)
1010
[![CircleCI](https://circleci.com/gh/metagalactic/ScalableImageView.svg?style=svg)](https://circleci.com/gh/metagalactic/ScalableImageView)
@@ -24,7 +24,7 @@ Add jitpack to your root `build.gradle`
2424
Add the dependency
2525
```
2626
dependencies {
27-
compile 'com.github.metagalactic:ScalableImageView:0.0.5'
27+
compile 'com.github.metagalactic:ScalableImageView:0.0.6'
2828
}
2929
```
3030

sample/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ android {
1212
targetSdkVersion versions.targetSdk
1313

1414
versionCode 1
15-
versionName "0.0.5"
15+
versionName "0.0.6"
1616
}
1717

1818
buildTypes {

sample/src/main/res/layout/activity_scalable_image_view_demo.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
android:id="@+id/scalable_image_view"
88
android:layout_width="match_parent"
99
android:layout_height="match_parent"
10-
android:contentDescription="@null" />
10+
android:clickable="true"
11+
android:contentDescription="@null"
12+
android:focusableInTouchMode="true" />
1113

1214
</FrameLayout>

scalableimageview/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ android {
88
minSdkVersion versions.minSdk
99
targetSdkVersion versions.targetSdk
1010
versionCode 1
11-
versionName "0.0.5"
11+
versionName "0.0.6"
1212
}
1313

1414
buildTypes {

scalableimageview/src/main/java/com/github/metagalactic/views/ScalableImageView.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public boolean onTouchEvent(@NonNull MotionEvent event) {
101101
boolean handled = false;
102102
switch (event.getActionMasked()) {
103103
case MotionEvent.ACTION_DOWN:
104-
mIsMultiPointerEventSeries = true;
104+
mIsMultiPointerEventSeries = false;
105105
mInitialCoordinates.x = event.getX();
106106
mInitialCoordinates.y = event.getY();
107107
mPreviousCoordinates.x = event.getX();
@@ -114,9 +114,9 @@ public boolean onTouchEvent(@NonNull MotionEvent event) {
114114
case MotionEvent.ACTION_MOVE:
115115
if (event.getPointerCount() > 1) {
116116
// If at any point in this series of events we have more than one pointer, we'll
117-
// update this flag to indicate that
118-
// (a) we should not allow parent intercepts at any point during the series
119-
// (b) we should treat any event as handled if was not otherwise handled to prevent strange "click" behavior.
117+
// update this flag to indicate that (a) we should not allow parent intercepts
118+
// at any point during the series and (b) we should treat any event as handled
119+
// if was not otherwise handled to prevent strange "click" behavior.
120120
mIsMultiPointerEventSeries = true;
121121
}
122122

@@ -169,7 +169,6 @@ public boolean onTouchEvent(@NonNull MotionEvent event) {
169169
if (!mIsMultiPointerEventSeries &&
170170
Float.compare(diff.length(), mTouchSlop) > 0) {
171171
requestAllowParentIntercept = true;
172-
mIsMultiPointerEventSeries = false;
173172
}
174173
}
175174
mPreviousCoordinates.x = event.getX();
@@ -178,7 +177,6 @@ public boolean onTouchEvent(@NonNull MotionEvent event) {
178177
case MotionEvent.ACTION_CANCEL:
179178
case MotionEvent.ACTION_UP:
180179
mLastPointerId = NO_POINTER;
181-
//mIsMultiPointerEventSeries = false;
182180
if (hasScaled() || hasAttemptedPan() || hasAttemptedScale()) {
183181
handled = true;
184182
}

0 commit comments

Comments
 (0)