add animation
git-svn-id: https://osmand.googlecode.com/svn/trunk@756 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
parent
e636efaf03
commit
a8d4500d0b
1 changed files with 21 additions and 66 deletions
|
@ -23,7 +23,9 @@ import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.widget.Button;
|
import android.view.animation.AccelerateInterpolator;
|
||||||
|
import android.view.animation.Animation;
|
||||||
|
import android.view.animation.TranslateAnimation;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
public class MainMenuActivity extends Activity {
|
public class MainMenuActivity extends Activity {
|
||||||
|
@ -86,77 +88,30 @@ public class MainMenuActivity extends Activity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Animation getAnimation(boolean left){
|
||||||
|
Animation anim = new TranslateAnimation(TranslateAnimation.RELATIVE_TO_SELF, left ? -1 : 1,
|
||||||
|
TranslateAnimation.RELATIVE_TO_SELF, 0, TranslateAnimation.RELATIVE_TO_SELF, 0, TranslateAnimation.RELATIVE_TO_SELF, 0);
|
||||||
|
anim.setDuration(700);
|
||||||
|
anim.setInterpolator(new AccelerateInterpolator());
|
||||||
|
return anim;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
setContentView(R.layout.menu);
|
setContentView(R.layout.menu);
|
||||||
/* if(Version.VELCOM_EDITION){
|
|
||||||
final ImageView imgView = (ImageView) findViewById(R.id.VelcomMini);
|
|
||||||
final Camera camera = new Camera();
|
|
||||||
final float firstRotate = 0.25f;
|
|
||||||
final float invisibleText = 0.7f;
|
|
||||||
final int animationTime = 3600;
|
|
||||||
Animation ra = new Animation(){
|
|
||||||
@Override
|
|
||||||
protected void applyTransformation(float interpolatedTime, Transformation t) {
|
|
||||||
final Matrix matrix = t.getMatrix();
|
|
||||||
int centerY = imgView.getHeight() / 2;
|
|
||||||
int centerX = imgView.getWidth() / 2;
|
|
||||||
camera.save();
|
|
||||||
if (interpolatedTime < firstRotate) {
|
|
||||||
camera.rotateY(360 * interpolatedTime / firstRotate);
|
|
||||||
} else if (interpolatedTime < 2 * firstRotate) {
|
|
||||||
camera.rotateY(360 * (interpolatedTime - firstRotate) / firstRotate);
|
|
||||||
} else {
|
|
||||||
camera.rotateY(360 * (interpolatedTime - 2 * firstRotate) / (1 - 2 * firstRotate));
|
|
||||||
}
|
|
||||||
|
|
||||||
camera.getMatrix(matrix);
|
View leftview = (View) findViewById(R.id.MapButton);
|
||||||
matrix.preTranslate(-centerX, -centerY);
|
leftview.startAnimation(getAnimation(true));
|
||||||
matrix.postTranslate(centerX, centerY);
|
leftview = (View) findViewById(R.id.FavoritesButton);
|
||||||
camera.restore();
|
leftview.startAnimation(getAnimation(true));
|
||||||
}
|
|
||||||
};
|
|
||||||
// let accelerate animation
|
|
||||||
// ra.setInterpolator(new LinearInterpolator());
|
|
||||||
ra.setDuration(animationTime);
|
|
||||||
imgView.startAnimation(ra);
|
|
||||||
|
|
||||||
final TextView textView = (TextView) findViewById(R.id.TextVelcom);
|
View rightview = (View) findViewById(R.id.SettingsButton);
|
||||||
Animation alphaAnimation = new Animation(){
|
rightview.startAnimation(getAnimation(false));
|
||||||
@Override
|
rightview = (View) findViewById(R.id.SearchButton);
|
||||||
protected void applyTransformation(float interpolatedTime, Transformation t) {
|
rightview.startAnimation(getAnimation(false));
|
||||||
if(interpolatedTime < invisibleText){
|
|
||||||
t.setAlpha(0);
|
|
||||||
} else {
|
|
||||||
t.setAlpha((interpolatedTime - invisibleText) / (1 - invisibleText));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
alphaAnimation.setAnimationListener(new Animation.AnimationListener(){
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAnimationEnd(Animation animation) {
|
|
||||||
textView.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAnimationRepeat(Animation animation) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAnimationStart(Animation animation) {
|
|
||||||
textView.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
alphaAnimation.setDuration(animationTime);
|
|
||||||
textView.startAnimation(alphaAnimation);
|
|
||||||
textView.setVisibility(View.INVISIBLE);
|
|
||||||
} else { */
|
|
||||||
|
|
||||||
final TextView textView = (TextView) findViewById(R.id.TextVersion);
|
final TextView textView = (TextView) findViewById(R.id.TextVersion);
|
||||||
textView.setText(Version.APP_VERSION+ " "+ Version.APP_DESCRIPTION); //$NON-NLS-1$
|
textView.setText(Version.APP_VERSION+ " "+ Version.APP_DESCRIPTION); //$NON-NLS-1$
|
||||||
|
|
Loading…
Reference in a new issue