Skip to content

Instantly share code, notes, and snippets.

@tunjid
Last active October 16, 2018 19:03
Show Gist options
  • Save tunjid/b1a85b440b489394a47e340337187777 to your computer and use it in GitHub Desktop.
Save tunjid/b1a85b440b489394a47e340337187777 to your computer and use it in GitHub Desktop.
Java snippet to extend a FAB
private void setExtended(boolean extended, boolean force) {
if (isAnimating || (extended && isExtended() && !force)) return;
ConstraintSet set = new ConstraintSet();
set.clone(container.getContext(), extended ? R.layout.fab_extended : R.layout.fab_collapsed);
TransitionManager.beginDelayedTransition(container, new AutoTransition()
.addListener(listener).setDuration(150));
if (extended) button.setText(currentText);
else button.setText("");
set.applyTo(container);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment