FloatingToolbar


Source link: https://github.com/rubensousa/FloatingToolbar

FloatingToolbar

A toolbar that morphs from a FloatingActionButton

Inspired by the material design spec: https://www.google.com/design/spec/components/buttons-floating-action-button.html#buttons-floating-action-button-transitions

Available from API 14.

How to use

1. Add the following to your build.gradle:
compile 'com.github.rubensousa:floatingtoolbar:1.5.1'
2. Add FloatingToolbar as a direct child of CoordinatorLayout and before the FloatingActionButton:
<android.support.design.widget.CoordinatorLayout

xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:id="@+id/coordinatorLayout"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:fitsSystemWindows="true">

 <!-- Appbar -->

<com.github.rubensousa.floatingtoolbar.FloatingToolbar

android:id="@+id/floatingToolbar"

android:layout_width="match_parent"

android:layout_height="?attr/actionBarSize"

android:layout_gravity="bottom"

app:floatingMenu="@menu/main" />

<android.support.design.widget.FloatingActionButton

android:id="@+id/fab"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_gravity="bottom|end"

android:layout_margin="@dimen/fab_margin"

android:src="@drawable/ic_share_black_24dp" />

 </android.support.design.widget.CoordinatorLayout>
3. Specify a menu resource file or custom layout with app:floatingMenu or app:floatingCustomView

You can also build a menu programmatically using FloatingToolbarMenuBuilder:

 mFloatingToolbar.setMenu(new FloatingToolbarMenuBuilder(this)

  .addItem(R.id.action_unread, R.drawable.ic_markunread_black_24dp, "Mark unread")

  .addItem(R.id.action_copy, R.drawable.ic_content_copy_black_24dp, "Copy")

  .addItem(R.id.action_google, R.drawable.ic_google_plus_box, "Google+")

  .addItem(R.id.action_facebook, R.drawable.ic_facebook_box, "Facebook")

  .addItem(R.id.action_twitter, R.drawable.ic_twitter_box, "Twitter")

  .build());
4. Attach the FAB to the FloatingToolbar to automatically start the transition on click event:
mFloatingToolbar.attachFab(fab);
5. Set a click listener
mFloatingToolbar.setClickListener(new FloatingToolbar.ItemClickListener() {

 @Override

 public void onItemClick(MenuItem item) {

}

  @Override

 public void onItemLongClick(MenuItem item) {

  
}

}
);
6. If you want to show a snackbar in the same layout as the FloatingToolbar, please use:
mFloatingToolbar.showSnackBar(snackbar);
7. (Optional) Attach a RecyclerView to hide the FloatingToolbar on scroll:
mFloatingToolbar.attachRecyclerView(recyclerView);
8. (Optional) Use show() and hide() to trigger the transition anytime:
mFloatingToolbar.show();
 mFloatingToolbar.hide();
9. (Optional) Add a MorphListener to listen to morph animation events
mFloatingToolbar.addMorphListener(new FloatingToolbar.MorphListener() {

  @Override
  public void onMorphEnd() {

  
}

@Override
  public void onMorphStart() {

}

@Override
  public void onUnmorphStart() {

}

@Override
  public void onUnmorphEnd() {

}
 
}
);

Attributes

  • app:floatingToastOnLongClick -> boolean. Defaults to true
  • app:floatingHandleFabClick -> boolean. Defaults to true
  • app:floatingMenu -> Menu resource
  • app:floatingItemBackground -> Drawable resource
  • app:floatingCustomView -> Layout resource
  • app:floatingAutoHide -> boolean. Defaults to true

Apps using FloatingToolbar (Send a PR to add your app here)

License

Copyright 2016 RĂºben Sousa  Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 

Resources

A custom view that gives the user a look and feel of selecting options with smoother slider animation.

With this SDK you can access the API behind the DRAE (Diccionario de la Real Academia Española, the official spanish dictionary) in order to use it in your own app.

Shortify is used for minimizing your coding effort in your development environment. It has some builtin method and classes which helps you in creating mostly used element and tasks in Android app.

Android library handling flashlight for camera and camera2 api. Added support for handling display/screen light.

Yet Another Android animated Seekbar inspired from Philips Hue app.

Great sound quality, audio cleanliness and very smooth interface. Playing the folder structure, artist or album or create your own playlists with local or online tracks.

  • 10-band equalizer
  • Themes
  • mp3, flac, aac, ogg, oga, m4a, m4b, m4p, wma and other audio formats

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes