Android library providing an implementation of the Material Design Floating Action Button Speed Dial.
- MinSdk 15
- Highly customizable (label, icon, ripple, fab and label background colors, themes support)
- Same animations as in Inbox by Gmail
- Option to have different icons for open/close state
- Optional overlay/touch guard layout
- Support for bottom, left and right menu expansion (left and right have no labels)
- Out-of-the box support for Snackbar behavior
- Optional support for
RecyclerView
andNestedScrollView
behavior - Support for VectorDrawable
- Easy to use
- Add label to main FAB (blocked by https://issuetracker.google.com/issues/77303906)
- Add FAB size option (blocked by https://issuetracker.google.com/issues/77303906)
- Clean up code
- Add Javadoc
- Write tests
- Publish first release
The request to publish this library to Jcenter is currently pending, meanwhile it is possible to use this repository:
repositories {
google()
jcenter()
maven { url 'https://dl.bintray.com/leinardi/android' }
}
Dependencies entry (latest version: ):
implementation "com.leinardi.android:speed-dial:1.0-alpha02"
Add the SpeedDialView
to your layout:
<com.leinardi.android.speeddial.SpeedDialView
android:id="@+id/speedDial"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
app:srcCompat="@drawable/ic_add_white_24dp" />
Add the items to the SpeedDialView
:
SpeedDialView speedDialView = findViewById(R.id.speedDial);
speedDialView.addFabOptionItem(
new SpeedDialActionItem.Builder(R.id.fab_link, R.drawable.ic_link_white_24dp)
.create()
);
Add the click listeners:
speedDialView.setMainFabOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (speedDialView.isFabMenuOpen()) {
speedDialView.closeOptionsMenu();
}
}
});
speedDialView.setOptionFabSelectedListener(new SpeedDialView.OnOptionFabSelectedListener() {
@Override
public void onOptionFabSelected(SpeedDialActionItem speedDialActionItem) {
switch (speedDialActionItem.getId()) {
case R.id.fab_link:
showToast("Link action clicked!");
break;
default:
break;
}
}
});
A fully working example is available here.
https://www.youtube.com/watch?v=tWowiF5ElAg
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) speedDialView.getLayoutParams();
params.setBehavior(new SpeedDialView.NoBehavior());
speedDialView.requestLayout();
See the CHANGELOG.md
This project is based on floating-action-menu by ArthurGhazaryan.
Copyright 2018 Roberto Leinardi.
Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements. See the NOTICE file distributed with this work for
additional information regarding copyright ownership. The ASF licenses this
file to you 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.