├── .gitignore ├── CHANGELOG.md ├── LICENSE.txt ├── README.md ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── library ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── klinker │ │ └── android │ │ └── sliding │ │ ├── ColorUtils.java │ │ ├── MultiShrinkScroller.java │ │ ├── SchedulingUtils.java │ │ ├── SlidingActivity.java │ │ ├── TouchlessScrollView.java │ │ └── ViewUtil.java │ └── res │ ├── layout-land │ └── sliding_activity.xml │ ├── layout-sw600dp-land │ └── sliding_activity.xml │ ├── layout-sw600dp │ └── sliding_activity.xml │ ├── layout-sw720dp-land │ └── sliding_activity.xml │ ├── layout │ ├── sliding_activity.xml │ ├── sliding_content.xml │ ├── sliding_header.xml │ ├── sliding_title.xml │ └── sliding_title_placeholder.xml │ ├── values-land │ ├── bools.xml │ ├── dimens.xml │ └── integers.xml │ ├── values-night │ └── styles.xml │ ├── values-sw600dp-land │ ├── bools.xml │ └── dimens.xml │ ├── values-sw600dp │ ├── bools.xml │ ├── dimens.xml │ └── integers.xml │ ├── values-sw720dp-land │ └── dimens.xml │ ├── values-sw720dp │ ├── dimens.xml │ └── integers.xml │ ├── values-v21 │ └── dimens.xml │ └── values │ ├── attrs.xml │ ├── bools.xml │ ├── colors.xml │ ├── dimens.xml │ ├── integers.xml │ ├── strings.xml │ └── styles.xml ├── preview.gif ├── preview_inbox_animation.gif ├── preview_landscape.gif ├── preview_peekview.gif ├── sample ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── klinker │ │ └── android │ │ └── sliding │ │ └── sample │ │ ├── CustomHeaderActivity.java │ │ ├── DarkActivity.java │ │ ├── FabActivity.java │ │ ├── FullscreenActivity.java │ │ ├── ImageActivity.java │ │ ├── MenuItemActivity.java │ │ ├── NoHeaderActivity.java │ │ ├── NormalActivity.java │ │ ├── SampleActivity.java │ │ └── TalonActivity.java │ └── res │ ├── drawable-nodpi │ ├── favorite_1_image.jpg │ ├── favorite_2_profile.jpeg │ ├── follower_1.jpeg │ ├── follower_2.jpg │ ├── follower_3.jpg │ ├── following_1.png │ ├── following_2.png │ ├── following_3.png │ ├── mention_1_image.png │ ├── mention_1_profile.jpg │ ├── mention_1_profile_2.png │ ├── mention_2_profile.jpg │ ├── mention_3_profile.png │ ├── profile_picture.JPG │ ├── tweet_1_image.png │ ├── tweet_1_profile.png │ └── twitter_profile.jpg │ ├── drawable-xhdpi │ ├── ic_add.png │ ├── ic_debug.png │ ├── ic_location.png │ └── ic_message.png │ ├── drawable-xxhdpi │ ├── ic_add.png │ ├── ic_debug.png │ ├── ic_location.png │ └── ic_message.png │ ├── drawable-xxxhdpi │ ├── ic_add.png │ ├── ic_debug.png │ ├── ic_location.png │ └── ic_message.png │ ├── layout │ ├── activity_content.xml │ ├── activity_custom_header.xml │ ├── activity_feedback.xml │ ├── activity_sample.xml │ ├── activity_talon.xml │ ├── favorite_1.xml │ ├── favorite_2.xml │ ├── mention_1.xml │ ├── mention_2.xml │ ├── mention_3.xml │ ├── peek_example.xml │ ├── talon_favorites_card.xml │ ├── talon_mentions_card.xml │ ├── talon_stats_card.xml │ ├── talon_tweets_card.xml │ ├── tweet_1.xml │ ├── tweet_2.xml │ └── tweet_3.xml │ ├── menu │ ├── activity_menu_item.xml │ └── activity_talon.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | /.idea/libraries 5 | .DS_Store 6 | /build 7 | /captures 8 | /.idea/* 9 | **/*.iml 10 | *.md~ 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## Changelog 2 | 3 | ### Version 1.5.2: 4 | - Remove `final` modifier, per request 5 | 6 | ### Version 1.5.1: 7 | - Update dependencies and build tools for SDK 26 8 | 9 | ### Version 1.5.0: 10 | - Add ability to put a transparent overlay over the header image 11 | - Add method to get the FAB instance 12 | - Add ability to change the text color of the header text 13 | 14 | ### Version 1.4.4: 15 | - Update dependencies and build tools for SDK 25 16 | 17 | ### Version 1.4.3: 18 | - Update to `PeekView` 1.2.2 to improve blurring support and remove `RenderScript` dependency in the example app 19 | 20 | ### Version 1.4.2: 21 | - We need the libraries min SDK to be 15 since that is what the blur on `PeekView` uses. 22 | 23 | ### Version 1.4.1: 24 | - Update to `PeekView` 1.2.0 for background blur support. 25 | 26 | ### Version 1.4.0: 27 | - Allow `SlidingActivity` to work with `PeekView` (https://github.com/klinker24/Android-3DTouch-PeekView) 28 | 29 | ### Version 1.3.2: 30 | - Fix a crash on sw600dp tablets 31 | 32 | ### Version 1.3.1: 33 | - Make sure 720dp tablets have the new layout too 34 | 35 | ### Version 1.3.0: 36 | - Tablets have had a cool non-full-screen layout in portrait mode. Apply that layout to tablets landscape mode, as well as phone's landscape mode, if space allows. 37 | 38 | ### Version 1.2.3: 39 | - Don't allow text to overlap FAB when title is long 40 | - Add Day/Night theme 41 | 42 | ### Version 1.2.2: 43 | - Improve logic behind header color tint 44 | 45 | ### Version 1.2.1: 46 | - Fixed custom headers wrapping content instead of matching parent 47 | 48 | ### Version 1.2.0: 49 | - Added the ability to set custom header views 50 | 51 | ### Version 1.1.1: 52 | - Fade in the header text after it is set 53 | - Remove the padding from the content view because it caused a weird coloring effect 54 | 55 | ### Version 1.1.0: 56 | - Add an 'Inbox' style expansion animation to the window 57 | 58 | ### Version 1.0.1: 59 | - Fix issue with the expansion when there is no header 60 | - Allow for keyboard showing on `SlidingActivity` 61 | 62 | ### Version 1.0.0: 63 | - Initial release and feature set 64 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2016 Jacob Klinker 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Jacob Klinker 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | buildscript { 18 | repositories { 19 | google() 20 | jcenter() 21 | } 22 | dependencies { 23 | classpath "com.android.tools.build:gradle:${project.ANDROID_GRADLE_VERSION}" 24 | } 25 | } 26 | 27 | allprojects { 28 | repositories { 29 | google() 30 | jcenter() 31 | mavenCentral() 32 | maven { url "https://maven.google.com" } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 Jacob Klinker 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | VERSION_NAME=1.5.2 18 | VERSION_CODE=120 19 | GROUP=com.klinkerapps 20 | 21 | POM_DESCRIPTION=Library for allowing activities to be slide up and down on the screen 22 | POM_URL=https://github.com/klinker41/android-slidingactivity 23 | POM_SCM_URL=https://github.com/klinker41/android-slidingactivity 24 | POM_SCM_CONNECTION=scm:git@github.com:klinker41/android-slidingactivity.git 25 | POM_SCM_DEV_CONNECTION=scm:git@github.com:klinker41/android-slidingactivity.git 26 | POM_LICENCE_NAME=The Apache Software License, Version 2.0 27 | POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt 28 | POM_LICENCE_DIST=repo 29 | POM_DEVELOPER_ID=klinker41 30 | POM_DEVELOPER_NAME=Jacob Klinker 31 | POM_NAME=Android Sliding Activity Library 32 | POM_ARTIFACT_ID=sliding-activity 33 | POM_PACKAGING=aar 34 | 35 | ANDROID_GRADLE_VERSION=3.0.1 36 | BUILD_TOOLS_VERSION=27.0.1 37 | COMPILE_SDK_VERSION=27 38 | TARGET_SDK_VERSION=27 39 | MIN_SDK_VERSION=15 40 | ANDROID_SUPPORT_VERSION=27.0.2 41 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Oct 26 19:31:05 CDT 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-4.1-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /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/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /library/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Jacob Klinker 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'com.android.library' 18 | 19 | android { 20 | compileSdkVersion Integer.parseInt(project.COMPILE_SDK_VERSION) 21 | buildToolsVersion project.BUILD_TOOLS_VERSION 22 | 23 | defaultConfig { 24 | minSdkVersion Integer.parseInt(project.MIN_SDK_VERSION) 25 | targetSdkVersion Integer.parseInt(project.TARGET_SDK_VERSION) 26 | versionCode Integer.parseInt(project.VERSION_CODE) 27 | versionName project.VERSION_NAME 28 | } 29 | 30 | buildTypes { 31 | release { 32 | minifyEnabled false 33 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 34 | } 35 | } 36 | 37 | lintOptions { 38 | abortOnError false 39 | } 40 | } 41 | 42 | dependencies { 43 | compile "com.android.support:appcompat-v7:${project.ANDROID_SUPPORT_VERSION}" 44 | compile "com.android.support:palette-v7:${project.ANDROID_SUPPORT_VERSION}" 45 | compile "com.android.support:design:${project.ANDROID_SUPPORT_VERSION}" 46 | 47 | compile 'com.klinkerapps:peekview:1.2.3' 48 | } 49 | 50 | apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle' 51 | -------------------------------------------------------------------------------- /library/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 /usr/local/Cellar/android-sdk/24.0.2/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 | -------------------------------------------------------------------------------- /library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /library/src/main/java/com/klinker/android/sliding/ColorUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Jacob Klinker 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.klinker.android.sliding; 18 | 19 | import android.graphics.Color; 20 | 21 | /** 22 | * Helper class for operations on color integers. 23 | */ 24 | public class ColorUtils { 25 | 26 | /** 27 | * Adjust the alpha of a color. 28 | * @param color the color [0x00000000, 0xffffffff] 29 | * @param factor the factor for the alpha [0,1] 30 | * @return the adjusted color 31 | */ 32 | public static int adjustAlpha(int color, float factor) { 33 | int alpha = Math.round(Color.alpha(color) * factor); 34 | int red = Color.red(color); 35 | int green = Color.green(color); 36 | int blue = Color.blue(color); 37 | return Color.argb(alpha, red, green, blue); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /library/src/main/java/com/klinker/android/sliding/SchedulingUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Jacob Klinker 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.klinker.android.sliding; 18 | 19 | import android.view.View; 20 | import android.view.ViewTreeObserver.OnPreDrawListener; 21 | 22 | /** 23 | * Helper for scheduling events that will be occuring. 24 | */ 25 | public class SchedulingUtils { 26 | 27 | /** 28 | * Do an action before the drawing occurs. 29 | * @param view the view to be drawn. 30 | * @param drawNextFrame whether we should draw the next frame or not. 31 | * @param runnable the runnable to run. 32 | */ 33 | public static void doOnPreDraw(final View view, final boolean drawNextFrame, 34 | final Runnable runnable) { 35 | final OnPreDrawListener listener = new OnPreDrawListener() { 36 | @Override 37 | public boolean onPreDraw() { 38 | view.getViewTreeObserver().removeOnPreDrawListener(this); 39 | runnable.run(); 40 | return drawNextFrame; 41 | } 42 | }; 43 | view.getViewTreeObserver().addOnPreDrawListener(listener); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /library/src/main/java/com/klinker/android/sliding/TouchlessScrollView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Jacob Klinker 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.klinker.android.sliding; 18 | 19 | import android.content.Context; 20 | import android.os.Parcelable; 21 | import android.util.AttributeSet; 22 | import android.view.MotionEvent; 23 | import android.widget.ScrollView; 24 | 25 | /** 26 | * A {@link ScrollView} that doesn't respond or intercept touch events. 27 | * 28 | * This is used in combination with {@link com.klinker.android.sliding.MultiShrinkScroller} so 29 | * that MultiShrinkScroller can handle all scrolling and saving. 30 | */ 31 | public class TouchlessScrollView extends ScrollView { 32 | 33 | /** 34 | * Creates a new instance of TouchlessScrollview. 35 | * @param context 36 | */ 37 | public TouchlessScrollView(Context context) { 38 | this(context, null); 39 | } 40 | 41 | /** 42 | * Creates a new instance of TouchlessScrollview. 43 | * @param context 44 | * @param attrs 45 | */ 46 | public TouchlessScrollView(Context context, AttributeSet attrs) { 47 | this(context, attrs, 0); 48 | } 49 | 50 | /** 51 | * Creates a new instance of TouchlessScrollview. 52 | * @param context 53 | * @param attrs 54 | * @param defStyleAttr 55 | */ 56 | public TouchlessScrollView(Context context, AttributeSet attrs, int defStyleAttr) { 57 | super(context, attrs, defStyleAttr); 58 | } 59 | 60 | /** 61 | * Save the current y scroll position for later. 62 | * @return 63 | */ 64 | @Override 65 | protected Parcelable onSaveInstanceState() { 66 | // Do not save the current scroll position. Always store scrollY=0 and delegate 67 | // responsibility of saving state to the MultiShrinkScroller. 68 | final int scrollY = getScrollY(); 69 | setScrollY(0); 70 | final Parcelable returnValue = super.onSaveInstanceState(); 71 | setScrollY(scrollY); 72 | return returnValue; 73 | } 74 | 75 | /** 76 | * {@inheritDoc} 77 | */ 78 | @Override 79 | public boolean onInterceptTouchEvent(MotionEvent ev) { 80 | return false; 81 | } 82 | 83 | /** 84 | * {@inheritDoc} 85 | */ 86 | @Override 87 | public boolean onTouchEvent(MotionEvent event) { 88 | return false; 89 | } 90 | } -------------------------------------------------------------------------------- /library/src/main/java/com/klinker/android/sliding/ViewUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Jacob Klinker 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.klinker.android.sliding; 18 | 19 | import android.content.res.Resources; 20 | import android.graphics.Outline; 21 | import android.os.Build; 22 | import android.view.View; 23 | import android.view.ViewOutlineProvider; 24 | 25 | /** 26 | * Provides static functions to work with views. 27 | */ 28 | public class ViewUtil { 29 | 30 | // don't allow for instantiation 31 | private ViewUtil() { 32 | 33 | } 34 | 35 | /** 36 | * Adds a rectangular outline to a view. This can be useful when you want to add a shadow 37 | * to a transparent view. See b/16856049. 38 | * @param view view that the outline is added to 39 | * @param res The resources file. 40 | */ 41 | public static void addRectangularOutlineProvider(View view, Resources res) { 42 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 43 | ViewOutlineProvider rectOutlineProvider = new ViewOutlineProvider() { 44 | @Override 45 | public void getOutline(View view, Outline outline) { 46 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 47 | outline.setRect(0, 0, view.getWidth(), view.getHeight()); 48 | } 49 | } 50 | }; 51 | 52 | view.setOutlineProvider(rectOutlineProvider); 53 | } 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /library/src/main/res/layout-land/sliding_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 28 | 29 | 33 | 34 | 40 | 41 | 46 | 47 | 52 | 53 | 57 | 58 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 73 | 74 | 75 | 76 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /library/src/main/res/layout-sw600dp-land/sliding_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 28 | 29 | 33 | 34 | 40 | 41 | 46 | 47 | 52 | 53 | 57 | 58 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 73 | 74 | 75 | 76 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /library/src/main/res/layout-sw600dp/sliding_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 27 | 28 | 32 | 33 | 39 | 40 | 45 | 46 | 51 | 52 | 55 | 56 | 60 | 61 | 62 | 63 | 67 | 68 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /library/src/main/res/layout-sw720dp-land/sliding_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 28 | 29 | 33 | 34 | 40 | 41 | 46 | 47 | 52 | 53 | 57 | 58 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 73 | 74 | 75 | 76 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /library/src/main/res/layout/sliding_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 27 | 28 | 32 | 33 | 34 | 35 | 38 | 43 | 48 | 49 | 50 | 51 | 55 | 56 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /library/src/main/res/layout/sliding_content.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 25 | 26 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /library/src/main/res/layout/sliding_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 20 | 21 | 26 | 27 | 33 | 37 | 38 | 39 | 40 | 44 | 45 | 50 | 55 | 56 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /library/src/main/res/layout/sliding_title.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | -------------------------------------------------------------------------------- /library/src/main/res/layout/sliding_title_placeholder.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /library/src/main/res/values-land/bools.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | true 21 | true 22 | true 23 | 24 | -------------------------------------------------------------------------------- /library/src/main/res/values-land/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 20sp 21 | 22 | -------------------------------------------------------------------------------- /library/src/main/res/values-land/integers.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 5 21 | 22 | 1 23 | 6 24 | 25 | -------------------------------------------------------------------------------- /library/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 32 | 33 | -------------------------------------------------------------------------------- /library/src/main/res/values-sw600dp-land/bools.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | true 21 | false 22 | 23 | -------------------------------------------------------------------------------- /library/src/main/res/values-sw600dp-land/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 180dp 21 | 300dp 22 | 23 | -------------------------------------------------------------------------------- /library/src/main/res/values-sw600dp/bools.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | true 21 | false 22 | 23 | -------------------------------------------------------------------------------- /library/src/main/res/values-sw600dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 360dip 21 | 400dp 22 | 23 | -------------------------------------------------------------------------------- /library/src/main/res/values-sw600dp/integers.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 1 21 | 6 22 | 23 | -------------------------------------------------------------------------------- /library/src/main/res/values-sw720dp-land/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 36sp 21 | 22 | -------------------------------------------------------------------------------- /library/src/main/res/values-sw720dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 360dip 21 | 400dp 22 | 32dp 23 | 40sp 24 | 25 | -------------------------------------------------------------------------------- /library/src/main/res/values-sw720dp/integers.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 11 21 | 81 22 | 23 | -------------------------------------------------------------------------------- /library/src/main/res/values-v21/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | -28dp 21 | 16dp 22 | 16dp 23 | 24 | -------------------------------------------------------------------------------- /library/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /library/src/main/res/values/bools.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | false 21 | false 22 | true 23 | 24 | -------------------------------------------------------------------------------- /library/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | #FAFAFA 21 | #303030 22 | #88ffffff 23 | 24 | -------------------------------------------------------------------------------- /library/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 150dp 21 | 26sp 22 | 16dp 23 | 0.7 24 | 40dp 25 | 100dp 26 | 33dp 27 | 180dp 28 | 4.5dp 29 | 300dp 30 | 12dp 31 | -56dp 32 | 0dp 33 | 0dp 34 | 48dp 35 | 36 | -------------------------------------------------------------------------------- /library/src/main/res/values/integers.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 1 21 | 22 | -------------------------------------------------------------------------------- /library/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | Click to return to previous screen 21 | 22 | -------------------------------------------------------------------------------- /library/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 32 | 33 | 45 | 46 | 58 | 59 | -------------------------------------------------------------------------------- /preview.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/preview.gif -------------------------------------------------------------------------------- /preview_inbox_animation.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/preview_inbox_animation.gif -------------------------------------------------------------------------------- /preview_landscape.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/preview_landscape.gif -------------------------------------------------------------------------------- /preview_peekview.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/preview_peekview.gif -------------------------------------------------------------------------------- /sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /sample/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Jacob Klinker 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'com.android.application' 18 | 19 | android { 20 | compileSdkVersion Integer.parseInt(project.COMPILE_SDK_VERSION) 21 | buildToolsVersion project.BUILD_TOOLS_VERSION 22 | 23 | defaultConfig { 24 | applicationId "com.klinker.android.sliding.sample" 25 | minSdkVersion Integer.parseInt(project.MIN_SDK_VERSION) 26 | targetSdkVersion Integer.parseInt(project.TARGET_SDK_VERSION) 27 | versionCode Integer.parseInt(project.VERSION_CODE) 28 | versionName project.VERSION_NAME 29 | } 30 | 31 | buildTypes { 32 | release { 33 | minifyEnabled false 34 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 35 | } 36 | } 37 | 38 | lintOptions { 39 | abortOnError false 40 | } 41 | } 42 | 43 | dependencies { 44 | compile project(':library') 45 | 46 | compile "com.android.support:cardview-v7:${project.ANDROID_SUPPORT_VERSION}" 47 | compile 'de.hdodenhof:circleimageview:2.0.0' 48 | compile 'com.klinkerapps:peekview:1.2.3' 49 | } 50 | -------------------------------------------------------------------------------- /sample/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 /usr/local/Cellar/android-sdk/24.0.2/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 | -------------------------------------------------------------------------------- /sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 38 | 43 | 44 | 49 | 50 | 56 | 57 | 62 | 63 | 68 | 69 | 74 | 75 | 80 | 81 | 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /sample/src/main/java/com/klinker/android/sliding/sample/CustomHeaderActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Jacob Klinker 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.klinker.android.sliding.sample; 18 | 19 | import android.content.Intent; 20 | import android.os.Bundle; 21 | import android.view.View; 22 | import android.widget.Toast; 23 | 24 | import com.klinker.android.sliding.MultiShrinkScroller; 25 | import com.klinker.android.sliding.SlidingActivity; 26 | 27 | /** 28 | * Activity demonstrating a very simple implementation of a sliding activity. 29 | */ 30 | public class CustomHeaderActivity extends SlidingActivity { 31 | 32 | /** 33 | * Initialize our values, this is overridden instead of onCreate as it should be in all 34 | * sliding activities. 35 | * @param savedInstanceState the saved state. 36 | */ 37 | @Override 38 | public void init(Bundle savedInstanceState) { 39 | setTitle(R.string.custom_sliding_activity); 40 | setPrimaryColors( 41 | getResources().getColor(R.color.dark_activity_primary), 42 | getResources().getColor(R.color.dark_activity_primary_dark) 43 | ); 44 | setContent(R.layout.activity_content); 45 | setHeaderContent(R.layout.activity_custom_header); 46 | setFab( 47 | getResources().getColor(R.color.fab_activity_accent), 48 | R.drawable.ic_debug, 49 | new View.OnClickListener() { 50 | @Override 51 | public void onClick(View v) { 52 | Toast.makeText(CustomHeaderActivity.this, "FAB Clicked", Toast.LENGTH_SHORT).show(); 53 | } 54 | } 55 | ); 56 | Intent intent = getIntent(); 57 | if (intent.getBooleanExtra(SampleActivity.ARG_USE_EXPANSION, false)) { 58 | expandFromPoints( 59 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_LEFT_OFFSET, 0), 60 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_TOP_OFFSET, 0), 61 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_VIEW_WIDTH, 0), 62 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_VIEW_HEIGHT, 0) 63 | ); 64 | } 65 | } 66 | 67 | @Override 68 | protected void configureScroller(MultiShrinkScroller scroller) { 69 | super.configureScroller(scroller); 70 | scroller.setIntermediateHeaderHeightRatio(1); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /sample/src/main/java/com/klinker/android/sliding/sample/DarkActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Jacob Klinker 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.klinker.android.sliding.sample; 18 | 19 | import android.content.Intent; 20 | import android.os.Bundle; 21 | 22 | import com.klinker.android.sliding.SlidingActivity; 23 | 24 | /** 25 | * Activity demonstrating a very simple implementation of a sliding activity with a dark background. 26 | */ 27 | public class DarkActivity extends SlidingActivity { 28 | 29 | /** 30 | * Initialize our values, this is overridden instead of onCreate as it should be in all 31 | * sliding activities. 32 | * @param savedInstanceState the saved state. 33 | */ 34 | @Override 35 | public void init(Bundle savedInstanceState) { 36 | setTitle(R.string.dark_activity); 37 | setPrimaryColors( 38 | getResources().getColor(R.color.dark_activity_primary), 39 | getResources().getColor(R.color.dark_activity_primary_dark) 40 | ); 41 | setContent(R.layout.activity_content); 42 | 43 | Intent intent = getIntent(); 44 | if (intent.getBooleanExtra(SampleActivity.ARG_USE_EXPANSION, false)) { 45 | expandFromPoints( 46 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_LEFT_OFFSET, 0), 47 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_TOP_OFFSET, 0), 48 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_VIEW_WIDTH, 0), 49 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_VIEW_HEIGHT, 0) 50 | ); 51 | } 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /sample/src/main/java/com/klinker/android/sliding/sample/FabActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Jacob Klinker 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.klinker.android.sliding.sample; 18 | 19 | import android.content.Intent; 20 | import android.os.Bundle; 21 | import android.view.View; 22 | import android.widget.Toast; 23 | 24 | import com.klinker.android.sliding.SlidingActivity; 25 | 26 | /** 27 | * Activity demonstrating a very simple implementation of a sliding activity with an FAB. 28 | */ 29 | public class FabActivity extends SlidingActivity { 30 | 31 | /** 32 | * Initialize our values, this is overridden instead of onCreate as it should be in all 33 | * sliding activities. 34 | * @param savedInstanceState the saved state. 35 | */ 36 | @Override 37 | public void init(Bundle savedInstanceState) { 38 | setTitle(R.string.fab_activity); 39 | setPrimaryColors( 40 | getResources().getColor(R.color.fab_activity_primary), 41 | getResources().getColor(R.color.fab_activity_primary_dark) 42 | ); 43 | setContent(R.layout.activity_content); 44 | setFab( 45 | getResources().getColor(R.color.fab_activity_accent), 46 | R.drawable.ic_debug, 47 | new View.OnClickListener() { 48 | @Override 49 | public void onClick(View v) { 50 | Toast.makeText(FabActivity.this, "FAB Clicked", Toast.LENGTH_SHORT).show(); 51 | } 52 | } 53 | ); 54 | 55 | Intent intent = getIntent(); 56 | if (intent.getBooleanExtra(SampleActivity.ARG_USE_EXPANSION, false)) { 57 | expandFromPoints( 58 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_LEFT_OFFSET, 0), 59 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_TOP_OFFSET, 0), 60 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_VIEW_WIDTH, 0), 61 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_VIEW_HEIGHT, 0) 62 | ); 63 | } 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /sample/src/main/java/com/klinker/android/sliding/sample/FullscreenActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Jacob Klinker 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.klinker.android.sliding.sample; 18 | 19 | import android.content.Intent; 20 | import android.os.Bundle; 21 | 22 | /** 23 | * Activity similar to the normal activity, except it will start fullscreen instead of requiring to 24 | * be scrolled up. 25 | */ 26 | public class FullscreenActivity extends NormalActivity { 27 | 28 | /** 29 | * Make sure we call super to set everything else up, then show as fullscreen. 30 | * @param savedInstanceState the saved state. 31 | */ 32 | @Override 33 | public void init(Bundle savedInstanceState) { 34 | super.init(savedInstanceState); 35 | enableFullscreen(); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /sample/src/main/java/com/klinker/android/sliding/sample/ImageActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Jacob Klinker 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.klinker.android.sliding.sample; 18 | 19 | import android.content.Intent; 20 | import android.os.Bundle; 21 | import android.os.Handler; 22 | 23 | import com.klinker.android.sliding.SlidingActivity; 24 | 25 | /** 26 | * Activity demonstrating showing an image at the top of the the sliding activity. 27 | */ 28 | public class ImageActivity extends SlidingActivity { 29 | 30 | /** 31 | * Initialize our values, this is overridden instead of onCreate as it should be in all 32 | * sliding activities. 33 | * @param savedInstanceState the saved state. 34 | */ 35 | @Override 36 | public void init(Bundle savedInstanceState) { 37 | setTitle(R.string.image_activity); 38 | setContent(R.layout.activity_content); 39 | 40 | // no need to set a color here, palette will generate colors for us to be set 41 | setImage(R.drawable.profile_picture); 42 | 43 | // if we wanted to set some manually instead, do this after setting the image 44 | // setPrimaryColors( 45 | // getResources().getColor(R.color.image_activity_primary), 46 | // getResources().getColor(R.color.image_activity_primary_dark) 47 | // ); 48 | 49 | // if we want the image to animate in, then set it after the activity has been created 50 | // NOTE: this will not change the activity's colors using palette, so make sure you call 51 | // setPrimaryColors() first 52 | // new Handler().postDelayed(new Runnable() { 53 | // @Override 54 | // public void run() { 55 | // setImage(R.drawable.profile_picture); 56 | // } 57 | // }, 500); 58 | 59 | Intent intent = getIntent(); 60 | if (intent.getBooleanExtra(SampleActivity.ARG_USE_EXPANSION, false)) { 61 | expandFromPoints( 62 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_LEFT_OFFSET, 0), 63 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_TOP_OFFSET, 0), 64 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_VIEW_WIDTH, 0), 65 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_VIEW_HEIGHT, 0) 66 | ); 67 | } 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /sample/src/main/java/com/klinker/android/sliding/sample/MenuItemActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Jacob Klinker 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.klinker.android.sliding.sample; 18 | 19 | import android.content.Intent; 20 | import android.os.Bundle; 21 | import android.view.Menu; 22 | import android.view.MenuItem; 23 | import android.view.View; 24 | import android.widget.Toast; 25 | 26 | import com.klinker.android.sliding.SlidingActivity; 27 | 28 | /** 29 | * Activity demonstrating showing menu items on the sliding content, this is achieved in the same 30 | * manor as you would handle it for any type of activity. 31 | */ 32 | public class MenuItemActivity extends SlidingActivity { 33 | 34 | /** 35 | * Initialize our values, this is overridden instead of onCreate as it should be in all 36 | * sliding activities. 37 | * @param savedInstanceState the saved state. 38 | */ 39 | @Override 40 | public void init(Bundle savedInstanceState) { 41 | setTitle(R.string.submit_feedback); 42 | setPrimaryColors( 43 | getResources().getColor(R.color.menu_item_activity_primary), 44 | getResources().getColor(R.color.menu_item_activity_primary_dark) 45 | ); 46 | 47 | setContent(R.layout.activity_feedback); 48 | 49 | findViewById(R.id.submit).setOnClickListener(new View.OnClickListener() { 50 | @Override 51 | public void onClick(View v) { 52 | finish(); 53 | } 54 | }); 55 | 56 | Intent intent = getIntent(); 57 | if (intent.getBooleanExtra(SampleActivity.ARG_USE_EXPANSION, false)) { 58 | expandFromPoints( 59 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_LEFT_OFFSET, 0), 60 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_TOP_OFFSET, 0), 61 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_VIEW_WIDTH, 0), 62 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_VIEW_HEIGHT, 0) 63 | ); 64 | } 65 | } 66 | 67 | /** 68 | * Creates the options menu. 69 | * @param menu the menu. 70 | * @return true. 71 | */ 72 | @Override 73 | public boolean onCreateOptionsMenu(Menu menu) { 74 | getMenuInflater().inflate(R.menu.activity_menu_item, menu); 75 | return true; 76 | } 77 | 78 | /** 79 | * Handles the options item selected event. 80 | * @param item the item selected. 81 | * @return true. 82 | */ 83 | @Override 84 | public boolean onOptionsItemSelected(MenuItem item) { 85 | switch (item.getItemId()) { 86 | case R.id.menu_bug: 87 | Toast.makeText(this, R.string.bug, Toast.LENGTH_SHORT).show(); 88 | break; 89 | } 90 | 91 | return true; 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /sample/src/main/java/com/klinker/android/sliding/sample/NoHeaderActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Jacob Klinker 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.klinker.android.sliding.sample; 18 | 19 | import android.content.Intent; 20 | import android.os.Bundle; 21 | 22 | import com.klinker.android.sliding.SlidingActivity; 23 | 24 | /** 25 | * Activity demonstrating a very simple implementation of a sliding activity with no header. 26 | */ 27 | public class NoHeaderActivity extends SlidingActivity { 28 | 29 | /** 30 | * Initialize our values, this is overridden instead of onCreate as it should be in all 31 | * sliding activities. 32 | * @param savedInstanceState the saved state. 33 | */ 34 | @Override 35 | public void init(Bundle savedInstanceState) { 36 | disableHeader(); 37 | enableFullscreen(); 38 | setPrimaryColors( 39 | getResources().getColor(R.color.normal_sliding_activity_primary), 40 | getResources().getColor(R.color.normal_sliding_activity_primary_dark) 41 | ); 42 | setContent(R.layout.activity_content); 43 | 44 | Intent intent = getIntent(); 45 | if (intent.getBooleanExtra(SampleActivity.ARG_USE_EXPANSION, false)) { 46 | expandFromPoints( 47 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_LEFT_OFFSET, 0), 48 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_TOP_OFFSET, 0), 49 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_VIEW_WIDTH, 0), 50 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_VIEW_HEIGHT, 0) 51 | ); 52 | } 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /sample/src/main/java/com/klinker/android/sliding/sample/NormalActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Jacob Klinker 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.klinker.android.sliding.sample; 18 | 19 | import android.content.Intent; 20 | import android.os.Bundle; 21 | 22 | import com.klinker.android.sliding.SlidingActivity; 23 | 24 | /** 25 | * Activity demonstrating a very simple implementation of a sliding activity. 26 | */ 27 | public class NormalActivity extends SlidingActivity { 28 | 29 | /** 30 | * Initialize our values, this is overridden instead of onCreate as it should be in all 31 | * sliding activities. 32 | * @param savedInstanceState the saved state. 33 | */ 34 | @Override 35 | public void init(Bundle savedInstanceState) { 36 | setTitle(R.string.normal_sliding_activity); 37 | setPrimaryColors( 38 | getResources().getColor(R.color.normal_sliding_activity_primary), 39 | getResources().getColor(R.color.normal_sliding_activity_primary_dark) 40 | ); 41 | setContent(R.layout.activity_content); 42 | 43 | Intent intent = getIntent(); 44 | if (intent.getBooleanExtra(SampleActivity.ARG_USE_EXPANSION, false)) { 45 | expandFromPoints( 46 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_LEFT_OFFSET, 0), 47 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_TOP_OFFSET, 0), 48 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_VIEW_WIDTH, 0), 49 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_VIEW_HEIGHT, 0) 50 | ); 51 | } 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /sample/src/main/java/com/klinker/android/sliding/sample/SampleActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Jacob Klinker 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.klinker.android.sliding.sample; 18 | 19 | import android.content.Intent; 20 | import android.support.v7.app.AppCompatActivity; 21 | import android.os.Bundle; 22 | import android.view.View; 23 | import android.widget.CheckBox; 24 | 25 | public class SampleActivity extends AppCompatActivity { 26 | 27 | public static final String ARG_USE_EXPANSION = "arg_use_expansion"; 28 | public static final String ARG_EXPANSION_LEFT_OFFSET = "arg_left_offset"; 29 | public static final String ARG_EXPANSION_TOP_OFFSET = "arg_top_offset"; 30 | public static final String ARG_EXPANSION_VIEW_WIDTH = "arg_view_width"; 31 | public static final String ARG_EXPANSION_VIEW_HEIGHT = "arg_view_height"; 32 | 33 | @Override 34 | protected void onCreate(Bundle savedInstanceState) { 35 | super.onCreate(savedInstanceState); 36 | setContentView(R.layout.activity_sample); 37 | 38 | findViewById(R.id.show_normal).setOnClickListener(new View.OnClickListener() { 39 | @Override 40 | public void onClick(View v) { 41 | showNormalExample(); 42 | } 43 | }); 44 | 45 | findViewById(R.id.show_fullscreen).setOnClickListener(new View.OnClickListener() { 46 | @Override 47 | public void onClick(View v) { 48 | showFullscreenExample(); 49 | } 50 | }); 51 | 52 | findViewById(R.id.show_menu_item).setOnClickListener(new View.OnClickListener() { 53 | @Override 54 | public void onClick(View v) { 55 | showMenuItemExample(); 56 | } 57 | }); 58 | 59 | findViewById(R.id.show_image).setOnClickListener(new View.OnClickListener() { 60 | @Override 61 | public void onClick(View v) { 62 | showImageExample(); 63 | } 64 | }); 65 | 66 | findViewById(R.id.show_dark).setOnClickListener(new View.OnClickListener() { 67 | @Override 68 | public void onClick(View v) { 69 | showDarkExample(); 70 | } 71 | }); 72 | 73 | findViewById(R.id.show_fab).setOnClickListener(new View.OnClickListener() { 74 | @Override 75 | public void onClick(View v) { 76 | showFabExample(); 77 | } 78 | }); 79 | 80 | findViewById(R.id.show_no_header).setOnClickListener(new View.OnClickListener() { 81 | @Override 82 | public void onClick(View v) { 83 | showNoHeaderExample(); 84 | } 85 | }); 86 | 87 | findViewById(R.id.show_custom_header).setOnClickListener(new View.OnClickListener() { 88 | @Override 89 | public void onClick(View v) { 90 | showCustomHeaderExample(); 91 | } 92 | }); 93 | 94 | findViewById(R.id.show_talon).setOnClickListener(new View.OnClickListener() { 95 | @Override 96 | public void onClick(View v) { 97 | showTalonExample(); 98 | } 99 | }); 100 | } 101 | 102 | private void showNormalExample() { 103 | startActivity(addExpansionArgs(new Intent(this, NormalActivity.class))); 104 | } 105 | 106 | private void showFullscreenExample() { 107 | startActivity(addExpansionArgs(new Intent(this, FullscreenActivity.class))); 108 | } 109 | 110 | private void showMenuItemExample() { 111 | startActivity(addExpansionArgs(new Intent(this, MenuItemActivity.class))); 112 | } 113 | 114 | private void showImageExample() { 115 | startActivity(addExpansionArgs(new Intent(this, ImageActivity.class))); 116 | } 117 | 118 | private void showDarkExample() { 119 | startActivity(addExpansionArgs(new Intent(this, DarkActivity.class))); 120 | } 121 | 122 | private void showFabExample() { 123 | startActivity(addExpansionArgs(new Intent(this, FabActivity.class))); 124 | } 125 | 126 | private void showNoHeaderExample() { 127 | startActivity(addExpansionArgs(new Intent(this, NoHeaderActivity.class))); 128 | } 129 | 130 | private void showCustomHeaderExample() { 131 | startActivity(addExpansionArgs(new Intent(this, CustomHeaderActivity.class))); 132 | } 133 | 134 | private void showTalonExample() { 135 | startActivity(addExpansionArgs(new Intent(this, TalonActivity.class))); 136 | } 137 | 138 | public Intent addExpansionArgs(Intent intent) { 139 | if (((CheckBox)findViewById(R.id.use_expansion_check)).isChecked()) { 140 | intent.putExtra(ARG_USE_EXPANSION, true); 141 | 142 | View expansionView = findViewById(R.id.expansion_view); 143 | 144 | int location[] = new int[2]; 145 | expansionView.getLocationInWindow(location); 146 | 147 | intent.putExtra(ARG_EXPANSION_LEFT_OFFSET, location[0]); 148 | intent.putExtra(ARG_EXPANSION_TOP_OFFSET, location[1]); 149 | intent.putExtra(ARG_EXPANSION_VIEW_WIDTH, expansionView.getWidth()); 150 | intent.putExtra(ARG_EXPANSION_VIEW_HEIGHT, expansionView.getHeight()); 151 | } 152 | 153 | return intent; 154 | } 155 | 156 | } 157 | -------------------------------------------------------------------------------- /sample/src/main/java/com/klinker/android/sliding/sample/TalonActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Jacob Klinker 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.klinker.android.sliding.sample; 18 | 19 | import android.app.ActivityManager; 20 | import android.content.Intent; 21 | import android.os.Build; 22 | import android.os.Bundle; 23 | import android.os.Debug; 24 | import android.os.Handler; 25 | import android.view.Menu; 26 | import android.view.View; 27 | 28 | import com.klinker.android.peekview.builder.Peek; 29 | import com.klinker.android.peekview.builder.PeekViewOptions; 30 | import com.klinker.android.peekview.callback.SimpleOnPeek; 31 | import com.klinker.android.sliding.SlidingActivity; 32 | 33 | /** 34 | * Activity mocking out the profile page on Talon for Twitter and demonstrating the power of 35 | * sliding activities. 36 | */ 37 | public class TalonActivity extends SlidingActivity { 38 | 39 | /** 40 | * Initialize our values, this is overridden instead of onCreate as it should be in all 41 | * sliding activities. 42 | * @param savedInstanceState the saved state. 43 | */ 44 | @Override 45 | public void init(Bundle savedInstanceState) { 46 | setTitle(R.string.talon_activity); 47 | 48 | setPrimaryColors( 49 | getResources().getColor(R.color.talon_activity_primary), 50 | getResources().getColor(R.color.talon_activity_primary_dark) 51 | ); 52 | 53 | if (checkMemory()) { 54 | setContent(R.layout.activity_talon); 55 | 56 | // long clicking on the "stats" card will display the PeekView 57 | Peek.into(R.layout.peek_example, new SimpleOnPeek() { 58 | @Override 59 | public void onInflated(View rootView) { 60 | // we won't do anything here 61 | } 62 | }).applyTo(this, findViewById(R.id.talon_stats_card)); 63 | } 64 | 65 | // delay this so that the animation shows and we don't change the activity colors 66 | new Handler().postDelayed(new Runnable() { 67 | @Override 68 | public void run() { 69 | setImage(R.drawable.twitter_profile); 70 | } 71 | }, 500); 72 | 73 | setFab( 74 | getResources().getColor(R.color.talon_activity_accent), 75 | R.drawable.ic_add, 76 | null 77 | ); 78 | 79 | Intent intent = getIntent(); 80 | if (intent.getBooleanExtra(SampleActivity.ARG_USE_EXPANSION, false)) { 81 | expandFromPoints( 82 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_LEFT_OFFSET, 0), 83 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_TOP_OFFSET, 0), 84 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_VIEW_WIDTH, 0), 85 | intent.getIntExtra(SampleActivity.ARG_EXPANSION_VIEW_HEIGHT, 0) 86 | ); 87 | } 88 | } 89 | 90 | /** 91 | * Creates the options menu. 92 | * @param menu the menu. 93 | * @return true. 94 | */ 95 | @Override 96 | public boolean onCreateOptionsMenu(Menu menu) { 97 | getMenuInflater().inflate(R.menu.activity_talon, menu); 98 | return true; 99 | } 100 | 101 | /** 102 | * Oops, this is a really big layout with lots of images and no optimizations done to it, older 103 | * or lower end devices might run out of memory! Sorry to those devs with these devices. 104 | * @return true if device has 1GB of memory and can show the content. 105 | */ 106 | private boolean checkMemory() { 107 | ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); 108 | ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE); 109 | activityManager.getMemoryInfo(mi); 110 | 111 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { 112 | long availableMegs = mi.totalMem / 1048576L; 113 | return availableMegs >= 1000; 114 | } else { 115 | long availableMegs = mi.availMem / 1048576L; 116 | return availableMegs >= 1000; 117 | } 118 | } 119 | 120 | } 121 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable-nodpi/favorite_1_image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-nodpi/favorite_1_image.jpg -------------------------------------------------------------------------------- /sample/src/main/res/drawable-nodpi/favorite_2_profile.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-nodpi/favorite_2_profile.jpeg -------------------------------------------------------------------------------- /sample/src/main/res/drawable-nodpi/follower_1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-nodpi/follower_1.jpeg -------------------------------------------------------------------------------- /sample/src/main/res/drawable-nodpi/follower_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-nodpi/follower_2.jpg -------------------------------------------------------------------------------- /sample/src/main/res/drawable-nodpi/follower_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-nodpi/follower_3.jpg -------------------------------------------------------------------------------- /sample/src/main/res/drawable-nodpi/following_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-nodpi/following_1.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-nodpi/following_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-nodpi/following_2.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-nodpi/following_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-nodpi/following_3.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-nodpi/mention_1_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-nodpi/mention_1_image.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-nodpi/mention_1_profile.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-nodpi/mention_1_profile.jpg -------------------------------------------------------------------------------- /sample/src/main/res/drawable-nodpi/mention_1_profile_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-nodpi/mention_1_profile_2.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-nodpi/mention_2_profile.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-nodpi/mention_2_profile.jpg -------------------------------------------------------------------------------- /sample/src/main/res/drawable-nodpi/mention_3_profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-nodpi/mention_3_profile.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-nodpi/profile_picture.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-nodpi/profile_picture.JPG -------------------------------------------------------------------------------- /sample/src/main/res/drawable-nodpi/tweet_1_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-nodpi/tweet_1_image.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-nodpi/tweet_1_profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-nodpi/tweet_1_profile.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-nodpi/twitter_profile.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-nodpi/twitter_profile.jpg -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xhdpi/ic_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-xhdpi/ic_add.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xhdpi/ic_debug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-xhdpi/ic_debug.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xhdpi/ic_location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-xhdpi/ic_location.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xhdpi/ic_message.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-xhdpi/ic_message.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/ic_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-xxhdpi/ic_add.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/ic_debug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-xxhdpi/ic_debug.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/ic_location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-xxhdpi/ic_location.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/ic_message.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-xxhdpi/ic_message.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxxhdpi/ic_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-xxxhdpi/ic_add.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxxhdpi/ic_debug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-xxxhdpi/ic_debug.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxxhdpi/ic_location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-xxxhdpi/ic_location.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxxhdpi/ic_message.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klinker41/android-slidingactivity/247a2eeb74f902d7246942b32a320b66ad571f30/sample/src/main/res/drawable-xxxhdpi/ic_message.png -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_content.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 25 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_custom_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 23 | 24 | 30 | 31 | 34 | 35 | 47 | 48 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_feedback.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 24 | 29 | 30 | 35 | 36 |