├── .gitignore ├── .idea ├── .name ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── gradle.xml ├── libraries │ └── support_v4_19_0_1.xml ├── misc.xml ├── modules.xml ├── scopes │ └── scope_settings.xml └── vcs.xml ├── GuideBackgroundColorAnimation.iml ├── README.md ├── art └── sample.gif ├── build.gradle ├── build └── intermediates │ ├── dex-cache │ └── cache.xml │ └── exploded-aar │ └── GuideBackgroundColorAnimation │ └── library │ └── unspecified │ ├── AndroidManifest.xml │ ├── R.txt │ ├── classes.jar │ └── res │ ├── drawable-hdpi-v4 │ └── ic_launcher.png │ ├── drawable-mdpi-v4 │ └── ic_launcher.png │ ├── drawable-xhdpi-v4 │ └── ic_launcher.png │ ├── drawable-xxhdpi-v4 │ └── ic_launcher.png │ ├── layout │ └── activity_main.xml │ ├── values-w820dp-v13 │ └── values.xml │ └── values │ └── values.xml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── library ├── .gitignore ├── build.gradle ├── library.iml ├── proguard-rules.txt └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── cn │ │ └── taurusxi │ │ └── guidebackgroundcoloranimation │ │ └── library │ │ └── ColorAnimationView.java │ └── res │ ├── drawable-hdpi │ └── ic_launcher.png │ ├── drawable-mdpi │ └── ic_launcher.png │ ├── drawable-xhdpi │ └── ic_launcher.png │ ├── drawable-xxhdpi │ └── ic_launcher.png │ ├── layout │ └── activity_main.xml │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── dimens.xml │ └── strings.xml ├── sample ├── .gitignore ├── build.gradle ├── proguard-rules.txt ├── sample.apk ├── sample.iml └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── cn │ │ └── taurusxi │ │ └── guidebackgroundcoloranimation │ │ └── sample │ │ └── SampleActivity.java │ └── res │ ├── drawable-hdpi │ └── ic_launcher.png │ ├── drawable-mdpi │ └── ic_launcher.png │ ├── drawable-xhdpi │ ├── ic_launcher.png │ ├── welcome1.png │ ├── welcome3.png │ └── welcome4.png │ ├── drawable-xxhdpi │ └── ic_launcher.png │ ├── layout │ └── activity_sample.xml │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | .DS_Store 5 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | GuideBackgroundColorAnimation -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /.idea/libraries/support_v4_19_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 19 | 20 | 21 | 22 | 23 | 24 | Android API 19 Platform 25 | 26 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/scopes/scope_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /GuideBackgroundColorAnimation.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ALLforYOU _android_ _UI_ _design_ 2 | ======================== 3 | 5/21/2014 13:45:07 PM 4 | 5 | > 引言 6 | 7 | 实现了滑动Viewpager的时候,背景动态变化的效果. IDE :Android Studio 8 | 9 | 10 | 11 | > 效果图 12 | 13 | 14 | 15 | > 关注我 16 | 17 | 关注我的微博:习成_myxilove 18 | 19 | > License 20 | Copyright 2013 Issac Wong 21 | Copyright 2013 Kenefe_Li 22 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at 23 | http://www.apache.org/licenses/LICENSE-2.0 24 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 25 | -------------------------------------------------------------------------------- /art/sample.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaurusXi/GuideBackgroundColorAnimation/4dc777acf7f9d032600f3fd0d5694412272a38b6/art/sample.gif -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | mavenCentral() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:0.11.+' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | mavenCentral() 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /build/intermediates/dex-cache/cache.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /build/intermediates/exploded-aar/GuideBackgroundColorAnimation/library/unspecified/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /build/intermediates/exploded-aar/GuideBackgroundColorAnimation/library/unspecified/R.txt: -------------------------------------------------------------------------------- 1 | int dimen activity_horizontal_margin 0x7f040000 2 | int dimen activity_vertical_margin 0x7f040001 3 | int drawable ic_launcher 0x7f020000 4 | int layout activity_main 0x7f030000 5 | int string action_settings 0x7f050000 6 | int string app_name 0x7f050001 7 | int string hello_world 0x7f050002 8 | -------------------------------------------------------------------------------- /build/intermediates/exploded-aar/GuideBackgroundColorAnimation/library/unspecified/classes.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaurusXi/GuideBackgroundColorAnimation/4dc777acf7f9d032600f3fd0d5694412272a38b6/build/intermediates/exploded-aar/GuideBackgroundColorAnimation/library/unspecified/classes.jar -------------------------------------------------------------------------------- /build/intermediates/exploded-aar/GuideBackgroundColorAnimation/library/unspecified/res/drawable-hdpi-v4/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaurusXi/GuideBackgroundColorAnimation/4dc777acf7f9d032600f3fd0d5694412272a38b6/build/intermediates/exploded-aar/GuideBackgroundColorAnimation/library/unspecified/res/drawable-hdpi-v4/ic_launcher.png -------------------------------------------------------------------------------- /build/intermediates/exploded-aar/GuideBackgroundColorAnimation/library/unspecified/res/drawable-mdpi-v4/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaurusXi/GuideBackgroundColorAnimation/4dc777acf7f9d032600f3fd0d5694412272a38b6/build/intermediates/exploded-aar/GuideBackgroundColorAnimation/library/unspecified/res/drawable-mdpi-v4/ic_launcher.png -------------------------------------------------------------------------------- /build/intermediates/exploded-aar/GuideBackgroundColorAnimation/library/unspecified/res/drawable-xhdpi-v4/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaurusXi/GuideBackgroundColorAnimation/4dc777acf7f9d032600f3fd0d5694412272a38b6/build/intermediates/exploded-aar/GuideBackgroundColorAnimation/library/unspecified/res/drawable-xhdpi-v4/ic_launcher.png -------------------------------------------------------------------------------- /build/intermediates/exploded-aar/GuideBackgroundColorAnimation/library/unspecified/res/drawable-xxhdpi-v4/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaurusXi/GuideBackgroundColorAnimation/4dc777acf7f9d032600f3fd0d5694412272a38b6/build/intermediates/exploded-aar/GuideBackgroundColorAnimation/library/unspecified/res/drawable-xxhdpi-v4/ic_launcher.png -------------------------------------------------------------------------------- /build/intermediates/exploded-aar/GuideBackgroundColorAnimation/library/unspecified/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /build/intermediates/exploded-aar/GuideBackgroundColorAnimation/library/unspecified/res/values-w820dp-v13/values.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 64dp 8 | 9 | 10 | -------------------------------------------------------------------------------- /build/intermediates/exploded-aar/GuideBackgroundColorAnimation/library/unspecified/res/values/values.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 16dp 8 | 16dp 9 | 10 | 11 | 12 | Settings 13 | Library 14 | Hello world! 15 | 16 | 17 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Settings specified in this file will override any Gradle settings 5 | # configured through the IDE. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaurusXi/GuideBackgroundColorAnimation/4dc777acf7f9d032600f3fd0d5694412272a38b6/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Apr 10 15:27:10 PDT 2013 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=http\://services.gradle.org/distributions/gradle-1.11-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 | apply plugin: 'android-library' 2 | 3 | android { 4 | compileSdkVersion 19 5 | buildToolsVersion "19.1.0" 6 | 7 | defaultConfig { 8 | minSdkVersion 14 9 | targetSdkVersion 19 10 | versionCode 1 11 | versionName "1.0" 12 | } 13 | buildTypes { 14 | release { 15 | runProguard false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | compile fileTree(dir: 'libs', include: ['*.jar']) 23 | compile 'com.android.support:support-v4:+' 24 | } 25 | 26 | -------------------------------------------------------------------------------- /library/library.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /library/proguard-rules.txt: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:/android_sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the ProGuard 5 | # include property in project.properties. 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 | #} -------------------------------------------------------------------------------- /library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /library/src/main/java/cn/taurusxi/guidebackgroundcoloranimation/library/ColorAnimationView.java: -------------------------------------------------------------------------------- 1 | package cn.taurusxi.guidebackgroundcoloranimation.library; 2 | 3 | import android.animation.Animator; 4 | import android.animation.ArgbEvaluator; 5 | import android.animation.ObjectAnimator; 6 | import android.animation.ValueAnimator; 7 | import android.content.Context; 8 | import android.support.v4.view.ViewPager; 9 | import android.util.AttributeSet; 10 | import android.view.View; 11 | /** 12 | * Created by TaurusXi on 2014/5/20. 13 | */ 14 | public class ColorAnimationView 15 | extends View 16 | implements ValueAnimator.AnimatorUpdateListener, Animator.AnimatorListener { 17 | private static final int RED = 0xffFF8080; 18 | private static final int BLUE = 0xff8080FF; 19 | private static final int WHITE = 0xffffffff; 20 | private static final int GREEN = 0xff80ff80; 21 | private static final int DURATION = 3000; 22 | ValueAnimator colorAnim = null; 23 | 24 | private PageChangeListener mPageChangeListener; 25 | 26 | ViewPager.OnPageChangeListener onPageChangeListener; 27 | 28 | public void setOnPageChangeListener(ViewPager.OnPageChangeListener onPageChangeListener) { 29 | this.onPageChangeListener = onPageChangeListener; 30 | } 31 | 32 | 33 | 34 | /** 35 | * 这是你唯一需要关心的方法 36 | * @param mViewPager 你必须在设置 Viewpager 的 Adapter 这后,才能调用这个方法。 37 | * @param obj ,这个obj实现了 ColorAnimationView.OnPageChangeListener ,实现回调 38 | * @param count ,viewpager孩子的数量 39 | * @param colors int... colors ,你需要设置的颜色变化值~~ 如何你传人 空,那么触发默认设置的颜色动画 40 | * */ 41 | /** 42 | * This is the only method you need care about. 43 | * @param mViewPager ,you need set the adpater before you call this. 44 | * @param count ,this param set the count of the viewpaper's child 45 | * @param colors ,this param set the change color use (int... colors), 46 | * so,you could set any length if you want.And by default. 47 | * if you set nothing , don't worry i have already creat 48 | * a default good change color! 49 | * */ 50 | public void setmViewPager(ViewPager mViewPager, int count, int... colors) { 51 | // this.mViewPager = mViewPager; 52 | if (mViewPager.getAdapter() == null) { 53 | throw new IllegalStateException( 54 | "ViewPager does not have adapter instance."); 55 | } 56 | mPageChangeListener.setViewPagerChildCount(count); 57 | 58 | mViewPager.setOnPageChangeListener(mPageChangeListener); 59 | if (colors.length == 0) { 60 | createDefaultAnimation(); 61 | } else { 62 | createAnimation(colors); 63 | } 64 | 65 | } 66 | 67 | public ColorAnimationView(Context context) { 68 | this(context, null, 0); 69 | 70 | } 71 | 72 | public ColorAnimationView(Context context, AttributeSet attrs) { 73 | this(context, attrs, 0); 74 | } 75 | 76 | public ColorAnimationView(Context context, AttributeSet attrs, int defStyleAttr) { 77 | super(context, attrs, defStyleAttr); 78 | mPageChangeListener = new PageChangeListener(); 79 | } 80 | 81 | private void seek(long seekTime) { 82 | if (colorAnim == null) { 83 | createDefaultAnimation(); 84 | } 85 | colorAnim.setCurrentPlayTime(seekTime); 86 | } 87 | 88 | private void createAnimation(int... colors) { 89 | if (colorAnim == null) { 90 | colorAnim = ObjectAnimator.ofInt(this, 91 | "backgroundColor", colors); 92 | colorAnim.setEvaluator(new ArgbEvaluator()); 93 | colorAnim.setDuration(DURATION); 94 | colorAnim.addUpdateListener(this); 95 | } 96 | } 97 | 98 | private void createDefaultAnimation() { 99 | colorAnim = ObjectAnimator.ofInt(this, 100 | "backgroundColor", WHITE, RED, BLUE, GREEN, WHITE); 101 | colorAnim.setEvaluator(new ArgbEvaluator()); 102 | colorAnim.setDuration(DURATION); 103 | colorAnim.addUpdateListener(this); 104 | } 105 | 106 | @Override public void onAnimationStart(Animator animation) { 107 | 108 | } 109 | 110 | @Override public void onAnimationEnd(Animator animation) { 111 | } 112 | 113 | @Override public void onAnimationCancel(Animator animation) { 114 | 115 | } 116 | 117 | @Override public void onAnimationRepeat(Animator animation) { 118 | 119 | } 120 | 121 | @Override public void onAnimationUpdate(ValueAnimator animation) { 122 | invalidate(); 123 | // long playtime = colorAnim.getCurrentPlayTime(); 124 | } 125 | 126 | private class PageChangeListener 127 | implements ViewPager.OnPageChangeListener { 128 | 129 | private int viewPagerChildCount; 130 | 131 | public void setViewPagerChildCount(int viewPagerChildCount) { 132 | this.viewPagerChildCount = viewPagerChildCount; 133 | } 134 | 135 | public int getViewPagerChildCount() { 136 | return viewPagerChildCount; 137 | } 138 | 139 | @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { 140 | 141 | int count = getViewPagerChildCount() - 1; 142 | if (count != 0) { 143 | float length = (position + positionOffset) / count; 144 | int progress = (int) (length * DURATION); 145 | ColorAnimationView.this.seek(progress); 146 | } 147 | // call the method by default 148 | if (onPageChangeListener!=null){ 149 | onPageChangeListener.onPageScrolled(position,positionOffset,positionOffsetPixels); 150 | } 151 | 152 | } 153 | 154 | @Override public void onPageSelected(int position) { 155 | if (onPageChangeListener!=null) { 156 | onPageChangeListener.onPageSelected(position); 157 | } 158 | } 159 | 160 | @Override public void onPageScrollStateChanged(int state) { 161 | if (onPageChangeListener!=null) { 162 | onPageChangeListener.onPageScrollStateChanged(state); 163 | } 164 | } 165 | } 166 | } 167 | 168 | 169 | -------------------------------------------------------------------------------- /library/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaurusXi/GuideBackgroundColorAnimation/4dc777acf7f9d032600f3fd0d5694412272a38b6/library/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaurusXi/GuideBackgroundColorAnimation/4dc777acf7f9d032600f3fd0d5694412272a38b6/library/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaurusXi/GuideBackgroundColorAnimation/4dc777acf7f9d032600f3fd0d5694412272a38b6/library/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaurusXi/GuideBackgroundColorAnimation/4dc777acf7f9d032600f3fd0d5694412272a38b6/library/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /library/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /library/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /library/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /library/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Library 5 | Hello world! 6 | Settings 7 | 8 | 9 | -------------------------------------------------------------------------------- /sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /sample/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'android' 2 | 3 | android { 4 | compileSdkVersion 19 5 | buildToolsVersion "19.1.0" 6 | 7 | defaultConfig { 8 | minSdkVersion 14 9 | targetSdkVersion 19 10 | versionCode 1 11 | versionName "1.0" 12 | } 13 | buildTypes { 14 | release { 15 | runProguard false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | compile fileTree(dir: 'libs', include: ['*.jar']) 23 | compile 'com.android.support:support-v4:+' 24 | compile project(':library') 25 | } 26 | 27 | 28 | -------------------------------------------------------------------------------- /sample/proguard-rules.txt: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:/android_sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the ProGuard 5 | # include property in project.properties. 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 | #} -------------------------------------------------------------------------------- /sample/sample.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaurusXi/GuideBackgroundColorAnimation/4dc777acf7f9d032600f3fd0d5694412272a38b6/sample/sample.apk -------------------------------------------------------------------------------- /sample/sample.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /sample/src/main/java/cn/taurusxi/guidebackgroundcoloranimation/sample/SampleActivity.java: -------------------------------------------------------------------------------- 1 | package cn.taurusxi.guidebackgroundcoloranimation.sample; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.os.Bundle; 5 | import android.support.v4.app.Fragment; 6 | import android.support.v4.app.FragmentActivity; 7 | import android.support.v4.app.FragmentManager; 8 | import android.support.v4.app.FragmentStatePagerAdapter; 9 | import android.support.v4.view.ViewPager; 10 | import android.util.Log; 11 | import android.view.LayoutInflater; 12 | import android.view.View; 13 | import android.view.ViewGroup; 14 | import android.widget.ImageView; 15 | 16 | import cn.taurusxi.guidebackgroundcoloranimation.library.ColorAnimationView; 17 | 18 | public class SampleActivity 19 | extends FragmentActivity 20 | { 21 | private static final int[] resource = new int[]{R.drawable.welcome1, R.drawable.welcome4, 22 | R.drawable.welcome3, R.drawable.welcome4}; 23 | private static final String TAG = SampleActivity.class.getSimpleName(); 24 | 25 | @Override 26 | protected void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | setContentView(R.layout.activity_sample); 29 | MyFragmentStatePager adpter = new MyFragmentStatePager(getSupportFragmentManager()); 30 | ColorAnimationView colorAnimationView = (ColorAnimationView) findViewById(R.id.ColorAnimationView); 31 | ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager); 32 | viewPager.setAdapter(adpter); 33 | /** 34 | * 首先,你必须在 设置 Viewpager的 adapter 之后在调用这个方法 35 | * 第二点,setmViewPager(ViewPager mViewPager,Object obj, int count, int... colors) 36 | * 第一个参数 是 你需要传人的 viewpager 37 | * 第二个参数 是 一个实现了ColorAnimationView.OnPageChangeListener接口的Object,用来实现回调 38 | * 第三个参数 是 viewpager 的 孩子数量 39 | * 第四个参数 int... colors ,你需要设置的颜色变化值~~ 如何你传人 空,那么触发默认设置的颜色动画 40 | * */ 41 | /** 42 | * Frist: You need call this method after you set the Viewpager adpter; 43 | * Second: setmViewPager(ViewPager mViewPager,Object obj, int count, int... colors) 44 | * so,you can set any length colors to make the animation more cool! 45 | * Third: If you call this method like below, make the colors no data, it will create 46 | * a change color by default. 47 | * */ 48 | colorAnimationView.setmViewPager(viewPager, resource.length); 49 | colorAnimationView.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { 50 | @Override 51 | public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { 52 | Log.e("TAG","onPageScrolled"); 53 | } 54 | 55 | @Override 56 | public void onPageSelected(int position) { 57 | Log.e("TAG","onPageSelected"); 58 | } 59 | 60 | @Override 61 | public void onPageScrollStateChanged(int state) { 62 | Log.e("TAG","onPageScrollStateChanged"); 63 | } 64 | }); 65 | // Four : Also ,you can call this method like this: 66 | // colorAnimationView.setmViewPager(viewPager,this,resource.length,0xffFF8080,0xff8080FF,0xffffffff,0xff80ff80); 67 | } 68 | 69 | 70 | 71 | public class MyFragmentStatePager 72 | extends FragmentStatePagerAdapter { 73 | 74 | public MyFragmentStatePager(FragmentManager fm) { 75 | super(fm); 76 | } 77 | 78 | @Override public Fragment getItem(int position) { 79 | return new MyFragment(position); 80 | } 81 | 82 | @Override public int getCount() { 83 | return resource.length; 84 | } 85 | } 86 | 87 | @SuppressLint("ValidFragment") public class MyFragment 88 | extends Fragment { 89 | private int position; 90 | 91 | public MyFragment(int position) { 92 | this.position = position; 93 | } 94 | 95 | @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 96 | ImageView imageView = new ImageView(getActivity()); 97 | imageView.setImageResource(resource[position]); 98 | return imageView; 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaurusXi/GuideBackgroundColorAnimation/4dc777acf7f9d032600f3fd0d5694412272a38b6/sample/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaurusXi/GuideBackgroundColorAnimation/4dc777acf7f9d032600f3fd0d5694412272a38b6/sample/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaurusXi/GuideBackgroundColorAnimation/4dc777acf7f9d032600f3fd0d5694412272a38b6/sample/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xhdpi/welcome1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaurusXi/GuideBackgroundColorAnimation/4dc777acf7f9d032600f3fd0d5694412272a38b6/sample/src/main/res/drawable-xhdpi/welcome1.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xhdpi/welcome3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaurusXi/GuideBackgroundColorAnimation/4dc777acf7f9d032600f3fd0d5694412272a38b6/sample/src/main/res/drawable-xhdpi/welcome3.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xhdpi/welcome4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaurusXi/GuideBackgroundColorAnimation/4dc777acf7f9d032600f3fd0d5694412272a38b6/sample/src/main/res/drawable-xhdpi/welcome4.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaurusXi/GuideBackgroundColorAnimation/4dc777acf7f9d032600f3fd0d5694412272a38b6/sample/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_sample.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 11 | 12 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /sample/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /sample/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /sample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | GuideBackgroundColorAnimation 5 | Hello world! 6 | Settings 7 | 8 | 9 | -------------------------------------------------------------------------------- /sample/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':sample', ':library' 2 | --------------------------------------------------------------------------------