Android TV exit program Animation

Source: Internet
Author: User

Package gongzibai. co. cc;

Import android. graphics. Matrix;
Import android. view. animation. AccelerateDecelerateInterpolator;
Import android. view. animation. Animation;
Import android. view. animation. Transformation;

Public class TV extends Animation {
Private int halfWidth;
Private int halfHeight;

@ Override
Public void initialize (int width, int height, int parentWidth,
Int parentHeight ){
// TODO Auto-generated method stub
Super. initialize (width, height, parentWidth, parentHeight );
SetDuration (800 );
SetFillAfter (true );
// Save the center of the View
HalfWidth = width/2;
HalfHeight = height/2;
SetInterpolator (new AccelerateDecelerateInterpolator ());

}

@ Override
Protected void applyTransformation (float interpolatedTime, Transformation t ){
// TODO Auto-generated method stub
Super. applyTransformation (interpolatedTime, t );
Final Matrix matrix = t. getMatrix ();
If (interpolatedTime <0.8 ){
Matrix. preScale (1 + 0.625f * interpolatedTime,
1-interpolatedTime/0.8f + 0.01f, halfWidth, halfHeight );
} Else {
Matrix. preScale (7.5f * (1-interpolatedTime), 0.01f, halfWidth,
HalfHeight );

}
}
}

 

-------- Used with the Timer:
MLinearLayout. startAnimation (new TVOffAnimation ());
New Timer (). schedule (new TimerTask (){

@ Override
Public void run (){
// TODO Auto-generated method stub
Android. OS. Process. killProcess (android. OS. Process. myPid ());

}
},1000 );

 

 

From the column of gongzibai

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.