├── .gitignore ├── LICENSE.txt ├── README.md ├── art ├── CoordinatorLayout.gif ├── bottomsheet.gif └── toolbar.gif ├── build.gradle ├── demo ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── bowyer │ │ └── fabtransitionlayout │ │ └── demo │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── bowyer │ │ └── fabtransitionlayout │ │ └── demo │ │ ├── BottomSheetDemoActivity.java │ │ ├── CoordinatorLayoutActivity.java │ │ ├── FabToolBarDemoActivity.java │ │ ├── MainActivity.java │ │ ├── adapter │ │ ├── BottomSheetAdapter.java │ │ └── RecyclerViewAdapter.java │ │ └── model │ │ └── BottomSheet.java │ └── res │ ├── drawable-xhdpi │ ├── ic_account_circle_white_24dp.png │ ├── ic_add_white_24dp.png │ ├── ic_build_white_24dp.png │ ├── ic_call_white_36dp.png │ ├── ic_drafts_white_24dp.png │ ├── ic_email_white_36dp.png │ └── ic_forum_white_36dp.png │ ├── drawable-xxhdpi │ ├── ic_account_circle_white_24dp.png │ ├── ic_add_white_24dp.png │ ├── ic_build_white_24dp.png │ ├── ic_call_white_36dp.png │ ├── ic_drafts_white_24dp.png │ ├── ic_email_white_36dp.png │ └── ic_forum_white_36dp.png │ ├── drawable-xxxhdpi │ ├── ic_account_circle_white_24dp.png │ ├── ic_add_white_24dp.png │ ├── ic_build_white_24dp.png │ ├── ic_call_white_36dp.png │ ├── ic_drafts_white_24dp.png │ ├── ic_email_white_36dp.png │ └── ic_forum_white_36dp.png │ ├── layout │ ├── activity_bottom_sheet.xml │ ├── activity_coordinator_layout.xml │ ├── activity_fab_toolbar.xml │ ├── activity_main.xml │ └── row_item_bottom_sheet.xml │ ├── menu │ ├── menu_coordinator.xml │ └── menu_main.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── values-v21 │ └── styles.xml │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── fabtransitionlayout ├── .gitignore ├── bintray-publish.gradle ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── bowyer │ │ └── fabtransitionlayout │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── bowyer │ │ └── app │ │ └── fabtransitionlayout │ │ ├── BottomSheetLayout.java │ │ ├── FooterBehavior.java │ │ ├── FooterLayout.java │ │ └── ViewUtils.java │ └── res │ ├── layout │ ├── bottom_sheet_layout.xml │ ├── footer_layout.xml │ └── sheet_layout.xml │ └── values │ ├── attr.xml │ ├── dimens.xml │ └── strings.xml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | ### Android template 3 | # Built application files 4 | *.apk 5 | *.ap_ 6 | 7 | # Files for the Dalvik VM 8 | *.dex 9 | 10 | # Java class files 11 | *.class 12 | 13 | # Generated files 14 | bin/ 15 | gen/ 16 | 17 | # Gradle files 18 | .gradle/ 19 | build/ 20 | /*/build/ 21 | 22 | # Local configuration file (sdk path, etc) 23 | local.properties 24 | 25 | # Proguard folder generated by Eclipse 26 | proguard/ 27 | 28 | # Log Files 29 | *.log 30 | 31 | 32 | ### JetBrains template 33 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion 34 | 35 | *.iml 36 | 37 | ## Directory-based project format: 38 | .idea/ 39 | # if you remove the above rule, at least ignore the following: 40 | 41 | # User-specific stuff: 42 | # .idea/workspace.xml 43 | # .idea/tasks.xml 44 | # .idea/dictionaries 45 | 46 | # Sensitive or high-churn files: 47 | # .idea/dataSources.ids 48 | # .idea/dataSources.xml 49 | # .idea/sqlDataSources.xml 50 | # .idea/dynamic.xml 51 | # .idea/uiDesigner.xml 52 | 53 | # Gradle: 54 | # .idea/gradle.xml 55 | # .idea/libraries 56 | 57 | # Mongo Explorer plugin: 58 | # .idea/mongoSettings.xml 59 | 60 | ## File-based project format: 61 | *.ipr 62 | *.iws 63 | 64 | ## Plugin-specific files: 65 | 66 | # IntelliJ 67 | /out/ 68 | 69 | # mpeltonen/sbt-idea plugin 70 | .idea_modules/ 71 | 72 | # JIRA plugin 73 | atlassian-ide-plugin.xml 74 | 75 | # Crashlytics plugin (for Android Studio and IntelliJ) 76 | com_crashlytics_export_strings.xml 77 | crashlytics.properties 78 | crashlytics-build.properties 79 | 80 | 81 | ### OSX template 82 | .DS_Store 83 | .AppleDouble 84 | .LSOverride 85 | 86 | # Icon must end with two \r 87 | Icon 88 | 89 | # Thumbnails 90 | ._* 91 | 92 | # Files that might appear in the root of a volume 93 | .DocumentRevisions-V100 94 | .fseventsd 95 | .Spotlight-V100 96 | .TemporaryItems 97 | .Trashes 98 | .VolumeIcon.icns 99 | 100 | # Directories potentially created on remote AFP share 101 | .AppleDB 102 | .AppleDesktop 103 | Network Trash Folder 104 | Temporary Items 105 | .apdisk 106 | 107 | 108 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Bowyer 2 | Released under the MIT license 3 | http://opensource.org/licenses/mit-license.php -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FabTransitionLayout 2 | [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-FabTransitionLayout-green.svg?style=flat)](https://android-arsenal.com/details/1/2541) 3 | 4 | Provides the Floating Action Button Transition [as specified in the Material Design Guide](http://www.google.com/design/spec/components/buttons-floating-action-button.html#buttons-floating-action-button-transitions) in a simple library. 5 | 6 | It is strongly inspired by [fab-toolbar](https://github.com/bowyer-app/fab-toolbar) 7 | 8 | | bottomsheet | toolbar | CoordinatorLayout| 9 | | :---------------: |:---------------:| :---------------:| 10 | |![bottomsheet](https://github.com/bowyer-app/FabTransitionLayout/blob/master/art/bottomsheet.gif)|![bottomsheet](https://github.com/bowyer-app/FabTransitionLayout/blob/master/art/toolbar.gif)|![CoordinatorLayout](https://github.com/bowyer-app/FabTransitionLayout/blob/master/art/CoordinatorLayout.gif)| 11 | 12 | Usage 13 | ==== 14 | ### build.gradle 15 | 16 | ``` 17 | repositories { 18 | jcenter() 19 | } 20 | 21 | dependencies { 22 | compile 'com.bowyer.app:fabtransitionlayout:0.4.0@aar' 23 | } 24 | ``` 25 | 26 | ### Layout XML 27 | #### BottomSheetLayout 28 | ```xml 29 | 35 | 36 | 41 | 42 | 54 | 55 | 62 | 63 | 69 | 70 | 71 | 72 | 73 | ``` 74 | #### FooterLayout 75 | ```xml 76 | 82 | 83 | 88 | 89 | 101 | 102 | 109 | 110 | 111 | 112 | ``` 113 | 114 | ### Set up 115 | 116 | ```java 117 | @Override 118 | protected void onCreate(Bundle savedInstanceState) { 119 | super.onCreate(savedInstanceState); 120 | setContentView(R.layout.activity_main); 121 | ButterKnife.bind(this); 122 | initListView(); 123 | //set floating button to FabToolbar 124 | mBottomSheetLayout.setFab(mFab); 125 | } 126 | ``` 127 | 128 | ### Show Hide 129 | 130 | ```java 131 | //expand FabToolbar 132 | mBottomSheetLayout.expandFab(); 133 | 134 | //if mBottomSheetLayout is expand,mBottomSheetLayout contract. else fab slide out. 135 | mBottomSheetLayout.slideOutFab(); 136 | 137 | //fab slide in 138 | mBottomSheetLayout.slideInFab(); 139 | 140 | 141 | ``` 142 | 143 | # Credits 144 | This library use following libraries. 145 | * [CircularReveal](https://github.com/ozodrukh/CircularReveal) 146 | 147 | # Code Style 148 | 149 | Follow [SquareAndroid](https://github.com/square/java-code-styles/blob/master/configs/codestyles/SquareAndroid.xml). 150 | 151 | Feature 152 | ==== 153 | - [ ] A floating action button transforming into a single sheet of material 154 | 155 | License 156 | -------- 157 | ``` 158 | Copyright (c) 2015 Bowyer 159 | Released under the MIT license 160 | http://opensource.org/licenses/mit-license.php 161 | ``` 162 | -------------------------------------------------------------------------------- /art/CoordinatorLayout.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bowyer-app/FabTransitionLayout/bcd3a5e1f1f061ea3e69a295af92d86f0c22a5f3/art/CoordinatorLayout.gif -------------------------------------------------------------------------------- /art/bottomsheet.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bowyer-app/FabTransitionLayout/bcd3a5e1f1f061ea3e69a295af92d86f0c22a5f3/art/bottomsheet.gif -------------------------------------------------------------------------------- /art/toolbar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bowyer-app/FabTransitionLayout/bcd3a5e1f1f061ea3e69a295af92d86f0c22a5f3/art/toolbar.gif -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.1.2' 9 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2' 10 | classpath 'com.github.dcendents:android-maven-plugin:1.2' 11 | // NOTE: Do not place your application dependencies here; they belong 12 | // in the individual module build.gradle files 13 | } 14 | } 15 | 16 | allprojects { 17 | repositories { 18 | jcenter() 19 | } 20 | } 21 | 22 | ext { 23 | androidSupportAppCompatV7Lib = 'com.android.support:appcompat-v7:23.4.0' 24 | } 25 | -------------------------------------------------------------------------------- /demo/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /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.bowyer.fabtransitionlayout.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 rootProject.ext.androidSupportAppCompatV7Lib 33 | compile 'com.android.support:design:23.4.0' 34 | compile 'com.squareup.picasso:picasso:2.5.2' 35 | compile 'com.jakewharton:butterknife:7.0.1' 36 | compile 'com.github.ksoichiro:android-observablescrollview:1.5.1' 37 | compile project(':fabtransitionlayout') 38 | } 39 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /demo/src/androidTest/java/com/bowyer/fabtransitionlayout/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/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 26 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /demo/src/main/java/com/bowyer/fabtransitionlayout/demo/BottomSheetDemoActivity.java: -------------------------------------------------------------------------------- 1 | package com.bowyer.fabtransitionlayout.demo; 2 | 3 | import android.os.Bundle; 4 | import android.support.design.widget.FloatingActionButton; 5 | import android.support.v7.app.ActionBarActivity; 6 | import android.widget.ArrayAdapter; 7 | import android.widget.ListView; 8 | import butterknife.Bind; 9 | import butterknife.ButterKnife; 10 | import butterknife.OnClick; 11 | import com.bowyer.app.fabtransitionlayout.BottomSheetLayout; 12 | import com.bowyer.fabtransitionlayout.demo.adapter.BottomSheetAdapter; 13 | import com.bowyer.fabtransitionlayout.demo.model.BottomSheet; 14 | import com.github.ksoichiro.android.observablescrollview.ObservableListView; 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | /** 19 | * Created by Bowyer on 15/08/07. 20 | */ 21 | public class BottomSheetDemoActivity extends ActionBarActivity { 22 | 23 | @Bind(R.id.list_view) ObservableListView mObservableListView; 24 | 25 | @Bind(R.id.bottom_sheet) BottomSheetLayout mBottomSheetLayout; 26 | 27 | @Bind(R.id.list_menu) ListView mMenuList; 28 | 29 | @Bind(R.id.fab) FloatingActionButton mFab; 30 | 31 | @Override protected void onCreate(Bundle savedInstanceState) { 32 | super.onCreate(savedInstanceState); 33 | setContentView(R.layout.activity_bottom_sheet); 34 | ButterKnife.bind(this); 35 | initListView(); 36 | initListMenu(); 37 | mBottomSheetLayout.setFab(mFab); 38 | } 39 | 40 | private void initListView() { 41 | List list = new ArrayList(100); 42 | for (int i = 0; i < 100; i++) { 43 | list.add("Item " + i); 44 | } 45 | 46 | ArrayAdapter adapter = 47 | new ArrayAdapter(this, android.R.layout.simple_list_item_1, list); 48 | mObservableListView.setAdapter(adapter); 49 | } 50 | 51 | private void initListMenu() { 52 | ArrayList bottomSheets = new ArrayList<>(); 53 | bottomSheets.add( 54 | BottomSheet.to().setBottomSheetMenuType(BottomSheet.BottomSheetMenuType.EMAIL)); 55 | bottomSheets.add( 56 | BottomSheet.to().setBottomSheetMenuType(BottomSheet.BottomSheetMenuType.ACCOUNT)); 57 | bottomSheets.add( 58 | BottomSheet.to().setBottomSheetMenuType(BottomSheet.BottomSheetMenuType.SETTING)); 59 | BottomSheetAdapter adapter = new BottomSheetAdapter(this, bottomSheets); 60 | mMenuList.setAdapter(adapter); 61 | } 62 | 63 | @OnClick(R.id.fab) void onFabClick() { 64 | mBottomSheetLayout.expandFab(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /demo/src/main/java/com/bowyer/fabtransitionlayout/demo/CoordinatorLayoutActivity.java: -------------------------------------------------------------------------------- 1 | package com.bowyer.fabtransitionlayout.demo; 2 | 3 | import android.animation.Animator; 4 | import android.animation.ObjectAnimator; 5 | import android.animation.PropertyValuesHolder; 6 | import android.os.Bundle; 7 | import android.support.design.widget.FloatingActionButton; 8 | import android.support.design.widget.Snackbar; 9 | import android.support.v7.app.AppCompatActivity; 10 | import android.support.v7.widget.LinearLayoutManager; 11 | import android.support.v7.widget.RecyclerView; 12 | import android.support.v7.widget.Toolbar; 13 | import android.view.Menu; 14 | import android.view.MenuItem; 15 | import android.view.View; 16 | import android.widget.ImageView; 17 | import butterknife.Bind; 18 | import butterknife.ButterKnife; 19 | import butterknife.OnClick; 20 | import com.bowyer.app.fabtransitionlayout.FooterLayout; 21 | import com.bowyer.fabtransitionlayout.demo.adapter.RecyclerViewAdapter; 22 | import java.util.ArrayList; 23 | import java.util.List; 24 | 25 | public class CoordinatorLayoutActivity extends AppCompatActivity { 26 | 27 | @Bind(R.id.toolbar) Toolbar mToolbar; 28 | @Bind(R.id.fabtoolbar) FooterLayout mFabToolbar; 29 | @Bind(R.id.fab) FloatingActionButton mFab; 30 | @Bind(R.id.list_view) RecyclerView mListView; 31 | @Bind(R.id.ic_call) ImageView mIcCall; 32 | @Bind(R.id.ic_email) ImageView mIcEmail; 33 | @Bind(R.id.ic_forum) ImageView mIcForum; 34 | 35 | @Override protected void onCreate(Bundle savedInstanceState) { 36 | super.onCreate(savedInstanceState); 37 | setContentView(R.layout.activity_coordinator_layout); 38 | 39 | ButterKnife.bind(this); 40 | setSupportActionBar(mToolbar); 41 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 42 | 43 | initListView(); 44 | mFabToolbar.setFab(mFab); 45 | } 46 | 47 | private void initListView() { 48 | List list = new ArrayList(100); 49 | for (int i = 0; i < 100; i++) { 50 | list.add("Item " + i); 51 | } 52 | 53 | RecyclerViewAdapter adapter = new RecyclerViewAdapter(list, this.getBaseContext()); 54 | mListView.setLayoutManager(new LinearLayoutManager(this.getBaseContext())); 55 | mListView.setAdapter(adapter); 56 | } 57 | 58 | @OnClick(R.id.fab) void onFabClick() { 59 | mFabToolbar.expandFab(); 60 | } 61 | 62 | @OnClick(R.id.call) void onClickCall() { 63 | iconAnim(mIcCall); 64 | } 65 | 66 | @OnClick(R.id.ic_email) void onClickEmail() { 67 | iconAnim(mIcEmail); 68 | } 69 | 70 | @OnClick(R.id.ic_forum) void onClickForum() { 71 | iconAnim(mIcForum); 72 | } 73 | 74 | private void iconAnim(View icon) { 75 | Animator iconAnim = ObjectAnimator.ofPropertyValuesHolder(icon, 76 | PropertyValuesHolder.ofFloat(View.SCALE_X, 1f, 1.5f, 1f), 77 | PropertyValuesHolder.ofFloat(View.SCALE_Y, 1f, 1.5f, 1f)); 78 | iconAnim.start(); 79 | } 80 | 81 | @Override public boolean onCreateOptionsMenu(Menu menu) { 82 | getMenuInflater().inflate(R.menu.menu_coordinator, menu); 83 | return true; 84 | } 85 | 86 | @Override public boolean onOptionsItemSelected(MenuItem item) { 87 | 88 | int id = item.getItemId(); 89 | 90 | if (id == R.id.action_snackbar) { 91 | Snackbar.make(mListView, "This is a snackbar", Snackbar.LENGTH_SHORT).show(); 92 | return true; 93 | } 94 | 95 | return super.onOptionsItemSelected(item); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /demo/src/main/java/com/bowyer/fabtransitionlayout/demo/FabToolBarDemoActivity.java: -------------------------------------------------------------------------------- 1 | package com.bowyer.fabtransitionlayout.demo; 2 | 3 | import android.animation.Animator; 4 | import android.animation.ObjectAnimator; 5 | import android.animation.PropertyValuesHolder; 6 | import android.os.Bundle; 7 | import android.support.design.widget.FloatingActionButton; 8 | import android.support.v7.app.ActionBarActivity; 9 | import android.view.View; 10 | import android.widget.ArrayAdapter; 11 | import android.widget.ImageView; 12 | import butterknife.Bind; 13 | import butterknife.ButterKnife; 14 | import butterknife.OnClick; 15 | import com.bowyer.app.fabtransitionlayout.FooterLayout; 16 | import com.github.ksoichiro.android.observablescrollview.ObservableListView; 17 | import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks; 18 | import com.github.ksoichiro.android.observablescrollview.ScrollState; 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | /** 23 | * Created by Bowyer on 15/08/07. 24 | */ 25 | public class FabToolBarDemoActivity extends ActionBarActivity 26 | implements ObservableScrollViewCallbacks { 27 | 28 | @Bind(R.id.list_view) ObservableListView mObservableListView; 29 | 30 | @Bind(R.id.fabtoolbar) FooterLayout mFabToolbar; 31 | 32 | @Bind(R.id.fab) FloatingActionButton mFab; 33 | 34 | @Bind(R.id.ic_call) ImageView mIcCall; 35 | 36 | @Bind(R.id.ic_email) ImageView mIcEmail; 37 | 38 | @Bind(R.id.ic_forum) ImageView mIcForum; 39 | 40 | @Override protected void onCreate(Bundle savedInstanceState) { 41 | super.onCreate(savedInstanceState); 42 | setContentView(R.layout.activity_fab_toolbar); 43 | ButterKnife.bind(this); 44 | initListView(); 45 | mFabToolbar.setFab(mFab); 46 | } 47 | 48 | private void initListView() { 49 | List list = new ArrayList(100); 50 | for (int i = 0; i < 100; i++) { 51 | list.add("Item " + i); 52 | } 53 | 54 | ArrayAdapter adapter = 55 | new ArrayAdapter(this, android.R.layout.simple_list_item_1, list); 56 | mObservableListView.setAdapter(adapter); 57 | mObservableListView.setScrollViewCallbacks(this); 58 | } 59 | 60 | @Override public void onScrollChanged(int i, boolean b, boolean b1) { 61 | 62 | } 63 | 64 | @Override public void onDownMotionEvent() { 65 | 66 | } 67 | 68 | @Override public void onUpOrCancelMotionEvent(ScrollState scrollState) { 69 | if (scrollState == ScrollState.UP) { 70 | mFabToolbar.slideOutFab(); 71 | } else if (scrollState == ScrollState.DOWN) { 72 | mFabToolbar.slideInFab(); 73 | } 74 | } 75 | 76 | @OnClick(R.id.fab) void onFabClick() { 77 | mFabToolbar.expandFab(); 78 | } 79 | 80 | @OnClick(R.id.call) void onClickCall() { 81 | iconAnim(mIcCall); 82 | } 83 | 84 | @OnClick(R.id.ic_email) void onClickEmail() { 85 | iconAnim(mIcEmail); 86 | } 87 | 88 | @OnClick(R.id.ic_forum) void onClickForum() { 89 | iconAnim(mIcForum); 90 | } 91 | 92 | private void iconAnim(View icon) { 93 | Animator iconAnim = ObjectAnimator.ofPropertyValuesHolder(icon, 94 | PropertyValuesHolder.ofFloat(View.SCALE_X, 1f, 1.5f, 1f), 95 | PropertyValuesHolder.ofFloat(View.SCALE_Y, 1f, 1.5f, 1f)); 96 | iconAnim.start(); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /demo/src/main/java/com/bowyer/fabtransitionlayout/demo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.bowyer.fabtransitionlayout.demo; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.support.v7.app.ActionBarActivity; 6 | import butterknife.ButterKnife; 7 | import butterknife.OnClick; 8 | 9 | public class MainActivity extends ActionBarActivity { 10 | 11 | @Override protected void onCreate(Bundle savedInstanceState) { 12 | super.onCreate(savedInstanceState); 13 | setContentView(R.layout.activity_main); 14 | ButterKnife.bind(this); 15 | } 16 | 17 | @OnClick(R.id.start_bottom_sheet_demo) void startBottomSheetDemo() { 18 | Intent intet = new Intent(this, BottomSheetDemoActivity.class); 19 | startActivity(intet); 20 | } 21 | 22 | @OnClick(R.id.start_fab_toolbar_demo) void startFabToolbarDemo() { 23 | Intent intet = new Intent(this, FabToolBarDemoActivity.class); 24 | startActivity(intet); 25 | } 26 | 27 | @OnClick(R.id.start_coordinator_demo) void startCoordinatorDemo() { 28 | Intent intet = new Intent(this, CoordinatorLayoutActivity.class); 29 | startActivity(intet); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /demo/src/main/java/com/bowyer/fabtransitionlayout/demo/adapter/BottomSheetAdapter.java: -------------------------------------------------------------------------------- 1 | package com.bowyer.fabtransitionlayout.demo.adapter; 2 | 3 | import android.content.Context; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.BaseAdapter; 8 | import android.widget.ImageView; 9 | import android.widget.TextView; 10 | import butterknife.Bind; 11 | import butterknife.ButterKnife; 12 | import com.bowyer.fabtransitionlayout.demo.R; 13 | import com.bowyer.fabtransitionlayout.demo.model.BottomSheet; 14 | import com.squareup.picasso.Picasso; 15 | import java.util.ArrayList; 16 | 17 | /** 18 | * Created by Bowyer on 15/08/06. 19 | */ 20 | public class BottomSheetAdapter extends BaseAdapter { 21 | 22 | Context mContext; 23 | 24 | LayoutInflater mLayoutInflater = null; 25 | 26 | ArrayList mBottomSheets; 27 | 28 | public BottomSheetAdapter(Context context, ArrayList bottomSheets) { 29 | mContext = context; 30 | mBottomSheets = bottomSheets; 31 | mLayoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 32 | } 33 | 34 | @Override public int getCount() { 35 | return mBottomSheets.size(); 36 | } 37 | 38 | @Override public Object getItem(int position) { 39 | return mBottomSheets.get(position); 40 | } 41 | 42 | @Override public long getItemId(int position) { 43 | return 0; 44 | } 45 | 46 | @Override public View getView(int position, View convertView, ViewGroup parent) { 47 | ViewHolder viewHolder; 48 | if (convertView == null) { 49 | convertView = mLayoutInflater.inflate(R.layout.row_item_bottom_sheet, parent, false); 50 | viewHolder = new ViewHolder(convertView); 51 | convertView.setTag(viewHolder); 52 | } else { 53 | viewHolder = (ViewHolder) convertView.getTag(); 54 | } 55 | 56 | BottomSheet sheet = (BottomSheet) getItem(position); 57 | Picasso.with(mContext) 58 | .load(sheet.getBottomSheetMenuType().getResId()) 59 | .into(viewHolder.mMenuIcon); 60 | viewHolder.mMenuTitle.setText(sheet.getBottomSheetMenuType().getName()); 61 | return convertView; 62 | } 63 | 64 | static class ViewHolder { 65 | 66 | @Bind(R.id.menu_icon) ImageView mMenuIcon; 67 | 68 | @Bind(R.id.menu_title) TextView mMenuTitle; 69 | 70 | public ViewHolder(View view) { 71 | ButterKnife.bind(this, view); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /demo/src/main/java/com/bowyer/fabtransitionlayout/demo/adapter/RecyclerViewAdapter.java: -------------------------------------------------------------------------------- 1 | package com.bowyer.fabtransitionlayout.demo.adapter; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.TextView; 9 | import java.util.List; 10 | 11 | public class RecyclerViewAdapter extends RecyclerView.Adapter { 12 | 13 | List mList; 14 | 15 | public RecyclerViewAdapter(List list, Context context) { 16 | this.mList = list; 17 | } 18 | 19 | @Override 20 | public RecyclerViewAdapter.RecyclerHolder onCreateViewHolder(ViewGroup parent, int viewType) { 21 | View v = LayoutInflater.from(parent.getContext()) 22 | .inflate(android.R.layout.simple_list_item_1, parent, false); 23 | RecyclerHolder viewHolder = new RecyclerHolder(v); 24 | return viewHolder; 25 | } 26 | 27 | @Override public void onBindViewHolder(RecyclerViewAdapter.RecyclerHolder holder, int position) { 28 | TextView tv = (TextView) holder.itemView; 29 | tv.setText(mList.get(position)); 30 | } 31 | 32 | @Override public int getItemCount() { 33 | return mList.size(); 34 | } 35 | 36 | public static class RecyclerHolder extends RecyclerView.ViewHolder { 37 | 38 | public RecyclerHolder(View itemView) { 39 | super(itemView); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /demo/src/main/java/com/bowyer/fabtransitionlayout/demo/model/BottomSheet.java: -------------------------------------------------------------------------------- 1 | package com.bowyer.fabtransitionlayout.demo.model; 2 | 3 | import com.bowyer.fabtransitionlayout.demo.R; 4 | 5 | /** 6 | * Created by Bowyer on 15/08/06. 7 | */ 8 | public class BottomSheet { 9 | 10 | public enum BottomSheetMenuType { 11 | EMAIL(R.drawable.ic_drafts_white_24dp, "Mail"), ACCOUNT(R.drawable.ic_account_circle_white_24dp, 12 | "Acount"), SETTING(R.drawable.ic_build_white_24dp, "Setitng"); 13 | 14 | int resId; 15 | 16 | String name; 17 | 18 | BottomSheetMenuType(int resId, String name) { 19 | this.resId = resId; 20 | this.name = name; 21 | } 22 | 23 | public int getResId() { 24 | return resId; 25 | } 26 | 27 | public String getName() { 28 | return name; 29 | } 30 | } 31 | 32 | BottomSheetMenuType bottomSheetMenuType; 33 | 34 | public static BottomSheet to() { 35 | return new BottomSheet(); 36 | } 37 | 38 | public BottomSheetMenuType getBottomSheetMenuType() { 39 | return bottomSheetMenuType; 40 | } 41 | 42 | public BottomSheet setBottomSheetMenuType(BottomSheetMenuType bottomSheetMenuType) { 43 | this.bottomSheetMenuType = bottomSheetMenuType; 44 | return this; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_account_circle_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bowyer-app/FabTransitionLayout/bcd3a5e1f1f061ea3e69a295af92d86f0c22a5f3/demo/src/main/res/drawable-xhdpi/ic_account_circle_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_add_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bowyer-app/FabTransitionLayout/bcd3a5e1f1f061ea3e69a295af92d86f0c22a5f3/demo/src/main/res/drawable-xhdpi/ic_add_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_build_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bowyer-app/FabTransitionLayout/bcd3a5e1f1f061ea3e69a295af92d86f0c22a5f3/demo/src/main/res/drawable-xhdpi/ic_build_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_call_white_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bowyer-app/FabTransitionLayout/bcd3a5e1f1f061ea3e69a295af92d86f0c22a5f3/demo/src/main/res/drawable-xhdpi/ic_call_white_36dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_drafts_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bowyer-app/FabTransitionLayout/bcd3a5e1f1f061ea3e69a295af92d86f0c22a5f3/demo/src/main/res/drawable-xhdpi/ic_drafts_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_email_white_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bowyer-app/FabTransitionLayout/bcd3a5e1f1f061ea3e69a295af92d86f0c22a5f3/demo/src/main/res/drawable-xhdpi/ic_email_white_36dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_forum_white_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bowyer-app/FabTransitionLayout/bcd3a5e1f1f061ea3e69a295af92d86f0c22a5f3/demo/src/main/res/drawable-xhdpi/ic_forum_white_36dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi/ic_account_circle_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bowyer-app/FabTransitionLayout/bcd3a5e1f1f061ea3e69a295af92d86f0c22a5f3/demo/src/main/res/drawable-xxhdpi/ic_account_circle_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi/ic_add_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bowyer-app/FabTransitionLayout/bcd3a5e1f1f061ea3e69a295af92d86f0c22a5f3/demo/src/main/res/drawable-xxhdpi/ic_add_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi/ic_build_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bowyer-app/FabTransitionLayout/bcd3a5e1f1f061ea3e69a295af92d86f0c22a5f3/demo/src/main/res/drawable-xxhdpi/ic_build_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi/ic_call_white_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bowyer-app/FabTransitionLayout/bcd3a5e1f1f061ea3e69a295af92d86f0c22a5f3/demo/src/main/res/drawable-xxhdpi/ic_call_white_36dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi/ic_drafts_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bowyer-app/FabTransitionLayout/bcd3a5e1f1f061ea3e69a295af92d86f0c22a5f3/demo/src/main/res/drawable-xxhdpi/ic_drafts_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi/ic_email_white_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bowyer-app/FabTransitionLayout/bcd3a5e1f1f061ea3e69a295af92d86f0c22a5f3/demo/src/main/res/drawable-xxhdpi/ic_email_white_36dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi/ic_forum_white_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bowyer-app/FabTransitionLayout/bcd3a5e1f1f061ea3e69a295af92d86f0c22a5f3/demo/src/main/res/drawable-xxhdpi/ic_forum_white_36dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxxhdpi/ic_account_circle_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bowyer-app/FabTransitionLayout/bcd3a5e1f1f061ea3e69a295af92d86f0c22a5f3/demo/src/main/res/drawable-xxxhdpi/ic_account_circle_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxxhdpi/ic_add_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bowyer-app/FabTransitionLayout/bcd3a5e1f1f061ea3e69a295af92d86f0c22a5f3/demo/src/main/res/drawable-xxxhdpi/ic_add_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxxhdpi/ic_build_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bowyer-app/FabTransitionLayout/bcd3a5e1f1f061ea3e69a295af92d86f0c22a5f3/demo/src/main/res/drawable-xxxhdpi/ic_build_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxxhdpi/ic_call_white_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bowyer-app/FabTransitionLayout/bcd3a5e1f1f061ea3e69a295af92d86f0c22a5f3/demo/src/main/res/drawable-xxxhdpi/ic_call_white_36dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxxhdpi/ic_drafts_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bowyer-app/FabTransitionLayout/bcd3a5e1f1f061ea3e69a295af92d86f0c22a5f3/demo/src/main/res/drawable-xxxhdpi/ic_drafts_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxxhdpi/ic_email_white_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bowyer-app/FabTransitionLayout/bcd3a5e1f1f061ea3e69a295af92d86f0c22a5f3/demo/src/main/res/drawable-xxxhdpi/ic_email_white_36dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxxhdpi/ic_forum_white_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bowyer-app/FabTransitionLayout/bcd3a5e1f1f061ea3e69a295af92d86f0c22a5f3/demo/src/main/res/drawable-xxxhdpi/ic_forum_white_36dp.png -------------------------------------------------------------------------------- /demo/src/main/res/layout/activity_bottom_sheet.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | 25 | 26 | 34 | 35 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /demo/src/main/res/layout/activity_coordinator_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 16 | 17 | 24 | 25 | 26 | 27 | 33 | 34 | 43 | 44 | 53 | 54 | 59 | 60 | 67 | 68 | 76 | 77 | 78 | 85 | 86 | 94 | 95 | 96 | 103 | 104 | 112 | 113 | 114 | 115 | 116 | 117 | -------------------------------------------------------------------------------- /demo/src/main/res/layout/activity_fab_toolbar.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 14 | 15 | 27 | 28 | 36 | 37 | 41 | 42 | 48 | 49 | 55 | 56 | 64 | 65 | 66 | 72 | 73 | 81 | 82 | 83 | 89 | 90 | 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /demo/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 7 | 13 |