├── samples ├── libs │ └── android-support-v4.jar ├── src │ └── main │ │ ├── ic_launcher-web.png │ │ ├── res │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── values-sw600dp │ │ │ └── dimens.xml │ │ ├── menu │ │ │ └── main.xml │ │ ├── values │ │ │ ├── dimens.xml │ │ │ ├── color.xml │ │ │ ├── styles.xml │ │ │ └── strings.xml │ │ ├── values-sw720dp-land │ │ │ └── dimens.xml │ │ └── layout │ │ │ └── activity_demo.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── me │ │ └── imid │ │ └── swipebacklayout │ │ └── demo │ │ ├── PreferenceUtils.java │ │ └── DemoActivity.java └── build.gradle ├── settings.gradle ├── art ├── ic_web.png └── screenshot.png ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── library ├── libs │ └── android-support-v4.jar ├── src │ └── main │ │ ├── res │ │ ├── drawable-xhdpi │ │ │ ├── shadow_left.png │ │ │ ├── shadow_bottom.png │ │ │ └── shadow_right.png │ │ ├── layout │ │ │ └── swipeback_layout.xml │ │ └── values │ │ │ ├── styles.xml │ │ │ └── attrs.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── me │ │ └── imid │ │ └── swipebacklayout │ │ └── lib │ │ ├── app │ │ ├── SwipeBackActivityBase.java │ │ ├── SwipeBackPreferenceActivity.java │ │ ├── SwipeBackActivity.java │ │ └── SwipeBackActivityHelper.java │ │ ├── Utils.java │ │ ├── SwipeBackLayout.java │ │ └── ViewDragHelper.java └── build.gradle ├── .gitignore ├── gradlew.bat ├── README.md ├── gradlew └── LICENSE /samples/libs/android-support-v4.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':library', ':samples' 2 | -------------------------------------------------------------------------------- /art/ic_web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenSkinMonster/SwipeBackLayout/master/art/ic_web.png -------------------------------------------------------------------------------- /art/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenSkinMonster/SwipeBackLayout/master/art/screenshot.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenSkinMonster/SwipeBackLayout/master/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /library/libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenSkinMonster/SwipeBackLayout/master/library/libs/android-support-v4.jar -------------------------------------------------------------------------------- /samples/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenSkinMonster/SwipeBackLayout/master/samples/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xhdpi/shadow_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenSkinMonster/SwipeBackLayout/master/library/src/main/res/drawable-xhdpi/shadow_left.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenSkinMonster/SwipeBackLayout/master/samples/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenSkinMonster/SwipeBackLayout/master/samples/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenSkinMonster/SwipeBackLayout/master/samples/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xhdpi/shadow_bottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenSkinMonster/SwipeBackLayout/master/library/src/main/res/drawable-xhdpi/shadow_bottom.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xhdpi/shadow_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenSkinMonster/SwipeBackLayout/master/library/src/main/res/drawable-xhdpi/shadow_right.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenSkinMonster/SwipeBackLayout/master/samples/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/src/main/res/values-sw600dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sat Jul 11 17:40:25 PDT 2015 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.4-all.zip 7 | -------------------------------------------------------------------------------- /samples/src/main/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | -------------------------------------------------------------------------------- /samples/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 16dip 6 | 7 | -------------------------------------------------------------------------------- /samples/src/main/res/values-sw720dp-land/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 128dp 5 | 6 | -------------------------------------------------------------------------------- /library/src/main/res/layout/swipeback_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /samples/src/main/res/values/color.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #33B5E5 5 | #AA66CC 6 | #99CC00 7 | #FFBB33 8 | #FF4444 9 | -------------------------------------------------------------------------------- /library/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | -------------------------------------------------------------------------------- /library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #Android generated 2 | bin 3 | gen 4 | gen* 5 | 6 | #Eclipse 7 | .project 8 | .classpath 9 | .settings 10 | 11 | #IntelliJ IDEA 12 | .idea 13 | *.iml 14 | *.ipr 15 | *.iws 16 | out 17 | build 18 | 19 | #Maven 20 | target 21 | release.properties 22 | pom.xml.* 23 | 24 | #Ant 25 | build.xml 26 | local.properties 27 | proguard.cfg 28 | 29 | #OSX 30 | .DS_Store 31 | 32 | #gradle 33 | .gradle 34 | 35 | #keystore 36 | keystore 37 | gradle.properties 38 | -------------------------------------------------------------------------------- /library/src/main/java/me/imid/swipebacklayout/lib/app/SwipeBackActivityBase.java: -------------------------------------------------------------------------------- 1 | package me.imid.swipebacklayout.lib.app; 2 | 3 | import me.imid.swipebacklayout.lib.SwipeBackLayout; 4 | /** 5 | * @author Yrom 6 | */ 7 | public interface SwipeBackActivityBase { 8 | /** 9 | * @return the SwipeBackLayout associated with this activity. 10 | */ 11 | public abstract SwipeBackLayout getSwipeBackLayout(); 12 | 13 | public abstract void setSwipeBackEnable(boolean enable); 14 | 15 | /** 16 | * Scroll out contentView and finish the activity 17 | */ 18 | public abstract void scrollToFinishActivity(); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /samples/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /samples/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SwipeBackDemo 5 | Github 6 | Start new activity! 7 | Finish Activity 8 | 9 | key_tracking_mode 10 | Left 11 | Right 12 | Bottom 13 | All 14 | 15 | 16 | -------------------------------------------------------------------------------- /library/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /samples/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 12 | 13 | 18 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /samples/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | repositories { 4 | mavenCentral() 5 | } 6 | 7 | dependencies { 8 | compile 'com.android.support:appcompat-v7:22.2.0' 9 | compile project(':library') 10 | } 11 | 12 | android { 13 | compileSdkVersion 22 14 | buildToolsVersion "22.0.1" 15 | 16 | defaultConfig { 17 | minSdkVersion 7 18 | targetSdkVersion 22 19 | } 20 | 21 | signingConfigs { 22 | signing 23 | } 24 | 25 | buildTypes { 26 | release { 27 | if (project.hasProperty('storeFile')) { 28 | signingConfig signingConfigs.signing 29 | } 30 | } 31 | } 32 | } 33 | 34 | if (project.hasProperty('storeFile')) { 35 | android.signingConfigs.signing.storeFile = file(storeFile) 36 | } 37 | 38 | if (project.hasProperty('storePassword')) { 39 | android.signingConfigs.signing.storePassword = storePassword 40 | } 41 | 42 | if (project.hasProperty('keyAlias')) { 43 | android.signingConfigs.signing.keyAlias = keyAlias 44 | } 45 | 46 | if (project.hasProperty('keyPassword')) { 47 | android.signingConfigs.signing.keyPassword = keyPassword 48 | } 49 | -------------------------------------------------------------------------------- /library/src/main/java/me/imid/swipebacklayout/lib/app/SwipeBackPreferenceActivity.java: -------------------------------------------------------------------------------- 1 | 2 | package me.imid.swipebacklayout.lib.app; 3 | 4 | import me.imid.swipebacklayout.lib.SwipeBackLayout; 5 | import android.os.Bundle; 6 | import android.preference.PreferenceActivity; 7 | import android.view.View; 8 | 9 | public class SwipeBackPreferenceActivity extends PreferenceActivity implements SwipeBackActivityBase { 10 | private SwipeBackActivityHelper mHelper; 11 | 12 | @Override 13 | protected void onCreate(Bundle savedInstanceState) { 14 | super.onCreate(savedInstanceState); 15 | mHelper = new SwipeBackActivityHelper(this); 16 | mHelper.onActivityCreate(); 17 | } 18 | 19 | @Override 20 | protected void onPostCreate(Bundle savedInstanceState) { 21 | super.onPostCreate(savedInstanceState); 22 | mHelper.onPostCreate(); 23 | } 24 | 25 | @Override 26 | public View findViewById(int id) { 27 | View v = super.findViewById(id); 28 | if (v == null && mHelper != null) 29 | return mHelper.findViewById(id); 30 | return v; 31 | } 32 | 33 | @Override 34 | public SwipeBackLayout getSwipeBackLayout() { 35 | return mHelper.getSwipeBackLayout(); 36 | } 37 | @Override 38 | public void setSwipeBackEnable(boolean enable) { 39 | getSwipeBackLayout().setEnableGesture(enable); 40 | } 41 | 42 | @Override 43 | public void scrollToFinishActivity() { 44 | getSwipeBackLayout().scrollToFinishActivity(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /library/src/main/java/me/imid/swipebacklayout/lib/app/SwipeBackActivity.java: -------------------------------------------------------------------------------- 1 | 2 | package me.imid.swipebacklayout.lib.app; 3 | 4 | import android.os.Bundle; 5 | import android.support.v4.app.FragmentActivity; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.view.View; 8 | 9 | import me.imid.swipebacklayout.lib.SwipeBackLayout; 10 | import me.imid.swipebacklayout.lib.Utils; 11 | 12 | public class SwipeBackActivity extends AppCompatActivity implements SwipeBackActivityBase { 13 | private SwipeBackActivityHelper mHelper; 14 | 15 | @Override 16 | protected void onCreate(Bundle savedInstanceState) { 17 | super.onCreate(savedInstanceState); 18 | mHelper = new SwipeBackActivityHelper(this); 19 | mHelper.onActivityCreate(); 20 | } 21 | 22 | @Override 23 | protected void onPostCreate(Bundle savedInstanceState) { 24 | super.onPostCreate(savedInstanceState); 25 | mHelper.onPostCreate(); 26 | } 27 | 28 | @Override 29 | public View findViewById(int id) { 30 | View v = super.findViewById(id); 31 | if (v == null && mHelper != null) 32 | return mHelper.findViewById(id); 33 | return v; 34 | } 35 | 36 | @Override 37 | public SwipeBackLayout getSwipeBackLayout() { 38 | return mHelper.getSwipeBackLayout(); 39 | } 40 | 41 | @Override 42 | public void setSwipeBackEnable(boolean enable) { 43 | getSwipeBackLayout().setEnableGesture(enable); 44 | } 45 | 46 | @Override 47 | public void scrollToFinishActivity() { 48 | Utils.convertActivityToTranslucent(this); 49 | getSwipeBackLayout().scrollToFinishActivity(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /library/src/main/java/me/imid/swipebacklayout/lib/app/SwipeBackActivityHelper.java: -------------------------------------------------------------------------------- 1 | package me.imid.swipebacklayout.lib.app; 2 | 3 | import android.app.Activity; 4 | import android.graphics.Color; 5 | import android.graphics.drawable.ColorDrawable; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | 9 | import me.imid.swipebacklayout.lib.SwipeBackLayout; 10 | import me.imid.swipebacklayout.lib.Utils; 11 | 12 | /** 13 | * @author Yrom 14 | */ 15 | public class SwipeBackActivityHelper { 16 | private Activity mActivity; 17 | 18 | private SwipeBackLayout mSwipeBackLayout; 19 | 20 | public SwipeBackActivityHelper(Activity activity) { 21 | mActivity = activity; 22 | } 23 | 24 | @SuppressWarnings("deprecation") 25 | public void onActivityCreate() { 26 | mActivity.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); 27 | mActivity.getWindow().getDecorView().setBackgroundDrawable(null); 28 | mSwipeBackLayout = (SwipeBackLayout) LayoutInflater.from(mActivity).inflate( 29 | me.imid.swipebacklayout.lib.R.layout.swipeback_layout, null); 30 | mSwipeBackLayout.addSwipeListener(new SwipeBackLayout.SwipeListener() { 31 | @Override 32 | public void onScrollStateChange(int state, float scrollPercent) { 33 | } 34 | 35 | @Override 36 | public void onEdgeTouch(int edgeFlag) { 37 | Utils.convertActivityToTranslucent(mActivity); 38 | } 39 | 40 | @Override 41 | public void onScrollOverThreshold() { 42 | 43 | } 44 | }); 45 | } 46 | 47 | public void onPostCreate() { 48 | mSwipeBackLayout.attachToActivity(mActivity); 49 | } 50 | 51 | public View findViewById(int id) { 52 | if (mSwipeBackLayout != null) { 53 | return mSwipeBackLayout.findViewById(id); 54 | } 55 | return null; 56 | } 57 | 58 | public SwipeBackLayout getSwipeBackLayout() { 59 | return mSwipeBackLayout; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /library/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | repositories { 4 | mavenCentral() 5 | } 6 | 7 | dependencies { 8 | compile 'com.android.support:appcompat-v7:22.2.0' 9 | } 10 | 11 | android { 12 | compileSdkVersion 22 13 | buildToolsVersion "22.0.1" 14 | 15 | defaultConfig { 16 | minSdkVersion 7 17 | targetSdkVersion 22 18 | versionCode 1 19 | versionName "1.0.0" 20 | } 21 | } 22 | 23 | /* 24 | def siteUrl = 'https://github.com/ikew0ng/SwipeBackLayout' 25 | def gitUrl = 'https://github.com/ikew0ng/SwipeBackLayout.git' 26 | group = "me.imid.swipebacklayout.lib" 27 | 28 | install { 29 | repositories.mavenInstaller { 30 | pom { 31 | project { 32 | packaging 'aar' 33 | // Add your description here 34 | name 'An Android library that help you to build app with swipe back gesture.' 35 | url siteUrl 36 | licenses { 37 | license { 38 | name 'The Apache Software License, Version 2.0' 39 | url 'http://www.apache.org/licenses/LICENSE-2.0.txt' 40 | } 41 | } 42 | developers { 43 | developer { 44 | id 'ike' 45 | name 'ike' 46 | email 'ike@imid.me' 47 | } 48 | } 49 | scm { 50 | connection gitUrl 51 | developerConnection gitUrl 52 | url siteUrl 53 | } 54 | } 55 | } 56 | } 57 | } 58 | task sourcesJar(type: Jar) { 59 | from android.sourceSets.main.java.srcDirs 60 | classifier = 'sources' 61 | } 62 | task javadoc(type: Javadoc) { 63 | source = android.sourceSets.main.java.srcDirs 64 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 65 | } 66 | task javadocJar(type: Jar, dependsOn: javadoc) { 67 | classifier = 'javadoc' 68 | from javadoc.destinationDir 69 | } 70 | artifacts { 71 | archives javadocJar 72 | archives sourcesJar 73 | } 74 | Properties properties = new Properties() 75 | File gradle_properties = project.file('gradle.properties'); 76 | if (gradle_properties.exists()) { 77 | properties.load(project.file('gradle.properties').newDataInputStream()) 78 | } 79 | bintray { 80 | user = properties.getProperty("bintray.user") 81 | key = properties.getProperty("bintray.apikey") 82 | configurations = ['archives'] 83 | pkg { 84 | repo = "maven" 85 | name = "SwipeBackLayout" 86 | websiteUrl = siteUrl 87 | vcsUrl = gitUrl 88 | licenses = ["Apache-2.0"] 89 | publish = true 90 | } 91 | }*/ -------------------------------------------------------------------------------- /samples/src/main/res/layout/activity_demo.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | 14 |