-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Change Boom Buttons Dynamically
Sometimes you may wanna change the contents, like image, text, etc, on the boom-buttons when they're already boomed out. This feature is not support until version 2.0.9.
From version 2.0.9, you can change contents in boom-buttons by changing them in builder:
builder.normalText("Changed!");
builder.normalTextColor(Color.YELLOW);
The text and its color will be changed even when the boom-button is boomed. In this way, the new attributes of the boom-button are stored in builders too, which means the next time when the boom-buttons boom, the contents are the new ones. Check the demo activity for more details.
But notice, not every method can do that magic! Only the methods of builder whose comment contains a Synchronicity
tag can meet the demand:
The lazy developer will make all methods to support this feature as soon as possible. If you found some methods should support that but not, tell the developer in issues.
You can get the children views of a boom button by the following codes:
BoomButton boomButton = bmb.getBoomButton(i);
if (boomButton == null) continue;
ImageView image = boomButton.getImageView();
if (image != null) image.setImageResource(BuilderManager.getImageResource());
TextView text = boomButton.getTextView();
if (text != null) text.setText("I'm changed!");
TextView subText = boomButton.getSubTextView();
if (subText != null) subText.setText("I'm changed, too!");
Notice that the children views and the boom button itself maybe null because boom buttons are cleared in some situation(in list, in fragment, etc.). So you have to check whether they are available. In this way, the attributes are NOT stored in builders. So the next time when booming, the contents may be the old ones, if the attributes-changed-boom-buttons are recovered.
- Basic Usage
- Simple Circle Button
- Text Inside Circle Button
- Text Outside Circle Button
- Ham Button
- Share Style
- Custom Position
- Button Place Alignments
- Different Ways to Boom
- Ease Animations for Buttons
- Different Order for Buttons
- Other Animations Attributes for Buttons
- Click Event and Listener
- Control BMB
- Use BMB in Action Bar
- Use BMB in Tool Bar
- Use BMB in List
- Use BMB in Fragment
- Attributes for BMB or Pieces on BMB
- Cache Optimization & Boom Area
- Change Boom Buttons Dynamically
- Fade Views
- Version History
- Structure for BMB