List of usage examples for android.view.animation TranslateAnimation TranslateAnimation
public TranslateAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta)
From source file:com.univ.helsinki.app.MainActivity.java
/** * Handling of Splash screen//from ww w. j a va 2 s . c om */ private void activateSplashScreen(final View view) { // UP to DOWN Animation final float direction = -1; final float yDelta = (getScreenHeight() - (2 * view.getHeight())); final Animation animation = new TranslateAnimation(0, 0, 0, yDelta * direction); animation.setDuration(1500); animation.setAnimationListener(new AnimationListener() { public void onAnimationStart(Animation animation) { getActionBar().show(); } public void onAnimationRepeat(Animation animation) { } public void onAnimationEnd(Animation animation) { view.setVisibility(View.GONE); showTitle(); View titleView = getWindow().findViewById(android.R.id.title); if (titleView != null) { ViewParent parent = titleView.getParent(); if (parent != null && (parent instanceof View)) { View parentView = (View) parent; parentView.setVisibility(View.VISIBLE); } } } }); view.startAnimation(animation); }
From source file:com.geecko.QuickLyric.adapter.IntroScreenSlidePagerAdapter.java
public void exitAction() { Animation slideOut = new TranslateAnimation(0f, -2000f, 0f, 0f); slideOut.setInterpolator(new AccelerateInterpolator()); slideOut.setDuration(700);// w w w.j a va 2 s .c o m slideOut.setAnimationListener(new Animation.AnimationListener() { public void onAnimationEnd(Animation animation) { IntroScreenSlidePagerAdapter.this.onAnimationEnd(); } public void onAnimationRepeat(Animation animation) { } public void onAnimationStart(Animation animation) { } }); if (mActivity instanceof AboutActivity) ((AboutActivity) mActivity).setStatusBarColor(null); else MainActivity.setStatusBarColor(mActivity.getWindow(), mActivity.getTheme(), null); MainActivity.setNavBarColor(mActivity.getWindow(), mActivity.getTheme(), null); ((RelativeLayout) mPager.getParent()).startAnimation(slideOut); }
From source file:com.sno.customintegration.customswiperefreshlayout.view.CustomSwipeRefreshLayout.java
private void startScaleDownAnimation(Animation.AnimationListener listener) { // mScaleDownAnimation = new Animation() { // @Override // public void applyTransformation(float interpolatedTime, Transformation t) { // setAnimationProgress(1 - interpolatedTime); // } // };/*from w w w . ja v a 2s . c o m*/ // TODO ???mCircleView? final int deltaY = -mCircleView.getBottom(); mScaleDownAnimation = new TranslateAnimation(0, 0, 0, deltaY); mScaleDownAnimation.setDuration(500); // mScaleDownAnimation.setDuration(SCALE_DOWN_DURATION); mCircleView.setAnimationListener(listener); mCircleView.clearAnimation(); mCircleView.startAnimation(mScaleDownAnimation); }
From source file:cn.org.eshow.framwork.view.sliding.AbBottomTabView.java
/** * ??.//from w w w .j a va 2s. c o m * * @param v the v * @param startX the start x * @param toX the to x * @param startY the start y * @param toY the to y */ public void imageSlide(View v, int startX, int toX, int startY, int toY) { TranslateAnimation anim = new TranslateAnimation(startX, toX, startY, toY); anim.setDuration(100); anim.setFillAfter(true); v.startAnimation(anim); }
From source file:org.dalol.orthodoxmezmurmedia.utilities.widgets.AmharicKeyboardView.java
/** * This method is used to animate the keyboard up and down * * @param from the initialDelta/*from ww w. j a v a 2 s . com*/ * @param to the destinationDelta */ private void animateKeyboard(float from, float to) { Animation animation = new TranslateAnimation(0, 0, from, to); animation.setDuration(250L); animation.setFillAfter(false); startAnimation(animation); }
From source file:com.ibuildapp.romanblack.MultiContactsPlugin.MultiContactsPlugin.java
public void moveToLeft() { positionLayoutCenterX = moveLayout.getLeft(); TranslateAnimation animation = new TranslateAnimation(0, -positionLayoutCenterX, 0.0f, 0.0f); animation.setDuration(500);//from w w w. j a v a2 s . c om animation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { moveLayout.layout(0, 0, moveLayout.getWidth(), moveLayout.getHeight()); } @Override public void onAnimationRepeat(Animation animation) { } }); moveLayout.startAnimation(animation); }
From source file:it.unipr.ce.dsg.gamidroid.activities.NAM4JAndroidActivity.java
/** * Method to display the menu of the app. *///from w w w .j av a 2 s .co m private void displaySideMenu() { TranslateAnimation animation = null; // If it's a tablet in landscape, the menu is always displayed, else // it's activated by the user if (!isTablet || (isTablet && screenOrientation == Orientation.PORTRAIT)) { if (!showingMenu) { RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mainRL.getLayoutParams(); animation = new TranslateAnimation(0, listRL.getMeasuredWidth() - layoutParams.leftMargin, 0, 0); animation.setDuration(animationDuration); animation.setFillEnabled(true); animation.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { // At the end, set the final position as the current one RelativeLayout.LayoutParams lpList = (LayoutParams) mainRL.getLayoutParams(); lpList.setMargins(listRL.getMeasuredWidth(), 0, -listRL.getMeasuredWidth(), 0); mainRL.setLayoutParams(lpList); showingMenu = true; } }); } else { RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mainRL.getLayoutParams(); animation = new TranslateAnimation(0, -layoutParams.leftMargin, 0, 0); animation.setDuration(animationDuration); animation.setFillEnabled(true); animation.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { // At the end, set the final position as the current one RelativeLayout.LayoutParams mainContenrLP = (LayoutParams) mainRL.getLayoutParams(); mainContenrLP.setMargins(0, 0, 0, 0); mainRL.setLayoutParams(mainContenrLP); showingMenu = false; } }); } mainRL.startAnimation(animation); } else { // Showing the menu since the tablet is in landscape orientation RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mainRL.getLayoutParams(); animation = new TranslateAnimation(0, listRL.getMeasuredWidth() - layoutParams.leftMargin, 0, 0); animation.setDuration(animationDuration); animation.setFillEnabled(true); animation.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { // At the end, set the final position as the current one RelativeLayout.LayoutParams lpList = (LayoutParams) mainRL.getLayoutParams(); lpList.setMargins(listRL.getMeasuredWidth(), 0, -listRL.getMeasuredWidth(), 0); mainRL.setLayoutParams(lpList); showingMenu = true; } }); mainRL.startAnimation(animation); } }
From source file:org.digitalcampus.oppia.activity.DownloadMediaActivity.java
private void showDownloadMediaMessage() { TranslateAnimation anim = new TranslateAnimation(0, 0, -200, 0); anim.setDuration(900);/*from w ww. j a v a 2s . co m*/ missingMediaContainer.startAnimation(anim); missingMediaContainer.measure(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); ValueAnimator animator = ValueAnimator.ofInt(0, missingMediaContainer.getMeasuredHeight()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { //@Override public void onAnimationUpdate(ValueAnimator valueAnimator) { mediaList.setPadding(0, (Integer) valueAnimator.getAnimatedValue(), 0, 0); mediaList.setSelectionAfterHeaderView(); } }); animator.setStartDelay(200); animator.setDuration(700); animator.start(); }
From source file:com.ywesee.amiko.MainActivity.java
/** * Sets currently visible view/*from w w w . j av a2 s .c o m*/ * @param newCurrentView * @param withAnimation */ private void setCurrentView(View newCurrentView, boolean withAnimation) { if (mCurrentView == newCurrentView) return; // It's important to perform sanity checks on views and viewgroup if (mViewHolder != null) { // Set direction of transitation old view to new view int direction = -1; if (mCurrentView == mShowView) { direction = 1; } // Remove current view if (mCurrentView != null) { if (withAnimation == true) { TranslateAnimation animate = new TranslateAnimation(0, direction * mCurrentView.getWidth(), 0, 0); animate.setDuration(200); animate.setFillAfter(false); mCurrentView.startAnimation(animate); } mCurrentView.setVisibility(View.GONE); } // Add new view if (newCurrentView != null) { if (withAnimation == true) { TranslateAnimation animate = new TranslateAnimation(-direction * newCurrentView.getWidth(), 0, 0, 0); animate.setDuration(200); animate.setFillAfter(false); newCurrentView.startAnimation(animate); } newCurrentView.setVisibility(View.VISIBLE); } // Update currently visible view mCurrentView = newCurrentView; // Hide keyboard if (mCurrentView == mShowView) { hideSoftKeyboard(300); removeTabNavigation(); // getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); } else if (mCurrentView == mSuggestView) { restoreTabNavigation(); // getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); } } }
From source file:org.digitalcampus.oppia.activity.DownloadMediaActivity.java
private void hideDownloadMediaMessage() { TranslateAnimation anim = new TranslateAnimation(0, 0, 0, -200); anim.setDuration(900);/*from ww w .j a va2 s. co m*/ missingMediaContainer.startAnimation(anim); missingMediaContainer.measure(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); ValueAnimator animator = ValueAnimator.ofInt(missingMediaContainer.getMeasuredHeight(), 0); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { //@Override public void onAnimationUpdate(ValueAnimator valueAnimator) { mediaList.setPadding(0, (Integer) valueAnimator.getAnimatedValue(), 0, 0); mediaList.setSelectionAfterHeaderView(); } }); animator.setStartDelay(0); animator.setDuration(700); animator.start(); missingMediaContainer.setVisibility(View.GONE); }