List of usage examples for android.view.animation Animation setFillAfter
public void setFillAfter(boolean fillAfter)
From source file:com.teitsmch.hearthmaker.MainActivity.java
private void rotate(MenuItem item) { Animation rotation = AnimationUtils.loadAnimation(this, R.anim.rotate); rotation.setFillAfter(true); item.getActionView().startAnimation(rotation); }
From source file:sjizl.com.FileUploadTest.java
public void do_animation_top(LinearLayout left_button) { float px = dipToPixels(getBaseContext(), -30); Animation animation1 = new TranslateAnimation(0, 0, -50, 0); animation1.setDuration(1000);// ww w. j a va 2 s. c o m animation1.setFillEnabled(true); animation1.setFillAfter(true); left_button.startAnimation(animation1); }
From source file:com.pursuer.reader.easyrss.VerticalSingleItemView.java
@Override public void onScrollChanged(final View view, final int x, final int y, final int oldx, final int oldy) { if (y + view.getHeight() > nextItemView.getTop() + 5) { itemViewCtrl.hideItemMenu();/*from w ww .j av a2 s. c o m*/ } else { itemViewCtrl.awakenItemMenu(); } if (lastUid != null) { final boolean shouldShowTop = (y < lastItemView.getTop() + 50); if (!showTop && shouldShowTop) { final Animation anim = AnimationUtils.loadAnimation(context, R.anim.up_arrow_anim_rev); final View img = lastItemView.findViewById(R.id.LastItemArrow); anim.setFillEnabled(true); anim.setFillAfter(true); img.startAnimation(anim); showTop = true; } else if (showTop && !shouldShowTop) { final Animation anim = AnimationUtils.loadAnimation(context, R.anim.up_arrow_anim); final View img = lastItemView.findViewById(R.id.LastItemArrow); anim.setFillEnabled(true); anim.setFillAfter(true); img.startAnimation(anim); showTop = false; } } if (nextUid != null) { final boolean shouldShowBottom = (y + view.getHeight() > nextItemView.getBottom() - 50); if (!showBottom && shouldShowBottom) { final Animation anim = AnimationUtils.loadAnimation(context, R.anim.down_arrow_anim_rev); final View img = nextItemView.findViewById(R.id.NextItemArrow); anim.setFillEnabled(true); anim.setFillAfter(true); img.startAnimation(anim); showBottom = true; } else if (showBottom && !shouldShowBottom) { final Animation anim = AnimationUtils.loadAnimation(context, R.anim.down_arrow_anim); final View img = nextItemView.findViewById(R.id.NextItemArrow); anim.setFillEnabled(true); anim.setFillAfter(true); img.startAnimation(anim); showBottom = false; } } }
From source file:ca.frozen.rpicameraviewer.activities.VideoFragment.java
@Override public void onCreate(Bundle savedInstanceState) { // configure the activity super.onCreate(savedInstanceState); // load the settings and cameras Utils.loadData();/*from www . j ava 2s . c o m*/ // get the parameters camera = getArguments().getParcelable(CAMERA); fullScreen = getArguments().getBoolean(FULL_SCREEN); // create the fade in handler and runnable fadeInHandler = new Handler(); fadeInRunner = new Runnable() { @Override public void run() { Animation fadeInName = new AlphaAnimation(0, 1); fadeInName.setDuration(FADEIN_ANIMATION_TIME); fadeInName.setFillAfter(true); Animation fadeInSnapshot = new AlphaAnimation(0, 1); fadeInSnapshot.setDuration(FADEIN_ANIMATION_TIME); fadeInSnapshot.setFillAfter(true); nameView.startAnimation(fadeInName); snapshotButton.startAnimation(fadeInSnapshot); fadeListener.onStartFadeIn(); } }; // create the fade out handler and runnable fadeOutHandler = new Handler(); fadeOutRunner = new Runnable() { @Override public void run() { Animation fadeOutName = new AlphaAnimation(1, 0); fadeOutName.setDuration(FADEOUT_ANIMATION_TIME); fadeOutName.setFillAfter(true); Animation fadeOutSnapshot = new AlphaAnimation(1, 0); fadeOutSnapshot.setDuration(FADEOUT_ANIMATION_TIME); fadeOutSnapshot.setFillAfter(true); nameView.startAnimation(fadeOutName); snapshotButton.startAnimation(fadeOutSnapshot); fadeListener.onStartFadeOut(); } }; // create the finish handler and runnable finishHandler = new Handler(); finishRunner = new Runnable() { @Override public void run() { getActivity().finish(); } }; // create the start video handler and runnable startVideoHandler = new Handler(); startVideoRunner = new Runnable() { @Override public void run() { MediaFormat format = decoder.getMediaFormat(); int videoWidth = format.getInteger(MediaFormat.KEY_WIDTH); int videoHeight = format.getInteger(MediaFormat.KEY_HEIGHT); textureView.setVideoSize(videoWidth, videoHeight); } }; }
From source file:com.soomla.example.ExampleSocialActivity.java
private void showView(final View view, boolean show) { final Animation animation = show ? AnimationUtils.makeInAnimation(view.getContext(), true) : AnimationUtils.makeOutAnimation(view.getContext(), true); animation.setFillAfter(true); animation.setDuration(500);/*from w w w . j a v a2 s. c o m*/ view.startAnimation(animation); }
From source file:ca.frozen.curlingtv.activities.VideoFragment.java
@Override public void onCreate(Bundle savedInstanceState) { // configure the activity super.onCreate(savedInstanceState); // load the settings and cameras Utils.loadData();/*www.ja v a 2 s.c o m*/ // get the parameters camera = getArguments().getParcelable(CAMERA); fullScreen = getArguments().getBoolean(FULL_SCREEN); // create the gesture recognizers simpleDetector = new GestureDetector(getActivity(), new SimpleListener()); scaleDetector = new ScaleGestureDetector(getActivity(), new ScaleListener()); // create the fade in handler and runnable fadeInHandler = new Handler(); fadeInRunner = new Runnable() { @Override public void run() { Animation fadeInName = new AlphaAnimation(0, 1); fadeInName.setDuration(FADEIN_ANIMATION_TIME); fadeInName.setFillAfter(true); Animation fadeInSnapshot = new AlphaAnimation(0, 1); fadeInSnapshot.setDuration(FADEIN_ANIMATION_TIME); fadeInSnapshot.setFillAfter(true); nameView.startAnimation(fadeInName); snapshotButton.startAnimation(fadeInSnapshot); fadeListener.onStartFadeIn(); } }; // create the fade out handler and runnable fadeOutHandler = new Handler(); fadeOutRunner = new Runnable() { @Override public void run() { Animation fadeOutName = new AlphaAnimation(1, 0); fadeOutName.setDuration(FADEOUT_ANIMATION_TIME); fadeOutName.setFillAfter(true); Animation fadeOutSnapshot = new AlphaAnimation(1, 0); fadeOutSnapshot.setDuration(FADEOUT_ANIMATION_TIME); fadeOutSnapshot.setFillAfter(true); nameView.startAnimation(fadeOutName); snapshotButton.startAnimation(fadeOutSnapshot); fadeListener.onStartFadeOut(); } }; // create the finish handler and runnable finishHandler = new Handler(); finishRunner = new Runnable() { @Override public void run() { getActivity().finish(); } }; }
From source file:org.y20k.transistor.CollectionAdapter.java
@Override public void onViewAttachedToWindow(CollectionAdapterViewHolder holder) { super.onViewAttachedToWindow(holder); Log.v(LOG_TAG + "debugCollectionView", "start onViewAttachedToWindow , getFabPlayButton().getTag=" + String.valueOf(holder.getFabPlayButton().getTag())); //restore animation if loading status FloatingActionButton fabPlayButton = holder.getFabPlayButton(); String tag = fabPlayButton.getTag() == null ? "" : fabPlayButton.getTag().toString(); if (Objects.equals(tag, LOADING_STATUS)) { Animation rotate_infinite = AnimationUtils.loadAnimation(mActivity, R.anim.rotate_infinite); rotate_infinite.setFillAfter(true); fabPlayButton.startAnimation(rotate_infinite); }/*from www. j a v a 2 s . c om*/ }
From source file:ly.kite.journey.selection.ProductOverviewFragment.java
/***************************************************** * * Called when the details control is clicked. * *****************************************************/ private void toggleSliderState() { // We want to animation the following: // - Overlaid start button fade in / out // - Sliding drawer up / down // - Open / close drawer icon rotation boolean sliderWillBeOpening = !mSlidingOverlayFrame.sliderIsExpanded(); float overlaidComponentsInitialAlpha; float overlaidComponentsFinalAlpha; float openCloseIconInitialRotation; float openCloseIconFinalRotation; if (sliderWillBeOpening) { overlaidComponentsInitialAlpha = 1f; overlaidComponentsFinalAlpha = 0f; openCloseIconInitialRotation = OPEN_CLOSE_ICON_ROTATION_UP; openCloseIconFinalRotation = OPEN_CLOSE_ICON_ROTATION_DOWN; } else {/*from w ww . j a v a 2 s . com*/ overlaidComponentsInitialAlpha = 0f; overlaidComponentsFinalAlpha = 1f; openCloseIconInitialRotation = OPEN_CLOSE_ICON_ROTATION_DOWN; openCloseIconFinalRotation = OPEN_CLOSE_ICON_ROTATION_UP; } // Create the overlaid components animation Animation overlaidComponentsAnimation = new AlphaAnimation(overlaidComponentsInitialAlpha, overlaidComponentsFinalAlpha); overlaidComponentsAnimation.setDuration(SLIDE_ANIMATION_DURATION_MILLIS); overlaidComponentsAnimation.setFillAfter(true); // Create the open/close icon animation. // The rotation is delayed, but will finish at the same time as the slide animation. Animation openCloseIconAnimation = new RotateAnimation(openCloseIconInitialRotation, openCloseIconFinalRotation, mOpenCloseDrawerIconImageView.getWidth() * 0.5f, mOpenCloseDrawerIconImageView.getHeight() * 0.5f); openCloseIconAnimation.setStartOffset(OPEN_CLOSE_ICON_ANIMATION_DELAY_MILLIS); openCloseIconAnimation.setDuration(OPEN_CLOSE_ICON_ANIMATION_DURATION_MILLIS); openCloseIconAnimation.setFillAfter(true); if (mOverlaidComponents != null) { mOverlaidComponents.setAlpha(1f); // Clear any alpha already applied mOverlaidComponents.startAnimation(overlaidComponentsAnimation); } if (mOpenCloseDrawerIconImageView != null) { mOpenCloseDrawerIconImageView.setRotation(0f); // Clear any rotation already applied mOpenCloseDrawerIconImageView.startAnimation(openCloseIconAnimation); } mSlidingOverlayFrame.animateToExpandedState(sliderWillBeOpening); }
From source file:de.wikilab.android.friendica01.activity.HomeActivity.java
protected void setMenuBarVisible(boolean v) { View leftBar = findViewById(R.id.left_bar); if (v) {//w ww.j a v a2s . c o m Animation anim1 = AnimationUtils.loadAnimation(HomeActivity.this, android.R.anim.slide_in_left); anim1.setInterpolator((new AccelerateDecelerateInterpolator())); //anim1.setFillAfter(true); leftBar.setAnimation(anim1); leftBar.setVisibility(View.VISIBLE); } else { Animation anim1 = AnimationUtils.loadAnimation(HomeActivity.this, R.anim.slide_out_left); anim1.setInterpolator((new AccelerateDecelerateInterpolator())); anim1.setFillAfter(true); leftBar.setAnimation(anim1); leftBar.setVisibility(View.GONE); } }
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 w w w. j ava 2s . c om 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(); } }); }