I am using the following to call sub in a Gradients code module
The above code is executed on a timer tick every 1/2 second. What this does is alternate the gradient style (TOP/BOTTOM, then BOTTOM/TOP) to create somewhat of a flashing affect to call attention to the button. It may be my imagination but it seems that this constant calling to the gradient sub is using up resources.
Is there a way to save those two gradient styles to a variable that I can refer to each tick rather than executing the code each time?
B4X:
Sub flash_next_button_tick
Select btn_find_wines.tag
Case "BT"
btn_find_wines.Background=gradients.StateListDrawable(Main.theme_color_light, Main.theme_color_dark,Main.theme_color_dark, Main.theme_color_light, 5dip, "TOP_BOTTOM", "TOP_BOTTOM")
btn_find_wines.Tag="TB"
Case "TB"
btn_find_wines.Background=gradients.StateListDrawable(Main.theme_color_light, Main.theme_color_dark,Main.theme_color_dark, Main.theme_color_light, 5dip, "BOTTOM_TOP", "BOTTOM_TOP")
btn_find_wines.Tag="BT"
End Select
End Sub
The above code is executed on a timer tick every 1/2 second. What this does is alternate the gradient style (TOP/BOTTOM, then BOTTOM/TOP) to create somewhat of a flashing affect to call attention to the button. It may be my imagination but it seems that this constant calling to the gradient sub is using up resources.
Is there a way to save those two gradient styles to a variable that I can refer to each tick rather than executing the code each time?