├── app ├── .gitignore ├── preview │ └── sample.gif ├── src │ ├── main │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── styles.xml │ │ │ │ ├── colors.xml │ │ │ │ └── dimens.xml │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ └── layout │ │ │ │ └── activity_main.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── loading │ │ │ └── mam │ │ │ └── com │ │ │ └── loading │ │ │ └── MainActivity.java │ ├── test │ │ └── java │ │ │ └── loading │ │ │ └── mam │ │ │ └── com │ │ │ └── loading │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── loading │ │ └── mam │ │ └── com │ │ └── loading │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── mamloadingview ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── loading │ │ │ └── mam │ │ │ └── com │ │ │ └── mamloadingview │ │ │ └── MAMBallView.java │ ├── test │ │ └── java │ │ │ └── loading │ │ │ └── mam │ │ │ └── com │ │ │ └── mamloadingview │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── loading │ │ └── mam │ │ └── com │ │ └── mamloadingview │ │ └── ExampleInstrumentedTest.java ├── build.gradle └── proguard-rules.pro ├── settings.gradle ├── .idea ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── vcs.xml ├── inspectionProfiles │ ├── profiles_settings.xml │ └── Project_Default.xml ├── modules.xml ├── runConfigurations.xml ├── gradle.xml ├── compiler.xml └── misc.xml ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── gradle.properties ├── README.md ├── gradlew.bat └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /mamloadingview/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':mamloadingview' 2 | -------------------------------------------------------------------------------- /app/preview/sample.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirshahbazi/Loading/HEAD/app/preview/sample.gif -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirshahbazi/Loading/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /mamloadingview/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | MAMLoadingView 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirshahbazi/Loading/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirshahbazi/Loading/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirshahbazi/Loading/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirshahbazi/Loading/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirshahbazi/Loading/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirshahbazi/Loading/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirshahbazi/Loading/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirshahbazi/Loading/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirshahbazi/Loading/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirshahbazi/Loading/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | MAM_View 3 | 4 | Hello world! 5 | 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | .idea 4 | /local.properties 5 | /.idea/workspace.xml 6 | /.idea/libraries 7 | .DS_Store 8 | /build 9 | /captures 10 | .externalNativeBuild 11 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sat Jul 22 16:08:39 IRDT 2017 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-3.3-all.zip 7 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 360dp 6 | 7 | 8 | -------------------------------------------------------------------------------- /mamloadingview/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/test/java/loading/mam/com/loading/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package loading.mam.com.loading; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /mamloadingview/src/test/java/loading/mam/com/mamloadingview/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package loading.mam.com.mamloadingview; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 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 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 12 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/androidTest/java/loading/mam/com/loading/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package loading.mam.com.loading; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("loading.mam.com.loading", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /mamloadingview/src/androidTest/java/loading/mam/com/mamloadingview/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package loading.mam.com.mamloadingview; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("loading.mam.com.mamloadingview.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /mamloadingview/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25.0.2" 6 | 7 | 8 | 9 | defaultConfig { 10 | minSdkVersion 14 11 | targetSdkVersion 25 12 | versionCode 1 13 | versionName "1.0" 14 | 15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 16 | 17 | } 18 | buildTypes { 19 | release { 20 | minifyEnabled false 21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 22 | } 23 | } 24 | } 25 | 26 | dependencies { 27 | compile fileTree(dir: 'libs', include: ['*.jar']) 28 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 29 | exclude group: 'com.android.support', module: 'support-annotations' 30 | }) 31 | compile 'com.android.support:appcompat-v7:25.0.0' 32 | testCompile 'junit:junit:4.12' 33 | } 34 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/java/loading/mam/com/loading/MainActivity.java: -------------------------------------------------------------------------------- 1 | package loading.mam.com.loading; 2 | 3 | import android.graphics.Color; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | 7 | import loading.mam.com.mamloadingview.MAMBallView; 8 | 9 | 10 | public class MainActivity extends AppCompatActivity { 11 | 12 | private MAMBallView mamBallView,mamBallView2,mamBallView3; 13 | 14 | @Override 15 | protected void onCreate(Bundle savedInstanceState) { 16 | super.onCreate(savedInstanceState); 17 | setContentView(R.layout.activity_main); 18 | 19 | mamBallView = (MAMBallView) this.findViewById(R.id.metaball); 20 | 21 | mamBallView2= (MAMBallView) this.findViewById(R.id.metaball2); 22 | mamBallView2.SetColor(Color.GREEN); 23 | 24 | mamBallView3= (MAMBallView) this.findViewById(R.id.metaball3); 25 | mamBallView3.SetColor(Color.DKGRAY); 26 | mamBallView3.setPaintMode(0); 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:\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 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /mamloadingview/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:\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 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25.0.2" 6 | defaultConfig { 7 | applicationId "loading.mam.com.loading" 8 | minSdkVersion 14 9 | targetSdkVersion 25 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 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 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 25 | exclude group: 'com.android.support', module: 'support-annotations' 26 | }) 27 | compile 'com.android.support:appcompat-v7:25.0.0' 28 | testCompile 'junit:junit:4.12' 29 | compile project(':mamloadingview') 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 17 | 18 | 19 | 28 | 29 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Loading 2 | ball loading view for android 3 | 4 | 5 | ![Hero Image](https://github.com/mirshahbazi/Loading/blob/master/app/preview/sample.gif) 6 | 7 | 8 | [![API](https://img.shields.io/badge/API-14%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=14) 9 | 10 | ## Using with gradle 11 | - Add the JitPack repository to your root build.gradle: 12 | ```gradle 13 | repositories { 14 | maven { url "https://jitpack.io" } 15 | } 16 | ``` 17 | 18 | - Add the dependency to your sub build.gradle: 19 | ```gradle 20 | dependencies { 21 | compile 'com.github.mirshahbazi:Loading:-SNAPSHOT' 22 | } 23 | 24 | 25 | ``` 26 | ## Using with maven 27 | - Add the JitPack repository to your build file 28 | ```maven: 29 | 30 | 31 | jitpack.io 32 | https://jitpack.io 33 | 34 | 35 | ``` 36 | - Add the dependency 37 | ```maven: 38 | 39 | com.github.mirshahbazi 40 | Loading 41 | master-SNAPSHOT 42 | 43 | ``` 44 | 45 | How to use: 46 | ## Xml 47 | 48 | Add this code to your xml layout: 49 | 50 | 51 | 56 | 57 | ## Java 58 | ```java 59 | 60 | // and in your activity or fragment add this : 61 | 62 | mamBallView = (MAMBallView) this.findViewById(R.id.metaball); 63 | 64 | //for change the color use this: 65 | 66 | mamBallView.SetColor(Color.GREEN); 67 | 68 | //for change the paint mode use this: 69 | 70 | mamBallView.setPaintMode(0); 71 | 72 | ``` 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | 47 | 48 | 49 | 50 | 1.8 51 | 52 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /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 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /mamloadingview/src/main/java/loading/mam/com/mamloadingview/MAMBallView.java: -------------------------------------------------------------------------------- 1 | package loading.mam.com.mamloadingview; 2 | 3 | import android.content.Context; 4 | import android.graphics.Canvas; 5 | import android.graphics.Paint; 6 | import android.graphics.Path; 7 | import android.graphics.RectF; 8 | import android.util.AttributeSet; 9 | import android.view.View; 10 | import android.view.animation.AccelerateDecelerateInterpolator; 11 | import android.view.animation.Animation; 12 | import android.view.animation.Transformation; 13 | 14 | import java.util.ArrayList; 15 | 16 | /** 17 | * Created by MAM on 15/7/27. 18 | */ 19 | public class MAMBallView extends View { 20 | 21 | private Paint paint = new Paint(); 22 | private float handle_len_rate = 2f; 23 | private float radius = 30; 24 | private final int ITEM_COUNT = 6; 25 | private final int ITEM_DIVIDER = 60; 26 | private final float SCALE_RATE = 0.6f; 27 | private float maxLength; 28 | private ArrayList circlePaths = new ArrayList<>(); 29 | private float mInterpolatedTime; 30 | private MoveAnimation wa; 31 | private Circle circle; 32 | 33 | public MAMBallView(Context context) { 34 | super(context); 35 | init(); 36 | } 37 | 38 | public MAMBallView(Context context, AttributeSet attrs) { 39 | super(context, attrs); 40 | init(); 41 | } 42 | 43 | public MAMBallView(Context context, AttributeSet attrs, int defStyleAttr) { 44 | super(context, attrs, defStyleAttr); 45 | init(); 46 | 47 | } 48 | 49 | private class Circle { 50 | float[] center; 51 | float radius; 52 | } 53 | 54 | public void setPaintMode(int mode) { 55 | paint.setStyle(mode == 0 ? Paint.Style.STROKE : Paint.Style.FILL); 56 | invalidate(); 57 | } 58 | 59 | private void init() { 60 | paint.setColor(0xff4db9ff); 61 | paint.setStyle(Paint.Style.FILL); 62 | paint.setAntiAlias(true); 63 | Circle circlePath = new Circle(); 64 | circlePath.center = new float[]{(radius + ITEM_DIVIDER), radius * (1f + SCALE_RATE)}; 65 | circlePath.radius = radius / 4 * 3; 66 | circlePaths.add(circlePath); 67 | 68 | for (int i = 1; i < ITEM_COUNT; i++) { 69 | circlePath = new Circle(); 70 | circlePath.center = new float[]{(radius * 2 + ITEM_DIVIDER) * i, radius * (1f + SCALE_RATE)}; 71 | circlePath.radius = radius; 72 | circlePaths.add(circlePath); 73 | } 74 | maxLength = (radius * 2 + ITEM_DIVIDER) * ITEM_COUNT; 75 | } 76 | 77 | public void SetColor(int color){ 78 | paint.setColor(color); 79 | } 80 | 81 | 82 | 83 | private float[] getVector(float radians, float length) { 84 | float x = (float) (Math.cos(radians) * length); 85 | float y = (float) (Math.sin(radians) * length); 86 | return new float[]{ 87 | x, y 88 | }; 89 | } 90 | 91 | private class MoveAnimation extends Animation { 92 | 93 | @Override 94 | protected void applyTransformation(float interpolatedTime, Transformation t) { 95 | super.applyTransformation(interpolatedTime, t); 96 | mInterpolatedTime = interpolatedTime; 97 | invalidate(); 98 | } 99 | } 100 | 101 | /** 102 | * @param canvas 103 | * @param j 104 | * @param i 105 | * @param v Control the length of the two rounds when connecting, indirectly control the thickness of the connection line, the value of 1 when the cable is straight 106 | * @param handle_len_rate 107 | * @param maxDistance 108 | */ 109 | private void metaball(Canvas canvas, int j, int i, float v, float handle_len_rate, float maxDistance) { 110 | final Circle circle1 = circlePaths.get(i); 111 | final Circle circle2 = circlePaths.get(j); 112 | 113 | RectF ball1 = new RectF(); 114 | ball1.left = circle1.center[0] - circle1.radius; 115 | ball1.top = circle1.center[1] - circle1.radius; 116 | ball1.right = ball1.left + circle1.radius * 2; 117 | ball1.bottom = ball1.top + circle1.radius * 2; 118 | 119 | RectF ball2 = new RectF(); 120 | ball2.left = circle2.center[0] - circle2.radius; 121 | ball2.top = circle2.center[1] - circle2.radius; 122 | ball2.right = ball2.left + circle2.radius * 2; 123 | ball2.bottom = ball2.top + circle2.radius * 2; 124 | 125 | float[] center1 = new float[]{ 126 | ball1.centerX(), 127 | ball1.centerY() 128 | }; 129 | float[] center2 = new float[]{ 130 | ball2.centerX(), 131 | ball2.centerY() 132 | }; 133 | float d = getDistance(center1, center2); 134 | 135 | float radius1 = ball1.width() / 2; 136 | float radius2 = ball2.width() / 2; 137 | float pi2 = (float) (Math.PI / 2); 138 | float u1, u2; 139 | //this is sample for omid 140 | 141 | 142 | if (d > maxDistance) { 143 | canvas.drawCircle(ball2.centerX(), ball2.centerY(), circle2.radius, paint); 144 | } else { 145 | float scale2 = 1 + SCALE_RATE * (1 - d / maxDistance); 146 | float scale1 = 1 - SCALE_RATE * (1 - d / maxDistance); 147 | radius2 *= scale2; 148 | canvas.drawCircle(ball2.centerX(), ball2.centerY(), radius2, paint); 149 | 150 | } 151 | 152 | if (radius1 == 0 || radius2 == 0) { 153 | return; 154 | } 155 | 156 | if (d > maxDistance || d <= Math.abs(radius1 - radius2)) { 157 | return; 158 | } else if (d < radius1 + radius2) { 159 | u1 = (float) Math.acos((radius1 * radius1 + d * d - radius2 * radius2) / 160 | (2 * radius1 * d)); 161 | u2 = (float) Math.acos((radius2 * radius2 + d * d - radius1 * radius1) / 162 | (2 * radius2 * d)); 163 | } else { 164 | u1 = 0; 165 | u2 = 0; 166 | } 167 | float[] centermin = new float[]{center2[0] - center1[0], center2[1] - center1[1]}; 168 | 169 | float angle1 = (float) Math.atan2(centermin[1], centermin[0]); 170 | float angle2 = (float) Math.acos((radius1 - radius2) / d); 171 | float angle1a = angle1 + u1 + (angle2 - u1) * v; 172 | float angle1b = angle1 - u1 - (angle2 - u1) * v; 173 | float angle2a = (float) (angle1 + Math.PI - u2 - (Math.PI - u2 - angle2) * v); 174 | float angle2b = (float) (angle1 - Math.PI + u2 + (Math.PI - u2 - angle2) * v); 175 | 176 | float[] p1a1 = getVector(angle1a, radius1); 177 | float[] p1b1 = getVector(angle1b, radius1); 178 | float[] p2a1 = getVector(angle2a, radius2); 179 | float[] p2b1 = getVector(angle2b, radius2); 180 | 181 | float[] p1a = new float[]{p1a1[0] + center1[0], p1a1[1] + center1[1]}; 182 | float[] p1b = new float[]{p1b1[0] + center1[0], p1b1[1] + center1[1]}; 183 | float[] p2a = new float[]{p2a1[0] + center2[0], p2a1[1] + center2[1]}; 184 | float[] p2b = new float[]{p2b1[0] + center2[0], p2b1[1] + center2[1]}; 185 | 186 | 187 | float[] p1_p2 = new float[]{p1a[0] - p2a[0], p1a[1] - p2a[1]}; 188 | 189 | float totalRadius = (radius1 + radius2); 190 | float d2 = Math.min(v * handle_len_rate, getLength(p1_p2) / totalRadius); 191 | d2 *= Math.min(1, d * 8 / (radius1 + radius2)); 192 | radius1 *= d2; 193 | radius2 *= d2; 194 | 195 | float[] sp1 = getVector(angle1a - pi2, radius1); 196 | float[] sp2 = getVector(angle2a + pi2, radius2); 197 | float[] sp3 = getVector(angle2b - pi2, radius2); 198 | float[] sp4 = getVector(angle1b + pi2, radius1); 199 | 200 | 201 | Path path1 = new Path(); 202 | path1.moveTo(p1a[0], p1a[1]); 203 | path1.cubicTo(p1a[0] + sp1[0], p1a[1] + sp1[1], p2a[0] + sp2[0], p2a[1] + sp2[1], p2a[0], p2a[1]); 204 | path1.lineTo(p2b[0], p2b[1]); 205 | path1.cubicTo(p2b[0] + sp3[0], p2b[1] + sp3[1], p1b[0] + sp4[0], p1b[1] + sp4[1], p1b[0], p1b[1]); 206 | path1.lineTo(p1a[0], p1a[1]); 207 | path1.close(); 208 | canvas.drawPath(path1, paint); 209 | 210 | } 211 | 212 | private float getLength(float[] b) { 213 | return (float) Math.sqrt(b[0] * b[0] + b[1] * b[1]); 214 | } 215 | 216 | private float getDistance(float[] b1, float[] b2) { 217 | float x = b1[0] - b2[0]; 218 | float y = b1[1] - b2[1]; 219 | float d = x * x + y * y; 220 | return (float) Math.sqrt(d); 221 | } 222 | 223 | 224 | @Override 225 | protected void onDraw(Canvas canvas) { 226 | super.onDraw(canvas); 227 | circle = circlePaths.get(0); 228 | circle.center[0] = maxLength * mInterpolatedTime; 229 | 230 | RectF ball1 = new RectF(); 231 | ball1.left = circle.center[0] - circle.radius; 232 | ball1.top = circle.center[1] - circle.radius; 233 | ball1.right = ball1.left + circle.radius * 2; 234 | ball1.bottom = ball1.top + circle.radius * 2; 235 | canvas.drawCircle(ball1.centerX(), ball1.centerY(), circle.radius, paint); 236 | for (int i = 1, l = circlePaths.size(); i < l; i++) { 237 | metaball(canvas, i, 0, 0.6f, handle_len_rate, radius * 4f); 238 | } 239 | } 240 | 241 | @Override 242 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 243 | setMeasuredDimension(resolveSizeAndState((int) (ITEM_COUNT * (radius * 2 + ITEM_DIVIDER)), widthMeasureSpec, 0), 244 | resolveSizeAndState((int) (2 * radius * 1.4f), heightMeasureSpec, 0)); 245 | } 246 | 247 | 248 | private void stopAnimation() { 249 | this.clearAnimation(); 250 | postInvalidate(); 251 | } 252 | 253 | private void startAnimation() { 254 | wa = new MoveAnimation(); 255 | wa.setDuration(2500); 256 | wa.setInterpolator(new AccelerateDecelerateInterpolator()); 257 | wa.setRepeatCount(Animation.INFINITE); 258 | wa.setRepeatMode(Animation.RELATIVE_TO_PARENT); 259 | startAnimation(wa); 260 | } 261 | 262 | @Override 263 | protected void onVisibilityChanged(View changedView, int visibility) { 264 | super.onVisibilityChanged(changedView, visibility); 265 | 266 | if (visibility == GONE || visibility == INVISIBLE) { 267 | stopAnimation(); 268 | } else { 269 | startAnimation(); 270 | } 271 | } 272 | 273 | @Override 274 | protected void onAttachedToWindow() { 275 | super.onAttachedToWindow(); 276 | startAnimation(); 277 | } 278 | 279 | @Override 280 | protected void onDetachedFromWindow() { 281 | stopAnimation(); 282 | super.onDetachedFromWindow(); 283 | } 284 | } 285 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 556 | --------------------------------------------------------------------------------