Reputation:
Is there a feature that I can make a button clickable only when a certain condition is met?
For instance, I can ask users to swipe 10 times, and only after users swipe 10 times, a button is clickable to receive an award.
Thank you for your help in advance!
Upvotes: 0
Views: 411
Reputation: 28783
Disable the button (instead of disabled you can set isFocused = false):
button.isClickable = false
button.isEnabled = false
Add swipe-listener. Inside it increment a counter. After it becomes 10, set:
button.isClickable = true
button.isEnabled = true
Also inside a click-listener you can check the counter >= 10.
Upvotes: 1