From 564a74fcc764c8e42149803bd3551ac4d12f7824 Mon Sep 17 00:00:00 2001 From: daimajia Date: Thu, 9 Mar 2017 11:22:01 +0800 Subject: [PATCH 1/6] update build config, fix #397 --- build.gradle | 2 +- demo/build.gradle | 2 +- .../util/RecyclerItemClickListener.java | 5 +++ gradle.properties | 8 ++--- gradle/wrapper/gradle-wrapper.properties | 4 +-- library/build.gradle | 7 ++-- .../java/com/daimajia/swipe/SwipeLayout.java | 35 ++++++++++++------- 7 files changed, 38 insertions(+), 25 deletions(-) diff --git a/build.gradle b/build.gradle index 21b3e999..8be8cc1a 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { } } dependencies { - classpath 'com.android.tools.build:gradle:1.0.0' + classpath 'com.android.tools.build:gradle:2.2.3' classpath 'com.github.dcendents:android-maven-plugin:1.2' // NOTE: Do not place your application dependencies here; they belong diff --git a/demo/build.gradle b/demo/build.gradle index 586f375b..09dca2ba 100644 --- a/demo/build.gradle +++ b/demo/build.gradle @@ -26,7 +26,7 @@ android { dependencies { compile project(":library") - compile 'com.android.support:recyclerview-v7:21.0.0' + compile 'com.android.support:recyclerview-v7:25.1.1' compile 'com.daimajia.easing:library:1.0.0@aar' compile 'com.daimajia.androidanimations:library:1.1.2@aar' compile 'com.nineoldandroids:library:2.4.0' diff --git a/demo/src/main/java/com/daimajia/swipedemo/adapter/util/RecyclerItemClickListener.java b/demo/src/main/java/com/daimajia/swipedemo/adapter/util/RecyclerItemClickListener.java index af4021b1..613e8e52 100644 --- a/demo/src/main/java/com/daimajia/swipedemo/adapter/util/RecyclerItemClickListener.java +++ b/demo/src/main/java/com/daimajia/swipedemo/adapter/util/RecyclerItemClickListener.java @@ -37,4 +37,9 @@ public boolean onInterceptTouchEvent(RecyclerView view, MotionEvent e) { @Override public void onTouchEvent(RecyclerView view, MotionEvent motionEvent) { } + + @Override + public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) { + + } } diff --git a/gradle.properties b/gradle.properties index efb99e76..beab8970 100644 --- a/gradle.properties +++ b/gradle.properties @@ -22,7 +22,7 @@ VERSION_NAME=1.2.0 VERSION_CODE=22 GROUP=com.daimajia.swipelayout -ANDROID_BUILD_MIN_SDK_VERSION=8 -ANDROID_BUILD_TARGET_SDK_VERSION=21 -ANDROID_BUILD_SDK_VERSION=21 -ANDROID_BUILD_TOOLS_VERSION=21.0.0 +ANDROID_BUILD_MIN_SDK_VERSION=9 +ANDROID_BUILD_TARGET_SDK_VERSION=25 +ANDROID_BUILD_SDK_VERSION=25 +ANDROID_BUILD_TOOLS_VERSION=25.0.2 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index af3deba8..0d6bfac7 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Apr 10 15:27:10 PDT 2013 +#Wed Mar 08 17:06:52 CST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-2.2.1-all.zip \ No newline at end of file +distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip diff --git a/library/build.gradle b/library/build.gradle index 00c2f126..d3c36f37 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -5,18 +5,17 @@ android { buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION defaultConfig { - minSdkVersion 8 + minSdkVersion 9 targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION) } } dependencies { - compile 'com.android.support:recyclerview-v7:21.0.0' - compile 'com.android.support:support-v4:22.1.1' + compile 'com.android.support:recyclerview-v7:25.1.1' + compile 'com.android.support:support-v4:25.1.1' } apply from: './gradle-mvn-push.gradle' -apply plugin: 'android-maven' // build a jar with source files task sourcesJar(type: Jar) { from android.sourceSets.main.java.srcDirs diff --git a/library/src/main/java/com/daimajia/swipe/SwipeLayout.java b/library/src/main/java/com/daimajia/swipe/SwipeLayout.java index 578e770f..316e9b94 100644 --- a/library/src/main/java/com/daimajia/swipe/SwipeLayout.java +++ b/library/src/main/java/com/daimajia/swipe/SwipeLayout.java @@ -59,8 +59,8 @@ public class SwipeLayout extends FrameLayout { private boolean mSwipeEnabled = true; private boolean[] mSwipesEnabled = new boolean[]{true, true, true, true}; private boolean mClickToClose = false; - private float mWillOpenPercentAfterOpen=0.75f; - private float mWillOpenPercentAfterClose=0.25f; + private float mWillOpenPercentAfterOpen = 0.75f; + private float mWillOpenPercentAfterClose = 0.25f; public enum DragEdge { Left, @@ -403,9 +403,9 @@ else if (mCurrentDragEdge == DragEdge.Bottom && newTop > getPaddingTop()) /** * save children's bounds, so they can restore the bound in {@link #onLayout(boolean, int, int, int, int)} */ - private void captureChildrenBound(){ + private void captureChildrenBound() { View currentBottomView = getCurrentBottomView(); - if(getOpenStatus()==Status.Close){ + if (getOpenStatus() == Status.Close) { mViewBoundCache.remove(currentBottomView); return; } @@ -413,7 +413,7 @@ private void captureChildrenBound(){ View[] views = new View[]{getSurfaceView(), currentBottomView}; for (View child : views) { Rect rect = mViewBoundCache.get(child); - if(rect==null){ + if (rect == null) { rect = new Rect(); mViewBoundCache.put(child, rect); } @@ -794,14 +794,15 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) { void layoutPullOut() { View surfaceView = getSurfaceView(); Rect surfaceRect = mViewBoundCache.get(surfaceView); - if(surfaceRect == null) surfaceRect = computeSurfaceLayoutArea(false); + if (surfaceRect == null) surfaceRect = computeSurfaceLayoutArea(false); if (surfaceView != null) { surfaceView.layout(surfaceRect.left, surfaceRect.top, surfaceRect.right, surfaceRect.bottom); bringChildToFront(surfaceView); } View currentBottomView = getCurrentBottomView(); Rect bottomViewRect = mViewBoundCache.get(currentBottomView); - if(bottomViewRect == null) bottomViewRect = computeBottomLayoutAreaViaSurface(ShowMode.PullOut, surfaceRect); + if (bottomViewRect == null) + bottomViewRect = computeBottomLayoutAreaViaSurface(ShowMode.PullOut, surfaceRect); if (currentBottomView != null) { currentBottomView.layout(bottomViewRect.left, bottomViewRect.top, bottomViewRect.right, bottomViewRect.bottom); } @@ -810,14 +811,15 @@ void layoutPullOut() { void layoutLayDown() { View surfaceView = getSurfaceView(); Rect surfaceRect = mViewBoundCache.get(surfaceView); - if(surfaceRect == null) surfaceRect = computeSurfaceLayoutArea(false); + if (surfaceRect == null) surfaceRect = computeSurfaceLayoutArea(false); if (surfaceView != null) { surfaceView.layout(surfaceRect.left, surfaceRect.top, surfaceRect.right, surfaceRect.bottom); bringChildToFront(surfaceView); } View currentBottomView = getCurrentBottomView(); Rect bottomViewRect = mViewBoundCache.get(currentBottomView); - if(bottomViewRect == null) bottomViewRect = computeBottomLayoutAreaViaSurface(ShowMode.LayDown, surfaceRect); + if (bottomViewRect == null) + bottomViewRect = computeBottomLayoutAreaViaSurface(ShowMode.LayDown, surfaceRect); if (currentBottomView != null) { currentBottomView.layout(bottomViewRect.left, bottomViewRect.top, bottomViewRect.right, bottomViewRect.bottom); } @@ -1043,10 +1045,12 @@ public boolean isBottomSwipeEnabled() { public void setBottomSwipeEnabled(boolean bottomSwipeEnabled) { this.mSwipesEnabled[DragEdge.Bottom.ordinal()] = bottomSwipeEnabled; } + /*** * Returns the percentage of revealing at which the view below should the view finish opening * if it was already open before dragging - * @returns The percentage of view revealed to trigger, default value is 0.25 + * + * @returns The percentage of view revealed to trigger, default value is 0.25 */ public float getWillOpenPercentAfterOpen() { return mWillOpenPercentAfterOpen; @@ -1055,22 +1059,27 @@ public float getWillOpenPercentAfterOpen() { /*** * Allows to stablish at what percentage of revealing the view below should the view finish opening * if it was already open before dragging + * * @param willOpenPercentAfterOpen The percentage of view revealed to trigger, default value is 0.25 */ public void setWillOpenPercentAfterOpen(float willOpenPercentAfterOpen) { this.mWillOpenPercentAfterOpen = willOpenPercentAfterOpen; } + /*** * Returns the percentage of revealing at which the view below should the view finish opening * if it was already closed before dragging - * @returns The percentage of view revealed to trigger, default value is 0.25 + * + * @returns The percentage of view revealed to trigger, default value is 0.25 */ public float getWillOpenPercentAfterClose() { return mWillOpenPercentAfterClose; } + /*** * Allows to stablish at what percentage of revealing the view below should the view finish opening * if it was already closed before dragging + * * @param willOpenPercentAfterClose The percentage of view revealed to trigger, default value is 0.75 */ public void setWillOpenPercentAfterClose(float willOpenPercentAfterClose) { @@ -1324,7 +1333,7 @@ protected void processHandRelease(float xvel, float yvel, boolean isCloseBeforeD if (currentDragEdge == null || surfaceView == null) { return; } - float willOpenPercent = (isCloseBeforeDragged ? mWillOpenPercentAfterClose : mWillOpenPercentAfterOpen);); + float willOpenPercent = (isCloseBeforeDragged ? mWillOpenPercentAfterClose : mWillOpenPercentAfterOpen); if (currentDragEdge == DragEdge.Left) { if (xvel > minVelocity) open(); else if (xvel < -minVelocity) close(); @@ -1563,7 +1572,7 @@ public void setDragEdge(DragEdge dragEdge) { setCurrentDragEdge(dragEdge); } - protected void onViewRemoved(View child) { + public void onViewRemoved(View child) { for (Map.Entry entry : new HashMap(mDragEdges).entrySet()) { if (entry.getValue() == child) { mDragEdges.remove(entry.getKey()); From 91dddd3b5acd8866912ccaf968cdc3047cd86b32 Mon Sep 17 00:00:00 2001 From: daimajia Date: Thu, 9 Mar 2017 16:26:37 +0800 Subject: [PATCH 2/6] update build tools, add travis config. --- .travis.yml | 12 ++++++++++++ build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 4 ++-- library/build.gradle | 4 ++-- 4 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..f4c489a8 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,12 @@ +language: android +android: + components: + - tools + - platform-tools + - build-tools-25.2.0 + - android-25 + - extra-android-support + - extra + - extra-android-m2repository +script: + - ./gradlew assembleDebug \ No newline at end of file diff --git a/build.gradle b/build.gradle index 8be8cc1a..82697f55 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { } } dependencies { - classpath 'com.android.tools.build:gradle:2.2.3' + classpath 'com.android.tools.build:gradle:2.3.0' classpath 'com.github.dcendents:android-maven-plugin:1.2' // NOTE: Do not place your application dependencies here; they belong diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0d6bfac7..776d2a5a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Mar 08 17:06:52 CST 2017 +#Thu Mar 09 16:07:03 CST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip diff --git a/library/build.gradle b/library/build.gradle index d3c36f37..906272e1 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -11,8 +11,8 @@ android { } dependencies { - compile 'com.android.support:recyclerview-v7:25.1.1' - compile 'com.android.support:support-v4:25.1.1' + compile 'com.android.support:recyclerview-v7:25.2.0' + compile 'com.android.support:support-v4:25.2.0' } apply from: './gradle-mvn-push.gradle' From 4e55a83a7383cb51a68e0a11a10eda78146b9bd3 Mon Sep 17 00:00:00 2001 From: daimajia Date: Thu, 9 Mar 2017 16:29:47 +0800 Subject: [PATCH 3/6] update readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 4cf4a10a..c485d2bc 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,8 @@ dependencies { ### Step 2 +**Make sure to use the internal adapter instead of your own!** + [Wiki Usage](https://github.com/daimajia/AndroidSwipeLayout/wiki/usage) ## Wiki From 85adc4a022bd48794bf40bb4e0a675bde117d9d7 Mon Sep 17 00:00:00 2001 From: daimajia Date: Thu, 9 Mar 2017 16:39:15 +0800 Subject: [PATCH 4/6] remove nullable. --- .travis.yml | 2 +- library/src/main/java/com/daimajia/swipe/SwipeLayout.java | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index f4c489a8..797c2f4b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ android: components: - tools - platform-tools - - build-tools-25.2.0 + - build-tools-25.0.2 - android-25 - extra-android-support - extra diff --git a/library/src/main/java/com/daimajia/swipe/SwipeLayout.java b/library/src/main/java/com/daimajia/swipe/SwipeLayout.java index 316e9b94..6703123c 100644 --- a/library/src/main/java/com/daimajia/swipe/SwipeLayout.java +++ b/library/src/main/java/com/daimajia/swipe/SwipeLayout.java @@ -3,7 +3,6 @@ import android.content.Context; import android.content.res.TypedArray; import android.graphics.Rect; -import android.support.annotation.Nullable; import android.support.v4.view.GravityCompat; import android.support.v4.view.ViewCompat; import android.support.v4.widget.ViewDragHelper; @@ -1270,7 +1269,6 @@ public View getSurfaceView() { /** * return null if there is no bottom view */ - @Nullable public View getCurrentBottomView() { List bottoms = getBottomViews(); if (mCurrentDragEdge.ordinal() < bottoms.size()) { From 2d6d44fb936a49ff34fcf8a8068530c325a67ea0 Mon Sep 17 00:00:00 2001 From: daimajia Date: Thu, 9 Mar 2017 16:50:19 +0800 Subject: [PATCH 5/6] add build status badge. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c485d2bc..acb57fbf 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Android Swipe Layout +# Android Swipe Layout [![Build Status](https://travis-ci.org/daimajia/AndroidSwipeLayout.svg?branch=master)](https://travis-ci.org/daimajia/AndroidSwipeLayout) [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/daimajia/AndroidSwipeLayout?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) From cf179b12708a4b0b4eeb27e3be094a20806cb6b8 Mon Sep 17 00:00:00 2001 From: chongzhe Date: Mon, 10 Jul 2017 17:31:28 -0700 Subject: [PATCH 6/6] add insight.io badge to README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index acb57fbf..55c53938 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/daimajia/AndroidSwipeLayout?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![Insight.io](https://insight.io/repoBadge/github.com/daimajia/AndroidSwipeLayout)](https://insight.io/github.com/daimajia/AndroidSwipeLayout) + This is the brother of [AndroidViewHover](https://github.com/daimajia/AndroidViewHover). One year ago, I started to make an app named [EverMemo](https://play.google.com/store/apps/details?id=com.zhan_dui.evermemo) with my good friends. The designer gave me a design picture, the design like this: