├── swipeback ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ └── strings.xml │ │ │ └── drawable-xhdpi │ │ │ │ └── swipe_back_shadow.png │ │ ├── java │ │ │ └── com │ │ │ │ └── sunzxy │ │ │ │ └── swipeback │ │ │ │ ├── ISwipeLayoutExtension.java │ │ │ │ ├── SwipeLayoutListener.java │ │ │ │ ├── SwipeLayoutListenerAdapter.java │ │ │ │ ├── SwipeBackPreferenceActivity.java │ │ │ │ ├── SwipeBackActivity.java │ │ │ │ ├── SwipeBackLayoutHelper.java │ │ │ │ └── SwipeBackLayout.java │ │ └── AndroidManifest.xml │ └── androidTest │ │ └── java │ │ └── com │ │ └── sunzxy │ │ └── swipeback │ │ └── ApplicationTest.java ├── proguard-rules.pro ├── build.gradle └── swipeback.iml ├── settings.gradle ├── art └── swipe.gif ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── app ├── src │ ├── main │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── dimens.xml │ │ │ │ └── styles.xml │ │ │ ├── anim │ │ │ │ ├── ht_push_left_out.xml │ │ │ │ ├── ht_push_right_in.xml │ │ │ │ ├── ht_push_right_out.xml │ │ │ │ └── ht_push_left_in.xml │ │ │ ├── values-v21 │ │ │ │ └── styles.xml │ │ │ ├── layout │ │ │ │ ├── activity_test2.xml │ │ │ │ ├── item.xml │ │ │ │ ├── activity_test1.xml │ │ │ │ ├── content_main.xml │ │ │ │ └── activity_main.xml │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ └── menu │ │ │ │ └── menu_main.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── sunzxy │ │ │ │ └── swipebackactivity │ │ │ │ ├── BaseActivity.java │ │ │ │ ├── TestActivity1.java │ │ │ │ ├── TestActivity2.java │ │ │ │ └── MainActivity.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── sunzxy │ │ │ └── swipebackactivity │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── sunzxy │ │ └── swipebackactivity │ │ └── ApplicationTest.java ├── proguard-rules.pro ├── build.gradle └── app.iml ├── gradle.properties ├── SwipeBackActivity.iml ├── .gitignore ├── README.md ├── gradlew.bat ├── gradlew └── LICENSE /swipeback/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':swipeback' 2 | -------------------------------------------------------------------------------- /art/swipe.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sunzxyong/SwipeBackActivity/HEAD/art/swipe.gif -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sunzxyong/SwipeBackActivity/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /swipeback/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | SwipeBackActivity 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sunzxyong/SwipeBackActivity/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sunzxyong/SwipeBackActivity/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sunzxyong/SwipeBackActivity/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sunzxyong/SwipeBackActivity/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sunzxyong/SwipeBackActivity/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /swipeback/src/main/res/drawable-xhdpi/swipe_back_shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sunzxyong/SwipeBackActivity/HEAD/swipeback/src/main/res/drawable-xhdpi/swipe_back_shadow.png -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | SwipeBackActivity 3 | Settings 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Mar 17 11:12:53 CST 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 16dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/java/com/sunzxy/swipebackactivity/BaseActivity.java: -------------------------------------------------------------------------------- 1 | package com.sunzxy.swipebackactivity; 2 | 3 | 4 | import com.sunzxy.swipeback.SwipeBackActivity; 5 | 6 | /** 7 | * Created by zhengxiaoyong on 16/3/5. 8 | */ 9 | public class BaseActivity extends SwipeBackActivity { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/res/anim/ht_push_left_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/anim/ht_push_right_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/anim/ht_push_right_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /swipeback/src/main/java/com/sunzxy/swipeback/ISwipeLayoutExtension.java: -------------------------------------------------------------------------------- 1 | package com.sunzxy.swipeback; 2 | 3 | /** 4 | * Created by zhengxiaoyong on 16/3/4. 5 | */ 6 | public interface ISwipeLayoutExtension { 7 | 8 | void setSwipeBackEnabled(boolean isEnabled); 9 | 10 | SwipeBackLayout getSwipeBackLayout(); 11 | } 12 | -------------------------------------------------------------------------------- /swipeback/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_test2.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/test/java/com/sunzxy/swipebackactivity/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.sunzxy.swipebackactivity; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /swipeback/src/androidTest/java/com/sunzxy/swipeback/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.sunzxy.swipeback; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/androidTest/java/com/sunzxy/swipebackactivity/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.sunzxy.swipebackactivity; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /swipeback/src/main/java/com/sunzxy/swipeback/SwipeLayoutListener.java: -------------------------------------------------------------------------------- 1 | package com.sunzxy.swipeback; 2 | 3 | import android.view.View; 4 | 5 | /** 6 | * Created by zhengxiaoyong on 16/3/4. 7 | */ 8 | public interface SwipeLayoutListener { 9 | //回调滑动的百分比 10 | void onViewFlingPercent(float flingPercent); 11 | 12 | //触摸边缘并没有拖动时回调 13 | void onEdgeTouched(); 14 | 15 | //开始拖动时回调 16 | void onEdgeDragStarted(); 17 | 18 | //抬起时回调 19 | void onViewReleased(View releasedView); 20 | 21 | //达到finish状态时回调 22 | void onViewFlingOver(); 23 | } -------------------------------------------------------------------------------- /app/src/main/java/com/sunzxy/swipebackactivity/TestActivity1.java: -------------------------------------------------------------------------------- 1 | package com.sunzxy.swipebackactivity; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.view.View; 6 | 7 | public class TestActivity1 extends BaseActivity { 8 | 9 | @Override 10 | protected void onCreate(Bundle savedInstanceState) { 11 | super.onCreate(savedInstanceState); 12 | setContentView(R.layout.activity_test1); 13 | } 14 | public void click(View view){ 15 | startActivity(new Intent(this,TestActivity2.class)); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/anim/ht_push_left_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/java/com/sunzxy/swipebackactivity/TestActivity2.java: -------------------------------------------------------------------------------- 1 | package com.sunzxy.swipebackactivity; 2 | 3 | import android.os.Bundle; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | public class TestActivity2 extends BaseActivity { 9 | @Override 10 | protected void onCreate(Bundle savedInstanceState) { 11 | super.onCreate(savedInstanceState); 12 | setContentView(R.layout.activity_test2); 13 | } 14 | 15 | @Override 16 | protected void onStart() { 17 | super.onStart(); 18 | List datas = new ArrayList<>(); 19 | for (int i = 0; i < 100; i++) { 20 | datas.add(String.valueOf(i)); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /swipeback/src/main/java/com/sunzxy/swipeback/SwipeLayoutListenerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.sunzxy.swipeback; 2 | 3 | import android.view.View; 4 | 5 | /** 6 | * Created by zhengxiaoyong on 16/3/5. 7 | */ 8 | public abstract class SwipeLayoutListenerAdapter implements SwipeLayoutListener { 9 | @Override 10 | public void onEdgeDragStarted() { 11 | 12 | } 13 | 14 | @Override 15 | public void onEdgeTouched() { 16 | 17 | } 18 | 19 | @Override 20 | public void onViewFlingOver() { 21 | 22 | } 23 | 24 | @Override 25 | public void onViewFlingPercent(float flingPercent) { 26 | 27 | } 28 | 29 | @Override 30 | public void onViewReleased(View releasedView) { 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/Sunzxyong/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /swipeback/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/Sunzxyong/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.2" 6 | 7 | defaultConfig { 8 | applicationId "com.sunzxy.swipebackactivity" 9 | minSdkVersion 14 10 | targetSdkVersion 23 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(include: ['*.jar'], dir: 'libs') 24 | testCompile 'junit:junit:4.12' 25 | compile 'com.android.support:appcompat-v7:23.0.0' 26 | compile 'com.android.support:design:23.0.0' 27 | // compile project(':swipeback') 28 | compile 'com.sunzxy.lib:swipeback:1.2.0' 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_test1.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 |