Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rubensousa/FloatingToolbar
A toolbar that morphs from a FloatingActionButton
https://github.com/rubensousa/FloatingToolbar
fab floatingactionbutton floatingmenu toolbar transition
Last synced: 2 months ago
JSON representation
A toolbar that morphs from a FloatingActionButton
- Host: GitHub
- URL: https://github.com/rubensousa/FloatingToolbar
- Owner: rubensousa
- License: apache-2.0
- Created: 2016-04-24T01:49:59.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-07-28T12:01:19.000Z (over 7 years ago)
- Last Synced: 2024-11-05T03:51:29.917Z (3 months ago)
- Topics: fab, floatingactionbutton, floatingmenu, toolbar, transition
- Language: Java
- Size: 1.98 MB
- Stars: 1,550
- Watchers: 38
- Forks: 177
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-github-android-ui - FloatingToolbar - FloatingActionButton变形而来的工具栏 (Toolbar)
README
# FloatingToolbar
A toolbar that morphs from a FloatingActionButtonInspired 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:
```groovy
compile 'com.github.rubensousa:floatingtoolbar:1.5.1'
```
##### 2. Add FloatingToolbar as a direct child of CoordinatorLayout and before the FloatingActionButton:
```xml
```
##### 3. Specify a menu resource file or custom layout with app:floatingMenu or app:floatingCustomViewYou can also build a menu programmatically using FloatingToolbarMenuBuilder:
```java
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:
```java
mFloatingToolbar.attachFab(fab);
```##### 5. Set a click listener
```java
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:
```java
mFloatingToolbar.showSnackBar(snackbar);
```##### 7. (Optional) Attach a RecyclerView to hide the FloatingToolbar on scroll:
```java
mFloatingToolbar.attachRecyclerView(recyclerView);
```##### 8. (Optional) Use show() and hide() to trigger the transition anytime:
```java
mFloatingToolbar.show();
mFloatingToolbar.hide();
```
##### 9. (Optional) Add a MorphListener to listen to morph animation events```java
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)
- [EuroMillions](https://play.google.com/store/apps/details?id=io.github.rubensousa.euromillions)
## 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.