├── .gitignore ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── cleveroad │ │ └── example │ │ └── androidmanimation │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── cleveroad │ │ │ └── example │ │ │ └── androidmanimation │ │ │ ├── AnimationActivity.java │ │ │ └── MainActivity.java │ └── res │ │ ├── layout │ │ ├── activity_animation.xml │ │ └── activity_main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── cleveroad │ └── example │ └── androidmanimation │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── images └── animation_demo.gif ├── library ├── .gitignore ├── build.gradle ├── gradle-mvn-push.gradle ├── gradle.properties ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── cleveroad │ │ └── androidmanimation │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── cleveroad │ │ │ └── androidmanimation │ │ │ ├── AnimationDialogFragment.java │ │ │ ├── ColorUtil.java │ │ │ ├── Constants.java │ │ │ ├── DrawableObject.java │ │ │ ├── DrawableObjectImpl.java │ │ │ ├── DrawableUtils.java │ │ │ ├── FirstLayer.java │ │ │ ├── FourthLayer.java │ │ │ ├── Layer.java │ │ │ ├── LoadingAnimationView.java │ │ │ ├── Resetable.java │ │ │ ├── SecondLayer.java │ │ │ ├── ThirdLayer.java │ │ │ └── YellowRectangle.java │ └── res │ │ ├── layout │ │ └── lav_view_loading_animation.xml │ │ └── values │ │ ├── attrs.xml │ │ ├── colors.xml │ │ ├── public.xml │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── cleveroad │ └── androidmanimation │ └── ExampleUnitTest.java └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | ### Android template 10 | # Built application files 11 | *.apk 12 | *.ap_ 13 | 14 | # Files for the Dalvik VM 15 | *.dex 16 | 17 | # Java class files 18 | *.class 19 | 20 | # Generated files 21 | bin/ 22 | gen/ 23 | 24 | # Gradle files 25 | .gradle/ 26 | build/ 27 | 28 | # Local configuration file (sdk path, etc) 29 | local.properties 30 | 31 | # Proguard folder generated by Eclipse 32 | proguard/ 33 | 34 | # Log Files 35 | *.log 36 | 37 | # Android Studio Navigation editor temp files 38 | .navigation/ 39 | ### JetBrains template 40 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio 41 | 42 | *.iml 43 | 44 | ## Directory-based project format: 45 | .idea/ 46 | # if you remove the above rule, at least ignore the following: 47 | 48 | # User-specific stuff: 49 | # .idea/workspace.xml 50 | # .idea/tasks.xml 51 | # .idea/dictionaries 52 | 53 | # Sensitive or high-churn files: 54 | # .idea/dataSources.ids 55 | # .idea/dataSources.xml 56 | # .idea/sqlDataSources.xml 57 | # .idea/dynamic.xml 58 | # .idea/uiDesigner.xml 59 | 60 | # Gradle: 61 | # .idea/gradle.xml 62 | # .idea/libraries 63 | 64 | # Mongo Explorer plugin: 65 | # .idea/mongoSettings.xml 66 | 67 | ## File-based project format: 68 | *.ipr 69 | *.iws 70 | 71 | ## Plugin-specific files: 72 | 73 | # IntelliJ 74 | /out/ 75 | 76 | # mpeltonen/sbt-idea plugin 77 | .idea_modules/ 78 | 79 | # JIRA plugin 80 | atlassian-ide-plugin.xml 81 | 82 | # Crashlytics plugin (for Android Studio and IntelliJ) 83 | com_crashlytics_export_strings.xml 84 | crashlytics.properties 85 | crashlytics-build.properties 86 | 87 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Cleveroad Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Android Marshmallow Boot Animation View # 2 | 3 | Implementation of [Android Marshmallow Boot Animation](https://dribbble.com/shots/2487137-Daily-UI-076-Loading-Android-Marshmallow-Boot). 4 | 5 | ![Demo image](/images/animation_demo.gif) 6 | 7 | To use LoadingAnimationView first add dependency to your project: 8 | 9 | ```groovy 10 | dependencies { 11 | compile 'com.cleveroad:androidmanimation:0.9.1' 12 | } 13 | ``` 14 | 15 | Then you can declare it in your layout file like this: 16 | 17 | ```XML 18 | 32 | ``` 33 | 34 | Pay attention that you need to manually start/pause/stop animation. 35 | 36 | ```JAVA 37 | private LoadingAnimationView animation; 38 | 39 | ... 40 | 41 | @Override 42 | protected void onResume() { 43 | super.onResume(); 44 | // user interacts with screen, start animation 45 | animation.startAnimation(); 46 | } 47 | 48 | @Override 49 | protected void onPause() { 50 | // user stops interacting with screen, pause animation, save your battery! 51 | animation.pauseAnimation(); 52 | super.onPause(); 53 | } 54 | 55 | @Override 56 | protected void onDestroy() { 57 | // user leaves screen. Clean up everything. 58 | animation.stopAnimation(); 59 | super.onDestroy(); 60 | } 61 | ``` 62 | 63 | Another way to display loading animation is to use builder and display a dialog: 64 | 65 | ```JAVA 66 | AnimationDialogFragment fragment = new AnimationDialogFragment.Builder() 67 | .setBackgroundColor(Color.WHITE) 68 | .setFirstColor(getResources().getColor(R.color.google_red)) 69 | .setSecondColor(getResources().getColor(R.color.google_green)) 70 | .setThirdColor(getResources().getColor(R.color.google_blue)) 71 | .setFourthColor(getResources().getColor(R.color.google_yellow)) 72 | .setSpeedCoefficient(1.0f) 73 | .build(); 74 | fragment.show(getSupportFragmentManager(), "Animation"); 75 | ``` 76 | 77 | ## Changelog 78 | 79 | | Version | Changes | 80 | | --- | --- | 81 | | v.0.9.1 | Replaced Timer with ValueAnimator | 82 | | v.0.9.0 | First public release | 83 | 84 | #### Migrations from v.0.9.0 to v.0.9.1 85 | * **LoadingAnimationView.getState()** was replaced with **LoadingAnimationView.isRunning()** method. 86 | * All resources marked as private, prefix `lav_` added to their names. 87 | * Minimum SDK version set to 12 88 | 89 | 90 |
91 | #### Support #### 92 | * * * 93 | If you have any other questions regarding the use of this library, please contact us for support at info@cleveroad.com (email subject: "Android loading animation view. Support request.") 94 | or 95 | 96 | Use our contacts: 97 | 98 | * [Official site](https://www.cleveroad.com/?utm_source=github&utm_medium=link&utm_campaign=contacts) 99 | * [Facebook account](https://www.facebook.com/cleveroadinc) 100 | * [Twitter account](https://twitter.com/CleveroadInc) 101 | * [Google+ account](https://plus.google.com/+CleveroadInc/) 102 | 103 |
104 | #### License #### 105 | * * * 106 | The MIT License (MIT) 107 | 108 | Copyright (c) 2016 Cleveroad Inc. 109 | 110 | Permission is hereby granted, free of charge, to any person obtaining a copy 111 | of this software and associated documentation files (the "Software"), to deal 112 | in the Software without restriction, including without limitation the rights 113 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 114 | copies of the Software, and to permit persons to whom the Software is 115 | furnished to do so, subject to the following conditions: 116 | 117 | The above copyright notice and this permission notice shall be included in all 118 | copies or substantial portions of the Software. 119 | 120 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 121 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 122 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 123 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 124 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 125 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 126 | SOFTWARE. 127 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | ### Android template 3 | # Built application files 4 | *.apk 5 | *.ap_ 6 | 7 | # Files for the Dalvik VM 8 | *.dex 9 | 10 | # Java class files 11 | *.class 12 | 13 | # Generated files 14 | bin/ 15 | gen/ 16 | 17 | # Gradle files 18 | .gradle/ 19 | build/ 20 | 21 | # Local configuration file (sdk path, etc) 22 | local.properties 23 | 24 | # Proguard folder generated by Eclipse 25 | proguard/ 26 | 27 | # Log Files 28 | *.log 29 | 30 | # Android Studio Navigation editor temp files 31 | .navigation/ 32 | ### JetBrains template 33 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio 34 | 35 | *.iml 36 | 37 | ## Directory-based project format: 38 | .idea/ 39 | # if you remove the above rule, at least ignore the following: 40 | 41 | # User-specific stuff: 42 | # .idea/workspace.xml 43 | # .idea/tasks.xml 44 | # .idea/dictionaries 45 | 46 | # Sensitive or high-churn files: 47 | # .idea/dataSources.ids 48 | # .idea/dataSources.xml 49 | # .idea/sqlDataSources.xml 50 | # .idea/dynamic.xml 51 | # .idea/uiDesigner.xml 52 | 53 | # Gradle: 54 | # .idea/gradle.xml 55 | # .idea/libraries 56 | 57 | # Mongo Explorer plugin: 58 | # .idea/mongoSettings.xml 59 | 60 | ## File-based project format: 61 | *.ipr 62 | *.iws 63 | 64 | ## Plugin-specific files: 65 | 66 | # IntelliJ 67 | /out/ 68 | 69 | # mpeltonen/sbt-idea plugin 70 | .idea_modules/ 71 | 72 | # JIRA plugin 73 | atlassian-ide-plugin.xml 74 | 75 | # Crashlytics plugin (for Android Studio and IntelliJ) 76 | com_crashlytics_export_strings.xml 77 | crashlytics.properties 78 | crashlytics-build.properties 79 | 80 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.2" 6 | 7 | defaultConfig { 8 | applicationId "com.cleveroad.example.androidmanimation" 9 | minSdkVersion 12 10 | targetSdkVersion 23 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | testCompile 'junit:junit:4.12' 25 | compile 'com.android.support:appcompat-v7:23.2.0' 26 | compile project(':library') 27 | } 28 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\android\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/cleveroad/example/androidmanimation/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.cleveroad.example.androidmanimation; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/cleveroad/example/androidmanimation/AnimationActivity.java: -------------------------------------------------------------------------------- 1 | package com.cleveroad.example.androidmanimation; 2 | 3 | import android.os.Build; 4 | import android.os.Bundle; 5 | import android.support.annotation.Nullable; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.view.View; 8 | 9 | import com.cleveroad.androidmanimation.LoadingAnimationView; 10 | 11 | /** 12 | * Example of using animation as view in layout. 13 | */ 14 | public class AnimationActivity extends AppCompatActivity { 15 | 16 | private LoadingAnimationView animation; 17 | 18 | @Override 19 | protected void onCreate(@Nullable Bundle savedInstanceState) { 20 | super.onCreate(savedInstanceState); 21 | setContentView(R.layout.activity_animation); 22 | animation = (LoadingAnimationView) findViewById(R.id.animation); 23 | animation.setOnClickListener(new View.OnClickListener() { 24 | @Override 25 | public void onClick(View v) { 26 | if (!animation.isRunning()) { 27 | animation.startAnimation(); 28 | } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { 29 | animation.pauseAnimation(); 30 | } else { 31 | animation.stopAnimation(); 32 | } 33 | } 34 | }); 35 | } 36 | 37 | @Override 38 | protected void onResume() { 39 | super.onResume(); 40 | animation.startAnimation(); 41 | } 42 | 43 | @Override 44 | protected void onPause() { 45 | animation.pauseAnimation(); 46 | super.onPause(); 47 | } 48 | 49 | @Override 50 | protected void onDestroy() { 51 | animation.stopAnimation(); 52 | super.onDestroy(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/java/com/cleveroad/example/androidmanimation/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.cleveroad.example.androidmanimation; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.view.View; 7 | 8 | import com.cleveroad.androidmanimation.AnimationDialogFragment; 9 | 10 | public class MainActivity extends AppCompatActivity { 11 | 12 | @Override 13 | protected void onCreate(Bundle savedInstanceState) { 14 | super.onCreate(savedInstanceState); 15 | setContentView(R.layout.activity_main); 16 | findViewById(R.id.btn_activity).setOnClickListener(new View.OnClickListener() { 17 | @Override 18 | public void onClick(View v) { 19 | startActivity(new Intent(MainActivity.this, AnimationActivity.class)); 20 | } 21 | }); 22 | findViewById(R.id.btn_dialog).setOnClickListener(new View.OnClickListener() { 23 | @Override 24 | public void onClick(View v) { 25 | AnimationDialogFragment fragment = new AnimationDialogFragment.Builder() 26 | .build(); 27 | fragment.show(getSupportFragmentManager(), "Animation"); 28 | } 29 | }); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_animation.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 |