List of usage examples for android.view.animation TranslateAnimation setAnimationListener
public void setAnimationListener(AnimationListener listener)
Binds an animation listener to this animation.
From source file:com.xmobileapp.rockplayer.RockPlayer.java
/******************************** * //from w w w . j a va2 s. c o m * switch between different UI modes * ********************************/ public void setNormalView() { if (VIEW_STATE == NORMAL_VIEW) { } else if (VIEW_STATE == LIST_EXPANDED_VIEW) { /* * Animate fading of the current playing layout */ /* * Put album navigator full screen (this will happen in the end of the animation) */ RelativeLayout.LayoutParams params = (LayoutParams) albumNavigatorLayoutOuter.getLayoutParams(); params.addRule(RelativeLayout.RIGHT_OF, R.id.songfest_current_playing_container); albumNavigatorLayoutOuter.setLayoutParams(params); /* * Animate growth of the album navigator */ int slideAmount = currentPlayingLayout.getWidth(); albumNavigatorLayoutOuter.bringToFront(); TranslateAnimation slideRight = new TranslateAnimation(-slideAmount, 0, 0, 0); slideRight.setFillAfter(true); slideRight.setDuration(250); slideRight.setAnimationListener(slideRightAnimationListener); albumNavigatorLayoutOuter.startAnimation(slideRight); } else if (VIEW_STATE == FULLSCREEN_VIEW) { setBackground(); AlphaAnimation fadeOut = new AlphaAnimation(1.0f, 0.0f); fadeOut.setFillAfter(true); fadeOut.setDuration(300); this.mainUIContainer.startAnimation(fadeOut); showFullScreenHandler.sendEmptyMessageDelayed(VIEW_STATE, 300); VIEW_STATE = FULLSCREEN_VIEW; } VIEW_STATE = NORMAL_VIEW; return; }
From source file:com.zoffcc.applications.zanavi.Navit.java
static void animate_bottom_bar_down() { final FrameLayout a = (FrameLayout) Global_Navit_Object.findViewById(R.id.bottom_bar_slide); // System.out.println("FRAG:animate_bottom_bar_down:014"); // set bottom end positon correctly?? bottom_y_margin_bottom_bar_touch = Navit.map_view_height + Navit.actionBarHeight + bottom_bar_px - Navit.bottom_bar_slider_shadow_px; final int move_by = (int) (bottom_y_margin_bottom_bar_touch - cur_y_margin_bottom_bar_touch); TranslateAnimation animation = new TranslateAnimation(0, 0, 0, move_by); // new TranslateAnimation(xFrom,xTo, yFrom,yTo) animation.setDuration(bottom_bar_snap_duration); // animation duration animation.setFillAfter(true);/* w w w . ja va 2 s . co m*/ animation.setFillEnabled(true); animation.setRepeatCount(0); // animation repeat count animation.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { // set bottom end positon correctly?? bottom_y_margin_bottom_bar_touch = Navit.map_view_height + Navit.actionBarHeight + bottom_bar_px - Navit.bottom_bar_slider_shadow_px; cur_y_margin_bottom_bar_touch = bottom_y_margin_bottom_bar_touch; RelativeLayout.LayoutParams relativeParams = (RelativeLayout.LayoutParams) a.getLayoutParams(); relativeParams.setMargins(0, (int) bottom_y_margin_bottom_bar_touch, 0, 0); // left, top, right, bottom a.setLayoutParams(relativeParams); a.requestLayout(); TranslateAnimation anim = new TranslateAnimation(0, 0, 0, 0); anim.setFillAfter(true); anim.setFillEnabled(true); anim.setDuration(1); a.startAnimation(anim); // remove roadbook fragment ----------- try { if (road_book != null) { FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); // System.out.println("FRAG:dettach:002"); fragmentTransaction.detach(road_book); fragmentTransaction.remove(road_book).commit(); road_book = null; } } catch (Exception ef) { } // remove roadbook fragment ----------- } }); a.startAnimation(animation); }
From source file:com.zoffcc.applications.zanavi.Navit.java
void animate_bottom_bar_up() { final FrameLayout a = (FrameLayout) findViewById(R.id.bottom_bar_slide); TranslateAnimation animation = new TranslateAnimation(0, 0, 0, -cur_y_margin_bottom_bar_touch); animation.setDuration(bottom_bar_snap_duration); // animation duration animation.setFillAfter(true);// w w w. j ava 2 s . co m animation.setFillEnabled(true); animation.setRepeatCount(0); // animation repeat count animation.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { cur_y_margin_bottom_bar_touch = 0; RelativeLayout.LayoutParams relativeParams = (RelativeLayout.LayoutParams) a.getLayoutParams(); relativeParams.setMargins(0, (int) cur_y_margin_bottom_bar_touch, 0, 0); // left, top, right, bottom a.setLayoutParams(relativeParams); a.requestLayout(); TranslateAnimation anim = new TranslateAnimation(0, 0, 0, 0); anim.setFillAfter(true); anim.setFillEnabled(true); anim.setDuration(1); a.startAnimation(anim); } }); a.startAnimation(animation); }