Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void BlinkFrec(final boolean status) {
- // final LinearLayout layout = (LinearLayout) findViewById(R.id.layout);
- rl_main_dash = (RelativeLayout) findViewById(R.id.rl_main_dash);
- if (drawable == null) {
- drawable = new AnimationDrawable();
- drawable.addFrame(new ColorDrawable(R.color.dark_gray), 400);
- drawable.addFrame(new ColorDrawable(Color.GREEN), 400);
- drawable.setOneShot(false);
- runOnUiThread(new Runnable() {
- @Override
- public void run() {
- rl_main_dash.setBackground(drawable);
- }
- });
- }
- Runnable runnableBlink = new Runnable() {
- @Override
- public void run() {
- if (status) {
- if (!drawable.isRunning()) {
- drawable.start();
- }
- } else {
- if (drawable.isRunning()) {
- drawable.stop();
- }
- }
- }
- };
- if (handlerBlink == null) {
- handlerBlink = new Handler(mContextDash.getMainLooper());
- }
- handlerBlink.post(runnableBlink);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement