List of usage examples for android.view.animation TranslateAnimation TranslateAnimation
public TranslateAnimation(int fromXType, float fromXValue, int toXType, float toXValue, int fromYType, float fromYValue, int toYType, float toYValue)
From source file:com.example.testtab.fragment.TwitEyesPageFragment.java
public void showProgressBar(int percent) { TextView textLayer = (TextView) this.mRootView.findViewById(R.id.progress_bar); AnimationSet set = new AnimationSet(true); // ALPHA/*from w ww. ja va2 s . c o m*/ AlphaAnimation alpha; switch (percent) { case 100: alpha = new AlphaAnimation(1.0f, 0.0f); break; case 0: alpha = new AlphaAnimation(0.0f, 1.0f); break; default: alpha = new AlphaAnimation(0.8f, 1.0f); } alpha.setDuration(500); TranslateAnimation translate; float toX = ((float) percent - 100.0f) / 100.0f; float fromX = toX - 0.1f; translate = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, fromX, Animation.RELATIVE_TO_PARENT, toX, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); translate.setDuration(500); translate.setInterpolator(new BounceInterpolator()); set.addAnimation(alpha); set.addAnimation(translate); // set.setDuration(500); set.setFillBefore(true); set.setFillAfter(true); textLayer.startAnimation(set); }
From source file:org.mariotaku.gallery3d.ImageViewerGLActivity.java
private void hideBars() { if (!mShowBars || isSwiping()) return;//from w w w . ja va 2 s. c o m mShowBars = false; mActionBar.hide(); final TranslateAnimation anim = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 1); anim.setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime)); anim.setAnimationListener(new AnimationListener() { @Override public void onAnimationEnd(final Animation animation) { mMenuBar.setVisibility(View.GONE); } @Override public void onAnimationRepeat(final Animation animation) { } @Override public void onAnimationStart(final Animation animation) { } }); mMenuBar.startAnimation(anim); mHandler.removeMessages(MSG_HIDE_BARS); }
From source file:org.mariotaku.gallery3d.ImageViewerGLActivity.java
private void showBars() { if (mShowBars) return;/* w w w . j a v a 2 s. co m*/ mShowBars = true; mActionBar.show(); mMenuBar.setVisibility(View.VISIBLE); final TranslateAnimation anim = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 1, Animation.RELATIVE_TO_SELF, 0); anim.setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime)); mMenuBar.startAnimation(anim); }
From source file:com.turingtechnologies.materialscrollbar.MaterialScrollBar.java
/** * Animates the bar out of view//from w ww. j ava 2s . c o m */ private void fadeOut() { if (!hidden) { TranslateAnimation anim = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_SELF, 1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); anim.setDuration(500); anim.setFillAfter(true); hidden = true; startAnimation(anim); } }
From source file:com.sahildave.snackbar.SnackBar.java
private AnimationSet getEntryAnimation() { //In// www . java 2 s.c o m mInAnimationSet = new AnimationSet(false); TranslateAnimation mSlideInAnimation = new TranslateAnimation(TranslateAnimation.RELATIVE_TO_PARENT, 0.0f, TranslateAnimation.RELATIVE_TO_PARENT, 0.0f, TranslateAnimation.RELATIVE_TO_SELF, 1.0f, TranslateAnimation.RELATIVE_TO_SELF, 0.0f); mSlideInAnimation.setFillAfter(true); AlphaAnimation mFadeInAnimation = new AlphaAnimation(0.0f, 1.0f); mFadeInAnimation.setFillAfter(true); mInAnimationSet.addAnimation(mSlideInAnimation); mInAnimationSet.addAnimation(mFadeInAnimation); mInAnimationSet.setDuration(IN_ANIMATION_DURATION); return mInAnimationSet; }
From source file:com.turingtechnologies.materialscrollbar.MaterialScrollBar.java
/** * Animates the bar into view/*from w w w . j a va 2 s . c om*/ */ private void fadeIn() { if (hidden && hide && !totallyHidden) { hidden = false; TranslateAnimation anim = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 1.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); anim.setDuration(500); anim.setFillAfter(true); startAnimation(anim); } }
From source file:com.sahildave.snackbar.SnackBar.java
private AnimationSet getExitAnimation() { //Out// w w w .j a va 2 s . c o m mOutAnimationSet = new AnimationSet(false); TranslateAnimation mSlideOutAnimation = new TranslateAnimation(TranslateAnimation.RELATIVE_TO_PARENT, 0.0f, TranslateAnimation.RELATIVE_TO_PARENT, 0.0f, TranslateAnimation.RELATIVE_TO_SELF, 0.0f, TranslateAnimation.RELATIVE_TO_SELF, 1.0f); mSlideOutAnimation.setFillAfter(true); AlphaAnimation mFadeOutAnimation = new AlphaAnimation(1.0f, 0.0f); mFadeOutAnimation.setFillAfter(true); mOutAnimationSet.addAnimation(mSlideOutAnimation); mOutAnimationSet.addAnimation(mFadeOutAnimation); mOutAnimationSet.setDuration(OUT_ANIMATION_DURATION); return mOutAnimationSet; }
From source file:com.money.manager.ex.fragment.HomeFragment.java
public LayoutAnimationController setAnimationView(View view) { AnimationSet set = new AnimationSet(true); Animation animation = new AlphaAnimation(0.0f, 1.0f); animation.setDuration(250);// w w w .j a va2 s . c o m set.addAnimation(animation); animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 1.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f); animation.setDuration(150); set.addAnimation(animation); LayoutAnimationController controller = new LayoutAnimationController(set, 0.25f); return controller; }
From source file:com.xander.panel.PanelController.java
private Animation createPanelAnimation(int animType) { int type = TranslateAnimation.RELATIVE_TO_SELF; TranslateAnimation an = null;/*from w w w . j a va 2 s . co m*/ if (ANIM_TYPE_SHOW == animType) { if (Gravity.TOP == mGravity) { an = new TranslateAnimation(type, 0, type, 0, type, -1, type, 0); } else if (Gravity.BOTTOM == mGravity) { an = new TranslateAnimation(type, 0, type, 0, type, 1, type, 0); } } else { if (Gravity.TOP == mGravity) { an = new TranslateAnimation(type, 0, type, 0, type, 0, type, -1); } else if (Gravity.BOTTOM == mGravity) { an = new TranslateAnimation(type, 0, type, 0, type, 0, type, 1); } } an.setDuration(DURATION_TRANSLATE); an.setFillAfter(true); return an; }
From source file:de.grobox.liberario.fragments.DirectionsFragment.java
private void swapLocations() { Animation slideUp = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f); slideUp.setDuration(400);/*from ww w.j a v a2 s. c o m*/ slideUp.setFillAfter(true); slideUp.setFillEnabled(true); ui.to.startAnimation(slideUp); Animation slideDown = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 1.0f); slideDown.setDuration(400); slideDown.setFillAfter(true); slideDown.setFillEnabled(true); ui.from.startAnimation(slideDown); slideUp.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { // swap location objects Location tmp = ui.to.getLocation(); if (!ui.from.isSearching()) { ui.to.setLocation(ui.from.getLocation(), getDrawableForLocation(getContext(), ui.from.getLocation())); } else { // TODO: GPS currently only supports from location, so don't swap it for now ui.to.clearLocation(); } ui.from.setLocation(tmp, getDrawableForLocation(getContext(), tmp)); ui.from.clearAnimation(); ui.to.clearAnimation(); } }); }