├── demo ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-xhdpi │ │ │ │ ├── ic_edit_white_24dp.png │ │ │ │ ├── ic_send_white_24dp.png │ │ │ │ └── ic_star_border_black_24dp.png │ │ │ ├── drawable-xxhdpi │ │ │ │ ├── ic_edit_white_24dp.png │ │ │ │ ├── ic_send_white_24dp.png │ │ │ │ └── ic_star_border_black_24dp.png │ │ │ ├── drawable-xxxhdpi │ │ │ │ ├── ic_edit_white_24dp.png │ │ │ │ ├── ic_send_white_24dp.png │ │ │ │ └── ic_star_border_black_24dp.png │ │ │ ├── drawable │ │ │ │ └── oval_mail.xml │ │ │ ├── anim │ │ │ │ ├── activity_close_translate_to_bottom.xml │ │ │ │ ├── activity_open_translate_from_bottom.xml │ │ │ │ └── activity_no_animation.xml │ │ │ ├── values │ │ │ │ ├── dimens.xml │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ ├── menu │ │ │ │ └── menu_send.xml │ │ │ ├── layout │ │ │ │ ├── activity_after_fab_animation.xml │ │ │ │ ├── activity_main.xml │ │ │ │ └── list_item_mail.xml │ │ │ └── values-v21 │ │ │ │ └── styles.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── github │ │ │ └── fabtransitionactivity │ │ │ └── demo │ │ │ ├── model │ │ │ └── Mail.java │ │ │ ├── BaseActivity.java │ │ │ ├── AfterFabAnimationActivity.java │ │ │ └── MainActivity.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── github │ │ └── fabtransitionactivity │ │ └── demo │ │ └── ApplicationTest.java ├── proguard-rules.pro └── build.gradle ├── fabtransitionactivity ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── dimens.xml │ │ │ │ └── attr.xml │ │ │ └── layout │ │ │ │ └── bottom_sheet_layout.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── github │ │ │ └── fabtransitionactivity │ │ │ └── SheetLayout.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── github │ │ └── fabtransitionactivity │ │ └── ApplicationTest.java ├── proguard-rules.pro ├── build.gradle ├── gradle.properties └── maven-push.gradle ├── settings.gradle ├── LICENSE.txt ├── art └── fabTransitionActivity.gif ├── gradle └── wrapper │ └── gradle-wrapper.properties ├── .gitignore ├── gradle.properties ├── gradlew.bat ├── README.md └── gradlew /demo/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /fabtransitionactivity/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':demo', ':fabtransitionactivity' 2 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Bowyer 2 | Released under the MIT license 3 | http://opensource.org/licenses/mit-license.php -------------------------------------------------------------------------------- /art/fabTransitionActivity.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coyarzun89/FabTransitionActivity/HEAD/art/fabTransitionActivity.gif -------------------------------------------------------------------------------- /fabtransitionactivity/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | FabTransitionActivity 3 | 4 | -------------------------------------------------------------------------------- /demo/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coyarzun89/FabTransitionActivity/HEAD/demo/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coyarzun89/FabTransitionActivity/HEAD/demo/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coyarzun89/FabTransitionActivity/HEAD/demo/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coyarzun89/FabTransitionActivity/HEAD/demo/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /fabtransitionactivity/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4dp 4 | 5 | -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_edit_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coyarzun89/FabTransitionActivity/HEAD/demo/src/main/res/drawable-xhdpi/ic_edit_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_send_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coyarzun89/FabTransitionActivity/HEAD/demo/src/main/res/drawable-xhdpi/ic_send_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi/ic_edit_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coyarzun89/FabTransitionActivity/HEAD/demo/src/main/res/drawable-xxhdpi/ic_edit_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi/ic_send_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coyarzun89/FabTransitionActivity/HEAD/demo/src/main/res/drawable-xxhdpi/ic_send_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxxhdpi/ic_edit_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coyarzun89/FabTransitionActivity/HEAD/demo/src/main/res/drawable-xxxhdpi/ic_edit_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxxhdpi/ic_send_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coyarzun89/FabTransitionActivity/HEAD/demo/src/main/res/drawable-xxxhdpi/ic_send_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_star_border_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coyarzun89/FabTransitionActivity/HEAD/demo/src/main/res/drawable-xhdpi/ic_star_border_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable/oval_mail.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi/ic_star_border_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coyarzun89/FabTransitionActivity/HEAD/demo/src/main/res/drawable-xxhdpi/ic_star_border_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxxhdpi/ic_star_border_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coyarzun89/FabTransitionActivity/HEAD/demo/src/main/res/drawable-xxxhdpi/ic_star_border_black_24dp.png -------------------------------------------------------------------------------- /fabtransitionactivity/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /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=https\://services.gradle.org/distributions/gradle-2.10-all.zip 7 | -------------------------------------------------------------------------------- /demo/src/main/res/anim/activity_close_translate_to_bottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | -------------------------------------------------------------------------------- /demo/src/main/res/anim/activity_open_translate_from_bottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | -------------------------------------------------------------------------------- /demo/src/main/res/anim/activity_no_animation.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | 10 | -------------------------------------------------------------------------------- /demo/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 72dp 6 | 48dp 7 | 16sp 8 | 9 | -------------------------------------------------------------------------------- /demo/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /demo/src/main/res/menu/menu_send.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 11 | 12 | -------------------------------------------------------------------------------- /demo/src/androidTest/java/com/github/fabtransitionactivity/demo/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.bowyer.fabtransitionlayout.demo; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | 11 | public ApplicationTest() { 12 | super(Application.class); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /demo/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | FabTransitionLayout 3 | 4 | Hello world! 5 | Settings 6 | FabToolBarDemo 7 | BottomSheetDemo 8 | Inbox 9 | Compose 10 | Send 11 | 12 | -------------------------------------------------------------------------------- /fabtransitionactivity/src/androidTest/java/com/github/fabtransitionactivity/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.github.fabtransitionactivity; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | 11 | public ApplicationTest() { 12 | super(Application.class); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /demo/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #D32F2F 4 | #B71C1C 5 | #FFF5F5F5 6 | #212121 7 | #757575 8 | 9 | #9ccc65 10 | #a1887f 11 | #90a4ae 12 | #7986cb 13 | 14 | -------------------------------------------------------------------------------- /fabtransitionactivity/src/main/res/values/attr.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /fabtransitionactivity/src/main/res/layout/bottom_sheet_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /demo/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 /Users/a13089/Library/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 | -------------------------------------------------------------------------------- /fabtransitionactivity/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 /Users/a13089/Library/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 | -------------------------------------------------------------------------------- /demo/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /demo/src/main/res/layout/activity_after_fab_animation.xml: -------------------------------------------------------------------------------- 1 | 6 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /fabtransitionactivity/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply from: 'maven-push.gradle' 3 | 4 | repositories { 5 | mavenCentral() 6 | 7 | maven { 8 | url "https://jitpack.io" 9 | } 10 | } 11 | 12 | android { 13 | compileSdkVersion COMPILE_SDK_VERSION as int 14 | buildToolsVersion BUILD_TOOLS_VERSION 15 | 16 | defaultConfig { 17 | minSdkVersion MIN_SDK_VERSION 18 | targetSdkVersion TARGET_SDK_VERSION as int 19 | versionCode VERSION_CODE as int 20 | versionName VERSION_NAME 21 | } 22 | buildTypes { 23 | release { 24 | minifyEnabled false 25 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 26 | } 27 | } 28 | } 29 | 30 | dependencies { 31 | compile 'com.android.support:appcompat-v7:23.1.1' 32 | compile ('com.github.ozodrukh:CircularReveal:1.3.1@aar') { 33 | transitive = true; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /demo/src/main/java/com/github/fabtransitionactivity/demo/model/Mail.java: -------------------------------------------------------------------------------- 1 | package com.github.fabtransitionactivity.demo.model; 2 | 3 | /** 4 | * Created by Cristopher on 11/6/15. 5 | */ 6 | public class Mail { 7 | 8 | private int circleColor; 9 | private String titleEmail; 10 | private String messageEmail; 11 | private String dateEmail; 12 | 13 | public Mail(int circleColor, String titleEmail, String messageEmail, String dateEmail) { 14 | this.circleColor = circleColor; 15 | this.titleEmail = titleEmail; 16 | this.messageEmail = messageEmail; 17 | this.dateEmail = dateEmail; 18 | } 19 | 20 | public int getCircleColor() { 21 | return circleColor; 22 | } 23 | 24 | public String getTitleEmail() { 25 | return titleEmail; 26 | } 27 | 28 | public String getMessageEmail() { 29 | return messageEmail; 30 | } 31 | 32 | public String getDateEmail() { 33 | return dateEmail; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /demo/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | repositories { 4 | mavenCentral() 5 | 6 | maven { 7 | url "https://jitpack.io" 8 | } 9 | } 10 | 11 | android { 12 | compileSdkVersion COMPILE_SDK_VERSION as int 13 | buildToolsVersion BUILD_TOOLS_VERSION 14 | 15 | defaultConfig { 16 | applicationId "com.github.fabtransitionactivity.demo" 17 | minSdkVersion MIN_SDK_VERSION 18 | targetSdkVersion TARGET_SDK_VERSION as int 19 | versionCode VERSION_CODE as int 20 | versionName VERSION_NAME 21 | } 22 | buildTypes { 23 | release { 24 | minifyEnabled false 25 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 26 | } 27 | } 28 | } 29 | 30 | dependencies { 31 | compile fileTree(dir: 'libs', include: ['*.jar']) 32 | compile 'com.android.support:appcompat-v7:23.1.1' 33 | compile 'com.android.support:design:23.1.1' 34 | compile 'com.jakewharton:butterknife:7.0.1' 35 | compile project(':fabtransitionactivity') 36 | } 37 | -------------------------------------------------------------------------------- /demo/src/main/java/com/github/fabtransitionactivity/demo/BaseActivity.java: -------------------------------------------------------------------------------- 1 | package com.github.fabtransitionactivity.demo; 2 | 3 | import android.support.v7.app.AppCompatActivity; 4 | import android.support.v7.widget.Toolbar; 5 | 6 | /** 7 | * Created by Cristopher on 11/6/15. 8 | */ 9 | public class BaseActivity extends AppCompatActivity { 10 | 11 | protected void setUpToolbarWithTitle(String title, boolean hasBackButton){ 12 | Toolbar toolBar = (Toolbar) findViewById(R.id.toolbar_actionbar); 13 | setSupportActionBar(toolBar); 14 | if(getSupportActionBar() != null) { 15 | getSupportActionBar().setTitle(title); 16 | getSupportActionBar().setDisplayShowHomeEnabled(hasBackButton); 17 | getSupportActionBar().setDisplayHomeAsUpEnabled(hasBackButton); 18 | } 19 | } 20 | 21 | protected void enterFromBottomAnimation(){ 22 | overridePendingTransition(R.anim.activity_open_translate_from_bottom, R.anim.activity_no_animation); 23 | } 24 | 25 | protected void exitToBottomAnimation(){ 26 | overridePendingTransition(R.anim.activity_no_animation, R.anim.activity_close_translate_to_bottom); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /fabtransitionactivity/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 | # 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 19 | VERSION_NAME=0.2.0 20 | VERSION_CODE=2 21 | COMPILE_SDK_VERSION=23 22 | BUILD_TOOLS_VERSION=23.0.2 23 | TARGET_SDK_VERSION=23 24 | MIN_SDK_VERSION=15 25 | 26 | POM_NAME=FabTransitionActivity 27 | POM_ARTIFACT_ID=fabtransitionactivity 28 | POM_PACKAGING=aar 29 | -------------------------------------------------------------------------------- /demo/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 17 | 20 | 21 | 25 | 26 | 29 | 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # [Android] ======================== 2 | # Built application files 3 | *.apk 4 | *.ap_ 5 | 6 | # Files for the Dalvik VM 7 | *.dex 8 | 9 | # Java class files 10 | *.class 11 | 12 | # Generated files 13 | bin/ 14 | gen/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | 30 | ## Directory-based project format: 31 | .idea/ 32 | 33 | ## File-based project format: 34 | *.ipr 35 | *.iws 36 | 37 | ## Plugin-specific files: 38 | 39 | # IntelliJ 40 | out/ 41 | 42 | # mpeltonen/sbt-idea plugin 43 | .idea_modules/ 44 | 45 | # JIRA plugin 46 | atlassian-ide-plugin.xml 47 | 48 | # Crashlytics plugin (for Android Studio and IntelliJ) 49 | com_crashlytics_export_strings.xml 50 | 51 | 52 | # [Maven] ======================== 53 | target/ 54 | pom.xml.tag 55 | pom.xml.releaseBackup 56 | pom.xml.versionsBackup 57 | pom.xml.next 58 | release.properties 59 | 60 | 61 | # [Gradle-Android] ======================== 62 | 63 | # Ignore Gradle GUI config 64 | gradle-app.setting 65 | 66 | # Gradle Signing 67 | signing.properties 68 | trestle.keystore 69 | 70 | # Mobile Tools for Java (J2ME) 71 | .mtj.tmp/ 72 | 73 | # Package Files # 74 | *.jar 75 | *.war 76 | *.ear 77 | 78 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 79 | hs_err_pid* 80 | 81 | # Misc 82 | /.idea/workspace.xml 83 | .DS_Store 84 | /captures 85 | **/*.iml 86 | *.class -------------------------------------------------------------------------------- /demo/src/main/java/com/github/fabtransitionactivity/demo/AfterFabAnimationActivity.java: -------------------------------------------------------------------------------- 1 | package com.github.fabtransitionactivity.demo; 2 | 3 | import android.os.Bundle; 4 | import android.view.Menu; 5 | import android.view.MenuItem; 6 | import android.widget.Toast; 7 | 8 | import butterknife.ButterKnife; 9 | 10 | 11 | public class AfterFabAnimationActivity extends BaseActivity { 12 | 13 | @Override 14 | protected void onCreate(Bundle savedInstanceState) { 15 | enterFromBottomAnimation(); 16 | super.onCreate(savedInstanceState); 17 | setContentView(R.layout.activity_after_fab_animation); 18 | ButterKnife.bind(this); 19 | setUpToolbarWithTitle(getString(R.string.COMPOSE), true); 20 | } 21 | 22 | @Override 23 | protected void onPause() { 24 | exitToBottomAnimation(); 25 | super.onPause(); 26 | } 27 | 28 | @Override 29 | public boolean onCreateOptionsMenu(Menu menu) { 30 | getMenuInflater().inflate(R.menu.menu_send, menu); 31 | return super.onCreateOptionsMenu(menu); 32 | } 33 | 34 | @Override 35 | public boolean onOptionsItemSelected(MenuItem item) { 36 | switch (item.getItemId()) { 37 | case R.id.menu_send: 38 | Toast.makeText(getApplicationContext(), "Yeah!", Toast.LENGTH_SHORT).show(); 39 | break; 40 | case android.R.id.home: 41 | onBackPressed(); 42 | return true; 43 | } 44 | return super.onOptionsItemSelected(item); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /demo/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 17 | 18 | 21 | 22 | 25 | 26 | 30 | 34 | 35 | -------------------------------------------------------------------------------- /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 | # 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 19 | VERSION_NAME=0.2.0 20 | VERSION_CODE=2 21 | COMPILE_SDK_VERSION=23 22 | BUILD_TOOLS_VERSION=23.0.2 23 | TARGET_SDK_VERSION=23 24 | MIN_SDK_VERSION=15 25 | GROUP=com.github.coyarzun89 26 | 27 | POM_DESCRIPTION=A library that make a circle reveal animation and open a new activity 28 | POM_URL=https://github.com/coyarzun89/FabTransitionActivity 29 | POM_SCM_URL=https://github.com/coyarzun89/FabTransitionActivity 30 | POM_SCM_CONNECTION=scm:git@github.com:coyarzun89/FabTransitionActivity.git 31 | POM_SCM_DEV_CONNECTION=scm:git@github.com:github_coyarzun89/FabTransitionActivity.git 32 | POM_LICENCE_NAME=The Apache Software License, Version 2.0 33 | POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt 34 | POM_LICENCE_DIST=repo 35 | POM_DEVELOPER_ID=coyarzun89 36 | POM_DEVELOPER_NAME=Cristopher Oyarzun -------------------------------------------------------------------------------- /demo/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 5 | 17 | 22 | 23 | 35 | 36 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /demo/src/main/res/layout/list_item_mail.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 16 | 17 | 30 | 31 | 42 | 43 | 57 | 58 | 69 | 70 | 78 | -------------------------------------------------------------------------------- /fabtransitionactivity/maven-push.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Chris Banes 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'maven' 18 | apply plugin: 'signing' 19 | 20 | def isReleaseBuild() { 21 | return VERSION_NAME.contains("SNAPSHOT") == false 22 | } 23 | 24 | def getReleaseRepositoryUrl() { 25 | return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL 26 | : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" 27 | } 28 | 29 | def getSnapshotRepositoryUrl() { 30 | return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL 31 | : "https://oss.sonatype.org/content/repositories/snapshots/" 32 | } 33 | 34 | def getRepositoryUsername() { 35 | return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : "" 36 | } 37 | 38 | def getRepositoryPassword() { 39 | return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : "" 40 | } 41 | 42 | afterEvaluate { project -> 43 | uploadArchives { 44 | repositories { 45 | mavenDeployer { 46 | beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } 47 | 48 | pom.groupId = GROUP 49 | pom.artifactId = POM_ARTIFACT_ID 50 | pom.version = VERSION_NAME 51 | 52 | repository(url: getReleaseRepositoryUrl()) { 53 | authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) 54 | } 55 | snapshotRepository(url: getSnapshotRepositoryUrl()) { 56 | authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) 57 | } 58 | 59 | pom.project { 60 | name POM_NAME 61 | packaging POM_PACKAGING 62 | description POM_DESCRIPTION 63 | url POM_URL 64 | 65 | scm { 66 | url POM_SCM_URL 67 | connection POM_SCM_CONNECTION 68 | developerConnection POM_SCM_DEV_CONNECTION 69 | } 70 | 71 | licenses { 72 | license { 73 | name POM_LICENCE_NAME 74 | url POM_LICENCE_URL 75 | distribution POM_LICENCE_DIST 76 | } 77 | } 78 | 79 | developers { 80 | developer { 81 | id POM_DEVELOPER_ID 82 | name POM_DEVELOPER_NAME 83 | } 84 | } 85 | } 86 | } 87 | } 88 | } 89 | 90 | signing { 91 | required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } 92 | sign configurations.archives 93 | } 94 | 95 | //task androidJavadocs(type: Javadoc) { 96 | //source = android.sourceSets.main.allJava 97 | //} 98 | 99 | //task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { 100 | //classifier = 'javadoc' 101 | //from androidJavadocs.destinationDir 102 | //} 103 | 104 | task androidSourcesJar(type: Jar) { 105 | classifier = 'sources' 106 | from android.sourceSets.main.java.sourceFiles 107 | } 108 | 109 | artifacts { 110 | archives androidSourcesJar 111 | } 112 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FabTransitionActivity 2 | [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-FabTransitionActivity-green.svg?style=true)](https://android-arsenal.com/details/1/2763) 3 | 4 | It is based on [FabTransitionLayout](https://github.com/bowyer-app/FabTransitionLayout) 5 | 6 | ![transitionactivity](https://github.com/coyarzun89/FabTransitionActivity/blob/master/art/fabTransitionActivity.gif) 7 | 8 | Warning: The new version 0.2.0 have minSdkVersion 15 because the [CircularReveal](https://github.com/ozodrukh/CircularReveal) project has moved from 14 to 15 9 | 10 | Usage 11 | ==== 12 | ### build.gradle 13 | 14 | ``` 15 | //this is very important, don't forget it 16 | repositories { 17 | mavenCentral() 18 | 19 | maven { 20 | url "https://jitpack.io" 21 | } 22 | } 23 | 24 | defaultConfig { 25 | minSdkVersion 15 26 | } 27 | 28 | dependencies { 29 | compile 'com.github.coyarzun89:fabtransitionactivity:0.2.0' 30 | } 31 | 32 | 33 | ``` 34 | 35 | ### Layout XML 36 | ``` 37 | 41 | 42 | 54 | 55 | 60 | 61 | 73 | 74 | 82 | 83 | 84 | 85 | ``` 86 | 87 | ### Set up 88 | 89 | ```java 90 | public class MainActivity extends BaseActivity implements SheetLayout.OnFabAnimationEndListener { 91 | 92 | @Bind(R.id.bottom_sheet) SheetLayout mSheetLayout; 93 | @Bind(R.id.fab) FloatingActionButton mFab; 94 | 95 | private static final int REQUEST_CODE = 1; 96 | 97 | @Override 98 | protected void onCreate(Bundle savedInstanceState) { 99 | super.onCreate(savedInstanceState); 100 | setContentView(R.layout.activity_main); 101 | ButterKnife.bind(this); 102 | 103 | mSheetLayout.setFab(mFab); 104 | mSheetLayout.setFabAnimationEndListener(this); 105 | } 106 | 107 | @OnClick(R.id.fab) 108 | void onFabClick() { 109 | mSheetLayout.expandFab(); 110 | } 111 | 112 | @Override 113 | public void onFabAnimationEnd() { 114 | Intent intent = new Intent(this, AfterFabAnimationActivity.class); 115 | startActivityForResult(intent, REQUEST_CODE); 116 | } 117 | 118 | @Override 119 | public void onActivityResult(int requestCode, int resultCode, Intent data) { 120 | super.onActivityResult(requestCode, resultCode, data); 121 | if(requestCode == REQUEST_CODE){ 122 | mSheetLayout.contractFab(); 123 | } 124 | } 125 | ``` 126 | 127 | # Credits 128 | This library use following libraries. 129 | * [CircularReveal](https://github.com/ozodrukh/CircularReveal) 130 | -------------------------------------------------------------------------------- /demo/src/main/java/com/github/fabtransitionactivity/demo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.github.fabtransitionactivity.demo; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.support.design.widget.FloatingActionButton; 6 | import android.support.v4.content.ContextCompat; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.BaseAdapter; 10 | import android.widget.ImageView; 11 | import android.widget.ListView; 12 | import android.widget.TextView; 13 | 14 | 15 | import java.util.ArrayList; 16 | 17 | import butterknife.Bind; 18 | import butterknife.ButterKnife; 19 | import butterknife.OnClick; 20 | import com.github.fabtransitionactivity.SheetLayout; 21 | import com.github.fabtransitionactivity.demo.model.Mail; 22 | 23 | 24 | public class MainActivity extends BaseActivity implements SheetLayout.OnFabAnimationEndListener { 25 | 26 | @Bind(R.id.bottom_sheet) SheetLayout mSheetLayout; 27 | @Bind(R.id.fab) FloatingActionButton mFab; 28 | @Bind(R.id.list_mails) ListView listMails; 29 | 30 | ArrayList mailList = new ArrayList<>(); 31 | 32 | private static final int REQUEST_CODE = 1; 33 | 34 | @Override 35 | protected void onCreate(Bundle savedInstanceState) { 36 | super.onCreate(savedInstanceState); 37 | setContentView(R.layout.activity_main); 38 | ButterKnife.bind(this); 39 | setUpToolbarWithTitle(getString(R.string.INBOX), false); 40 | 41 | mSheetLayout.setFab(mFab); 42 | mSheetLayout.setFabAnimationEndListener(this); 43 | 44 | fillMailList(); 45 | listMails.setAdapter(new MailAdapter()); 46 | } 47 | 48 | @OnClick(R.id.fab) 49 | void onFabClick() { 50 | mSheetLayout.expandFab(); 51 | } 52 | 53 | @Override 54 | public void onFabAnimationEnd() { 55 | Intent intent = new Intent(this, AfterFabAnimationActivity.class); 56 | startActivityForResult(intent, REQUEST_CODE); 57 | } 58 | 59 | 60 | @Override 61 | public void onActivityResult(int requestCode, int resultCode, Intent data) { 62 | super.onActivityResult(requestCode, resultCode, data); 63 | if(requestCode == REQUEST_CODE){ 64 | mSheetLayout.contractFab(); 65 | } 66 | } 67 | 68 | 69 | private void fillMailList(){ 70 | String message = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua"; 71 | 72 | mailList.add(new Mail(1, "Abbrey Christensen", message, "Nov 5")); 73 | mailList.add(new Mail(2, "Alex Nelson", message, "Nov 5")); 74 | mailList.add(new Mail(3, "Mary Johnson", message, "Nov 4")); 75 | mailList.add(new Mail(4, "Peter Cartlsson", message, "Nov 3")); 76 | mailList.add(new Mail(5, "Trevor Hansen", message, "Nov 2")); 77 | mailList.add(new Mail(6, "Britta Holt", message, "Nov 2")); 78 | mailList.add(new Mail(7, "Sandra Adams", message, "Nov 2")); 79 | mailList.add(new Mail(8, "Cristopher Oyarzún", "Yeah!!", "Nov 2")); 80 | } 81 | 82 | private class MailAdapter extends BaseAdapter { 83 | 84 | @Override 85 | public int getCount() { 86 | return mailList.size(); 87 | } 88 | 89 | @Override 90 | public Mail getItem(int position) { 91 | return mailList.get(position); 92 | } 93 | 94 | @Override 95 | public long getItemId(int position) { 96 | return position; 97 | } 98 | 99 | @Override 100 | public View getView(int position, View convertView, ViewGroup parent) { 101 | ViewHolder holder; 102 | if (convertView == null) { 103 | convertView = View.inflate(MainActivity.this, R.layout.list_item_mail, null); 104 | holder = new ViewHolder(convertView); 105 | convertView.setTag(holder); 106 | } else { 107 | holder = (ViewHolder) convertView.getTag(); 108 | } 109 | 110 | holder.imageEmail.setColorFilter(setColorFilter(mailList.get(position).getCircleColor())); 111 | holder.textLabelEmail.setText(mailList.get(position).getTitleEmail().substring(0, 1)); 112 | holder.textTitleEmail.setText(mailList.get(position).getTitleEmail()); 113 | holder.textMessageEmail.setText(mailList.get(position).getMessageEmail()); 114 | holder.textDateEmail.setText(mailList.get(position).getDateEmail()); 115 | 116 | return convertView; 117 | } 118 | } 119 | 120 | static class ViewHolder { 121 | @Bind(R.id.image_email) ImageView imageEmail; 122 | @Bind(R.id.text_label_email) TextView textLabelEmail; 123 | @Bind(R.id.text_title_email) TextView textTitleEmail; 124 | @Bind(R.id.text_message_email) TextView textMessageEmail; 125 | @Bind(R.id.text_date_email) TextView textDateEmail; 126 | 127 | public ViewHolder(View view) { 128 | ButterKnife.bind(this, view); 129 | } 130 | } 131 | 132 | private int setColorFilter(int color){ 133 | if((color % 4) == 0) { 134 | return ContextCompat.getColor(getApplicationContext(), R.color.one_round); 135 | }if((color % 3) == 0) { 136 | return ContextCompat.getColor(getApplicationContext(), R.color.two_round); 137 | }if((color % 2) == 0) { 138 | return ContextCompat.getColor(getApplicationContext(), R.color.three_round); 139 | }else { 140 | return ContextCompat.getColor(getApplicationContext(), R.color.four_round); 141 | } 142 | } 143 | 144 | } 145 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /fabtransitionactivity/src/main/java/com/github/fabtransitionactivity/SheetLayout.java: -------------------------------------------------------------------------------- 1 | package com.github.fabtransitionactivity; 2 | 3 | import android.animation.Animator; 4 | import android.animation.AnimatorListenerAdapter; 5 | import android.annotation.TargetApi; 6 | import android.content.Context; 7 | import android.content.res.Resources; 8 | import android.content.res.TypedArray; 9 | import android.os.Build; 10 | import android.support.annotation.IntDef; 11 | import android.support.annotation.NonNull; 12 | import android.support.v4.view.ViewCompat; 13 | import android.util.AttributeSet; 14 | import android.util.DisplayMetrics; 15 | import android.util.TypedValue; 16 | import android.view.Gravity; 17 | import android.view.View; 18 | import android.view.ViewAnimationUtils; 19 | import android.view.ViewGroup; 20 | import android.widget.FrameLayout; 21 | import android.widget.ImageView; 22 | import android.widget.LinearLayout; 23 | 24 | import io.codetail.animation.SupportAnimator; 25 | 26 | public class SheetLayout extends FrameLayout { 27 | 28 | private static final int DEFAULT_ANIMATION_DURATION = 350; 29 | private static final int DEFAULT_FAB_SIZE = 56; 30 | 31 | private static final int FAB_CIRCLE = 0; 32 | private static final int FAB_EXPAND = 1; 33 | 34 | @IntDef({FAB_CIRCLE, FAB_EXPAND}) 35 | private @interface Fab { 36 | } 37 | 38 | private LinearLayout mFabExpandLayout; 39 | private ImageView mFab; 40 | 41 | int mFabType = FAB_CIRCLE; 42 | boolean mAnimatingFab = false; 43 | private int animationDuration; 44 | private int mFabSize; 45 | 46 | OnFabAnimationEndListener mListener; 47 | 48 | public SheetLayout(Context context) { 49 | super(context); 50 | init(); 51 | } 52 | 53 | public SheetLayout(Context context, AttributeSet attrs) { 54 | super(context, attrs); 55 | init(); 56 | loadAttributes(context, attrs); 57 | } 58 | 59 | public SheetLayout(Context context, AttributeSet attrs, int defStyle) { 60 | super(context, attrs, defStyle); 61 | init(); 62 | loadAttributes(context, attrs); 63 | } 64 | 65 | private void init() { 66 | inflate(getContext(), R.layout.bottom_sheet_layout, this); 67 | mFabExpandLayout = ((LinearLayout) findViewById(R.id.ft_container)); 68 | } 69 | 70 | private void loadAttributes(Context context, AttributeSet attrs) { 71 | TypedValue outValue = new TypedValue(); 72 | Resources.Theme theme = context.getTheme(); 73 | 74 | // use ?attr/colorPrimary as background color 75 | theme.resolveAttribute(R.attr.colorPrimary, outValue, true); 76 | 77 | TypedArray a = getContext().getTheme().obtainStyledAttributes( 78 | attrs, 79 | R.styleable.FooterLayout, 80 | 0, 0); 81 | 82 | int containerGravity; 83 | try { 84 | setColor(a.getColor(R.styleable.FooterLayout_ft_color, 85 | outValue.data)); 86 | animationDuration = a.getInteger(R.styleable.FooterLayout_ft_anim_duration, 87 | DEFAULT_ANIMATION_DURATION); 88 | containerGravity = a.getInteger(R.styleable.FooterLayout_ft_container_gravity, 1); 89 | mFabSize = a.getInteger(R.styleable.FooterLayout_ft_fab_type, DEFAULT_FAB_SIZE); 90 | } finally { 91 | a.recycle(); 92 | } 93 | 94 | mFabExpandLayout.setGravity(getGravity(containerGravity)); 95 | } 96 | 97 | public void setFab(ImageView imageView) { 98 | mFab = imageView; 99 | } 100 | 101 | private int getGravity(int gravityEnum) { 102 | return (gravityEnum == 0 ? Gravity.START 103 | : gravityEnum == 1 ? Gravity.CENTER_HORIZONTAL : Gravity.END) 104 | | Gravity.CENTER_VERTICAL; 105 | } 106 | 107 | public void setColor(int color) { 108 | mFabExpandLayout.setBackgroundColor(color); 109 | } 110 | 111 | @Override 112 | public void addView(@NonNull View child) { 113 | if (canAddViewToContainer()) { 114 | mFabExpandLayout.addView(child); 115 | } else { 116 | super.addView(child); 117 | } 118 | } 119 | 120 | @Override 121 | public void addView(@NonNull View child, int width, int height) { 122 | if (canAddViewToContainer()) { 123 | mFabExpandLayout.addView(child, width, height); 124 | } else { 125 | super.addView(child, width, height); 126 | } 127 | } 128 | 129 | @Override 130 | public void addView(@NonNull View child, ViewGroup.LayoutParams params) { 131 | if (canAddViewToContainer()) { 132 | mFabExpandLayout.addView(child, params); 133 | } else { 134 | super.addView(child, params); 135 | } 136 | } 137 | 138 | @Override 139 | public void addView(@NonNull View child, int index, ViewGroup.LayoutParams params) { 140 | if (canAddViewToContainer()) { 141 | mFabExpandLayout.addView(child, index, params); 142 | } else { 143 | super.addView(child, index, params); 144 | } 145 | } 146 | 147 | /** 148 | * hide() and show() methods are useful for remembering the toolbar state on screen rotation. 149 | */ 150 | public void hide() { 151 | mFabExpandLayout.setVisibility(View.INVISIBLE); 152 | mFabType = FAB_CIRCLE; 153 | } 154 | 155 | public void show() { 156 | mFabExpandLayout.setVisibility(View.VISIBLE); 157 | mFabType = FAB_EXPAND; 158 | } 159 | 160 | private boolean canAddViewToContainer() { 161 | return mFabExpandLayout != null; 162 | } 163 | 164 | public void expandFab() { 165 | mFabType = FAB_EXPAND; 166 | mAnimatingFab = true; 167 | 168 | // Center point on the screen of the FAB. 169 | int x = (int) (centerX(mFab)); 170 | int y = (int) (centerY(mFab)); 171 | 172 | // Start and end radius of the sheet expand animation. 173 | float startRadius = getFabSizePx() / 2; 174 | float endRadius = calculateStartRadius(x, y); 175 | 176 | mFabExpandLayout.setAlpha(0f); 177 | mFabExpandLayout.setVisibility(View.VISIBLE); 178 | 179 | mFab.setVisibility(View.INVISIBLE); 180 | mFab.setTranslationX(0f); 181 | mFab.setTranslationY(0f); 182 | 183 | mFab.setAlpha(1f); 184 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { 185 | expandPreLollipop(x, y, startRadius, endRadius); 186 | } else { 187 | expandLollipop(x, y, startRadius, endRadius); 188 | } 189 | } 190 | 191 | public void contractFab() { 192 | if (!isFabExpanded()) { 193 | return; 194 | } 195 | 196 | mFabType = FAB_CIRCLE; 197 | mAnimatingFab = true; 198 | 199 | mFab.setAlpha(0f); 200 | mFab.setVisibility(View.VISIBLE); 201 | 202 | // Center point on the screen of the FAB. 203 | int x = (int) (centerX(mFab)); 204 | int y = (int) (centerY(mFab)); 205 | 206 | // Start and end radius of the toolbar contract animation. 207 | float endRadius = getFabSizePx() / 2; 208 | float startRadius = calculateStartRadius(x, y); 209 | 210 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { 211 | contractPreLollipop(x, y, startRadius, endRadius); 212 | } else { 213 | contractLollipop(x, y, startRadius, endRadius); 214 | } 215 | } 216 | 217 | public boolean isFabExpanded() { 218 | return mFabType == FAB_EXPAND; 219 | } 220 | 221 | @TargetApi(Build.VERSION_CODES.LOLLIPOP) 222 | private void expandLollipop(int x, int y, float startRadius, float endRadius) { 223 | 224 | Animator toolbarExpandAnim = ViewAnimationUtils.createCircularReveal( 225 | mFabExpandLayout, x, y, startRadius, endRadius); 226 | toolbarExpandAnim.setDuration(animationDuration); 227 | toolbarExpandAnim.addListener(new AnimatorListenerAdapter() { 228 | @Override 229 | public void onAnimationStart(Animator animation) { 230 | super.onAnimationStart(animation); 231 | mFabExpandLayout.setAlpha(1f); 232 | } 233 | 234 | @Override 235 | public void onAnimationEnd(Animator animation) { 236 | super.onAnimationEnd(animation); 237 | expandAnimationEnd(); 238 | 239 | } 240 | }); 241 | 242 | toolbarExpandAnim.start(); 243 | } 244 | 245 | private void expandPreLollipop(int x, int y, float startRadius, float endRadius) { 246 | 247 | SupportAnimator toolbarExpandAnim = io.codetail.animation.ViewAnimationUtils 248 | .createCircularReveal( 249 | mFabExpandLayout, x, y, startRadius, endRadius); 250 | toolbarExpandAnim.setDuration(animationDuration); 251 | toolbarExpandAnim.addListener(new SupportAnimator.AnimatorListener() { 252 | @Override 253 | public void onAnimationStart() { 254 | mFabExpandLayout.setAlpha(1f); 255 | } 256 | 257 | @Override 258 | public void onAnimationEnd() { 259 | //mFab.setAlpha(1f); 260 | expandAnimationEnd(); 261 | 262 | } 263 | 264 | @Override 265 | public void onAnimationCancel() { 266 | 267 | } 268 | 269 | @Override 270 | public void onAnimationRepeat() { 271 | 272 | } 273 | }); 274 | 275 | toolbarExpandAnim.start(); 276 | } 277 | 278 | @TargetApi(Build.VERSION_CODES.LOLLIPOP) 279 | private void contractLollipop(int x, int y, float startRadius, float endRadius) { 280 | 281 | Animator toolbarContractAnim = ViewAnimationUtils.createCircularReveal( 282 | mFabExpandLayout, x, y, startRadius, endRadius); 283 | toolbarContractAnim.setDuration(animationDuration); 284 | 285 | toolbarContractAnim.addListener(new AnimatorListenerAdapter() { 286 | @Override 287 | public void onAnimationEnd(Animator animation) { 288 | super.onAnimationEnd(animation); 289 | contractAnimationEnd(); 290 | } 291 | }); 292 | 293 | toolbarContractAnim.start(); 294 | } 295 | 296 | private void contractPreLollipop(int x, int y, float startRadius, float endRadius) { 297 | 298 | final SupportAnimator toolbarContractAnim = io.codetail.animation.ViewAnimationUtils 299 | .createCircularReveal(mFabExpandLayout, x, y, startRadius, endRadius); 300 | toolbarContractAnim.setDuration(animationDuration); 301 | 302 | toolbarContractAnim.addListener(new SupportAnimator.AnimatorListener() { 303 | @Override 304 | public void onAnimationStart() { 305 | 306 | } 307 | 308 | @Override 309 | public void onAnimationEnd() { 310 | contractAnimationEnd(); 311 | } 312 | 313 | @Override 314 | public void onAnimationCancel() { 315 | 316 | } 317 | 318 | @Override 319 | public void onAnimationRepeat() { 320 | 321 | } 322 | }); 323 | 324 | toolbarContractAnim.start(); 325 | } 326 | 327 | private void expandAnimationEnd(){ 328 | mAnimatingFab = false; 329 | if (mListener != null) 330 | mListener.onFabAnimationEnd(); 331 | } 332 | 333 | private void contractAnimationEnd(){ 334 | mFab.setAlpha(1f); 335 | mFabExpandLayout.setAlpha(0f); 336 | 337 | mAnimatingFab = false; 338 | mFabExpandLayout.setVisibility(View.INVISIBLE); 339 | mFabExpandLayout.setAlpha(1f); 340 | } 341 | 342 | private float calculateStartRadius(int x, int y){ 343 | return (float) Math.hypot( 344 | Math.max(x, mFabExpandLayout.getWidth() - x), 345 | Math.max(y, mFabExpandLayout.getHeight() - y)); 346 | } 347 | 348 | private int getFabSizePx() { 349 | DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics(); 350 | return Math.round(mFabSize * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT)); 351 | } 352 | 353 | private float centerX(View view) { 354 | return ViewCompat.getX(view) + view.getWidth() / 2f; 355 | } 356 | 357 | private float centerY(View view) { 358 | return ViewCompat.getY(view) + view.getHeight() / 2f; 359 | } 360 | 361 | public interface OnFabAnimationEndListener { 362 | void onFabAnimationEnd(); 363 | } 364 | 365 | public void setFabAnimationEndListener(OnFabAnimationEndListener eventListener) { 366 | mListener = eventListener; 367 | } 368 | } 369 | --------------------------------------------------------------------------------