├── .gitignore ├── .idea ├── .name ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── SwipeBack.iml ├── app ├── .gitignore ├── app.iml ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── cjj │ │ └── swipeback │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── cjj │ │ └── swipeback │ │ ├── MainActivity.java │ │ └── SimpleBookBackDemo.java │ └── res │ ├── anim │ └── right_anim.xml │ ├── drawable │ ├── cjj.png │ ├── jj1.png │ └── jj2.jpg │ ├── layout │ ├── activity_main.xml │ └── activity_simple_book.xml │ ├── menu │ └── menu_main.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── values-v19 │ ├── dimens.xml │ └── styles.xml │ ├── values-v21 │ └── styles.xml │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── gif ├── a.png ├── b.png ├── j1.png ├── j2.png ├── j3.png ├── j4.png ├── j5.png └── jjswipeback.gif ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── library ├── .gitignore ├── build.gradle ├── library.iml ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── cjj │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── cjj │ │ └── SwipeBackLayout.java │ └── res │ ├── anim │ ├── slide_in_right.xml │ └── slide_out_right.xml │ ├── drawable │ └── shadow.png │ └── values │ └── strings.xml └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Custom 2 | _site 3 | 4 | # Ant 5 | MANIFEST.MF 6 | ./*.jar 7 | build.num 8 | build 9 | 10 | # ADT 11 | .classpath 12 | .project 13 | .settings 14 | local.properties 15 | bin 16 | gen 17 | _layouts 18 | proguard.cfg 19 | 20 | # OSX 21 | .DS_Store 22 | 23 | # Github 24 | gh-pages 25 | 26 | # Gradle 27 | .gradle 28 | build 29 | 30 | # IDEA 31 | *.iml 32 | *.ipr 33 | *.iws 34 | out 35 | .idea 36 | 37 | # Maven 38 | target 39 | release.properties 40 | pom.xml.* -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | SwipeBack -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | 14 | 26 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 53 | 54 | 55 | 56 | 57 | 1.8 58 | 59 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JJSwipeBack 2 | 3 | activity finish like 简书 4 | 5 | ![](https://github.com/android-cjj/JJSwipeBack/blob/master/gif/jjswipeback.gif) 6 | 7 | 写了这个之后,谢谢[杨辉](http://github.com/kyze8439690)在微博提醒我,这个已经有开源库了[https://github.com/sockeqwe/SwipeBack](https://github.com/sockeqwe/SwipeBack),所以,简书99%是用了这个..... 8 | 9 | 以下所说都是废话,如果你想快速学习,可以fork或者下载源代码或者看[一步一步教你150行代码实现简书滑动返回效果](http://www.jianshu.com/p/59be4551c418),我不想浪费你时间... 10 | 11 | 12 | 13 | 14 | 其实,网上已经有教程了,我的朋友---[程序亦非猿](https://github.com/AlanCheen)(大神,请允许我抱你大腿)很早就写了[一步一步教你150行代码实现简书滑动返回效果](http://www.jianshu.com/p/59be4551c418),我没看,绝对没看,所以,毫无抄袭的可能,对吧?是吧?吧!(卧槽,你个混蛋,明明抄袭了,还死不承认)。你看,我的名字是JJSwipeBack,是不是很叼(叼你大爷),而且人家要150行,我一行搞定,啊哈哈哈!!!!!! 15 | 16 | 卧槽,其实我也不想的,群里的朋友说写的东西要加个前缀,我这么听话,肯定会做的,啊哈哈哈(哈哈你妹啊)。为什么要写简书的返回呢,因为,前天在那里开了个帐号写小说,虽然粉丝只有几个人(这几个人是被我逼着粉的),这里要打个广告了,这也是我的目的:[我的简书](http://www.jianshu.com/users/cca2dc88f629/latest_articles),对,你会看到一个不一样的[CJJ](https://github.com/android-cjj),不信,请看我简介 17 | 18 | ![](https://github.com/android-cjj/JJSwipeBack/blob/master/gif/j2.png) 19 | 20 | 看到没,是FuckCjj(呵呵,别打我)...... 21 | 22 | 看完我的小说的朋友,都打赏了,还给了鼓励的话语感谢[dim](https://github.com/zzz40500)和[鲍老弟](https://github.com/baoyongzhang),排名有分先后,谁钱给的多,谁排前后(啊哈哈,等下又要被打了) 23 | 24 | ![](https://github.com/android-cjj/JJSwipeBack/blob/master/gif/j1.png) 25 | 26 | 你看,都被我写的小说感染了,情绪有点激动,理解,写的实在太好了,我自己都被自己的文采折服...... 27 | 28 | 还有穷逼的朋友也写了评论 29 | 30 | ![](https://github.com/android-cjj/JJSwipeBack/blob/master/gif/j3.png) 31 | 32 | ![](https://github.com/android-cjj/JJSwipeBack/blob/master/gif/j4.png) 33 | 34 | ![](https://github.com/android-cjj/JJSwipeBack/blob/master/gif/j5.png) 35 | 36 | 感谢下阿[阿布](https://github.com/nimengbo)、[涛哥](https://github.com/liangzhitao)、[Veaer](https://github.com/Veaer) 37 | 38 | 你没看错,这些读者都快入迷了,是什么小说可以如此的影响一个人呢?是我写的小说就可以,还不去看,小心我f**k 你 39 | 40 | 41 | 我们都是一群豆逼的人儿,我们的群号是:GitHub小伙伴交流群 477826523 42 | 你想加入我们吗,首先github有至少7个关注者并且开源库有7颗星星的,你丫还要是个土豪,可以发红包(又拿别的群的图片来坑蒙拐骗了,啊哈哈哈) 43 | 44 | 以上都是扯淡,如果你看了,请自己洗脑删除。。。。啊哈哈哈。。。。。。。。。。。。。。。。。。。。。。。。 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /SwipeBack.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/app.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.1" 6 | 7 | defaultConfig { 8 | applicationId "com.cjj.swipeback" 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(dir: 'libs', include: ['*.jar']) 24 | compile 'com.android.support:appcompat-v7:23.0.1' 25 | compile project(':library') 26 | } 27 | -------------------------------------------------------------------------------- /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 D:\as\sdk-install/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/src/androidTest/java/com/cjj/swipeback/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.cjj.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/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/cjj/swipeback/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.cjj.swipeback; 2 | 3 | import android.content.Intent; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.os.Bundle; 6 | import android.view.Menu; 7 | import android.view.MenuItem; 8 | import android.view.View; 9 | 10 | import com.cjj.WXSwipeBackActivity; 11 | 12 | public class MainActivity extends AppCompatActivity { 13 | 14 | @Override 15 | protected void onCreate(Bundle savedInstanceState) { 16 | super.onCreate(savedInstanceState); 17 | setContentView(R.layout.activity_main); 18 | } 19 | 20 | @Override 21 | public boolean onCreateOptionsMenu(Menu menu) { 22 | // Inflate the menu; this adds items to the action bar if it is present. 23 | getMenuInflater().inflate(R.menu.menu_main, menu); 24 | return true; 25 | } 26 | 27 | @Override 28 | public boolean onOptionsItemSelected(MenuItem item) { 29 | // Handle action bar item clicks here. The action bar will 30 | // automatically handle clicks on the Home/Up button, so long 31 | // as you specify a parent activity in AndroidManifest.xml. 32 | int id = item.getItemId(); 33 | 34 | //noinspection SimplifiableIfStatement 35 | if (id == R.id.action_settings) { 36 | return true; 37 | } 38 | 39 | return super.onOptionsItemSelected(item); 40 | } 41 | 42 | public void onClick(View view) 43 | { 44 | switch (view.getId()) 45 | { 46 | case R.id.button: 47 | startActivity(new Intent(this,SimpleBookBackDemo.class)); 48 | break; 49 | 50 | } 51 | 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/java/com/cjj/swipeback/SimpleBookBackDemo.java: -------------------------------------------------------------------------------- 1 | package com.cjj.swipeback; 2 | 3 | import android.os.Bundle; 4 | import android.os.PersistableBundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.widget.RelativeLayout; 7 | import android.widget.TextView; 8 | 9 | import com.cjj.SwipeBackLayout; 10 | 11 | /** 12 | * Created by Administrator on 2015/11/17. 13 | */ 14 | public class SimpleBookBackDemo extends AppCompatActivity { 15 | private SwipeBackLayout mSwipeBackLayout; 16 | private TextView tv; 17 | private RelativeLayout rl; 18 | @Override 19 | protected void onCreate(Bundle savedInstanceState) { 20 | super.onCreate(savedInstanceState); 21 | setContentView(R.layout.activity_simple_book); 22 | rl = (RelativeLayout) findViewById(R.id.rl); 23 | tv = (TextView) findViewById(R.id.tv); 24 | tv.animate().rotation(-90); 25 | mSwipeBackLayout = (SwipeBackLayout) findViewById(R.id.sb); 26 | mSwipeBackLayout.setOnSwipeBackListener(new SwipeBackLayout.SwipeBackListener() { 27 | @Override 28 | public void onOpen() { 29 | finish(); 30 | overridePendingTransition(0, R.anim.right_anim); 31 | } 32 | 33 | @Override 34 | public void onClose() { 35 | 36 | } 37 | 38 | @Override 39 | public void onSwipe(float percent) { 40 | rl.setTranslationX(percent * 30 - 30); 41 | tv.setAlpha(percent<0.5?0.1f:percent); 42 | } 43 | }); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/res/anim/right_anim.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/cjj.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-cjj/JJSwipeBack/c309f505f860ef90af8dabb74723773944fab7de/app/src/main/res/drawable/cjj.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/jj1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-cjj/JJSwipeBack/c309f505f860ef90af8dabb74723773944fab7de/app/src/main/res/drawable/jj1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/jj2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-cjj/JJSwipeBack/c309f505f860ef90af8dabb74723773944fab7de/app/src/main/res/drawable/jj2.jpg -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 |