Last active
October 16, 2018 19:03
-
-
Save tunjid/b1a85b440b489394a47e340337187777 to your computer and use it in GitHub Desktop.
Java snippet to extend a FAB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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