Advertisement
Guest User

Untitled

a guest
Jun 7th, 2013
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.36 KB | None | 0 0
  1. chrono = new Timer();
  2.  
  3. AnimationSet animationSet = new AnimationSet(true);
  4. animationSet.setFillAfter(true);
  5.  
  6. Animation anim2 = AnimationUtils.loadAnimation(RecordActivity.this, R.anim.rotate_90);
  7. animationSet.addAnimation(anim2);
  8.  
  9. int txtHeight = chronoView.getHeight();
  10. int txtWidth = chronoView.getWidth();
  11. int surfaceWidth = surfaceView.getWidth();
  12. TranslateAnimation anim = new TranslateAnimation(0,(surfaceWidth-txtWidth),0,(txtHeight/2)-10);
  13. anim.setDuration(anim2.getDuration());
  14. animationSet.addAnimation(anim);
  15.  
  16. if(animationSet != null) chronoView.startAnimation(animationSet);
  17.  
  18. chrono.scheduleAtFixedRate(new TimerTask() {
  19.  
  20.     @Override
  21.     public void run() {
  22.         Log.i(TAG,""+time);
  23.                
  24.         if(time == 5) {
  25.             runOnUiThread(new Runnable() {
  26.                 @Override
  27.                 public void run() {
  28.                     recordButton.setEnabled(true);
  29.                     recordButton.setColorFilter(Color.argb(0,155,155,155));
  30.                     chronoView.setText(secondsToString(time));
  31.                 }
  32.             });
  33.         }
  34.         else {
  35.             runOnUiThread(new Runnable() {
  36.                 @Override
  37.                 public void run() {
  38.                     chronoView.setText(secondsToString(time));
  39.                     }
  40.             });
  41.         }
  42.     time++;
  43.     }
  44. },
  45. 0,
  46. 1000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement