List of usage examples for android.view.animation Animation setAnimationListener
public void setAnimationListener(AnimationListener listener)
Binds an animation listener to this animation.
From source file:org.linphone.InCallActivity.java
public void resetControlsHidingCallBack() { if (mControlsHandler != null && mControls != null) { mControlsHandler.removeCallbacks(mControls); }/*from www . j av a2 s . co m*/ mControls = null; if (isVideoEnabled(LinphoneManager.getLc().getCurrentCall()) && mControlsHandler != null) { mControlsHandler.postDelayed(mControls = new Runnable() { public void run() { hideNumpad(); if (isAnimationDisabled) { transfer.setVisibility(View.INVISIBLE); addCall.setVisibility(View.INVISIBLE); mControlsLayout.setVisibility(View.GONE); callsList.setVisibility(View.GONE); switchCamera.setVisibility(View.INVISIBLE); numpad.setVisibility(View.GONE); options.setBackgroundResource(R.drawable.options); } else { Animation animation = slideOutTopToBottom; animation.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { video.setEnabled(false); // HACK: Used to avoid controls from being hided if video is switched while controls are hiding } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { video.setEnabled(true); // HACK: Used to avoid controls from being hided if video is switched while controls are hiding transfer.setVisibility(View.INVISIBLE); addCall.setVisibility(View.INVISIBLE); mControlsLayout.setVisibility(View.GONE); callsList.setVisibility(View.GONE); switchCamera.setVisibility(View.INVISIBLE); numpad.setVisibility(View.GONE); options.setBackgroundResource(R.drawable.options); animation.setAnimationListener(null); } }); mControlsLayout.startAnimation(animation); if (cameraNumber > 1) { switchCamera.startAnimation(slideOutBottomToTop); } } } }, SECONDS_BEFORE_HIDING_CONTROLS); } }
From source file:org.xingjitong.InCallActivity.java
public void resetControlsHidingCallBack() { if (mControlsHandler != null && mControls != null) { mControlsHandler.removeCallbacks(mControls); }/* www. j av a 2 s . c o m*/ mControls = null; if (isVideoEnabled && mControlsHandler != null) { mControlsHandler.postDelayed(mControls = new Runnable() { public void run() { hideNumpad(); if (isAnimationDisabled) { transfer.setVisibility(View.INVISIBLE); addCall.setVisibility(View.INVISIBLE); mControlsLayout.setVisibility(View.GONE); callsList.setVisibility(View.GONE); switchCamera.setVisibility(View.INVISIBLE); numpad.setVisibility(View.GONE); options.setBackgroundResource(R.drawable.options); } else { Animation animation = slideOutTopToBottom; animation.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { // video.setEnabled(false); // HACK: Used to // avoid controls from being hided if video is // switched while controls are hiding } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { // video.setEnabled(true); // HACK: Used to // avoid controls from being hided if video is // switched while controls are hiding transfer.setVisibility(View.INVISIBLE); addCall.setVisibility(View.INVISIBLE); mControlsLayout.setVisibility(View.GONE); callsList.setVisibility(View.GONE); switchCamera.setVisibility(View.INVISIBLE); numpad.setVisibility(View.GONE); options.setBackgroundResource(R.drawable.options); animation.setAnimationListener(null); } }); mControlsLayout.startAnimation(animation); if (cameraNumber > 1) { switchCamera.startAnimation(slideOutBottomToTop); } } } }, SECONDS_BEFORE_HIDING_CONTROLS); } }
From source file:org.xingjitong.InCallActivity.java
private void hideAnimatedLandscapeCallOptions() { Animation animation = slideOutTopToBottom; if (isTransferAllowed) { animation.setAnimationListener(new AnimationListener() { @Override//www . jav a2s .c o m public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { transfer.setAnimation(null); transfer.setVisibility(View.INVISIBLE); animation = AnimationUtils.loadAnimation(InCallActivity.this, R.anim.slide_out_top_to_bottom); animation.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { addCall.setVisibility(View.INVISIBLE); } }); addCall.startAnimation(animation); } }); transfer.startAnimation(animation); } else { animation.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { addCall.setVisibility(View.INVISIBLE); } }); addCall.startAnimation(animation); } }
From source file:org.linphone.InCallActivity.java
private void hideAnimatedLandscapeCallOptions() { Animation animation = slideOutTopToBottom; if (isTransferAllowed) { animation.setAnimationListener(new AnimationListener() { @Override/* w w w .ja v a 2 s.c o m*/ public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { transfer.setAnimation(null); transfer.setVisibility(View.INVISIBLE); animation = AnimationUtils.loadAnimation(InCallActivity.this, R.anim.slide_out_top_to_bottom); // Reload animation to prevent transfer button to blink animation.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { addCall.setVisibility(View.INVISIBLE); } }); addCall.startAnimation(animation); } }); transfer.startAnimation(animation); } else { animation.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { addCall.setVisibility(View.INVISIBLE); } }); addCall.startAnimation(animation); } }
From source file:es.usc.citius.servando.calendula.fragments.ScheduleTimetableFragment.java
private void showBox(final View v) { v.setVisibility(View.VISIBLE); Animation a = AnimationUtils.loadAnimation(getActivity(), R.anim.anim_scheule_box_slide_up); scrollView.postDelayed(new Runnable() { @Override//from www . jav a2 s . c o m public void run() { scrollView.smoothScrollBy(0, 1000); // ensure scroll bottom } }, 200); a.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); v.startAnimation(a); }
From source file:com.scoreflex.ScoreflexView.java
/** * Closes this ScoreflexView. If the view is attached to the developer * hierarchy it will be detached. If the view is attached to a * ScoreflexActivity, this activity will be terminated. *//*from w w w.ja v a 2s. co m*/ public void close() { // If we're displayed in the developer view hierarchy, // remove ourselves. final ViewParent parent = this.getParent(); ViewGroup.LayoutParams currentLayoutParams = getLayoutParams(); boolean isFullscreen = currentLayoutParams.height == LayoutParams.MATCH_PARENT; LocalBroadcastManager.getInstance(getContext()).unregisterReceiver(mLoginReceiver); if (isFullscreen && null != parent && parent instanceof ViewGroup) { int gravity = getLayoutGravity(); int anim = (Gravity.TOP == (gravity & Gravity.VERTICAL_GRAVITY_MASK)) ? R.anim.scoreflex_exit_slide_up : R.anim.scoreflex_exit_slide_down; Animation animation = AnimationUtils.loadAnimation(mParentActivity, anim); animation.setAnimationListener(new AnimationListener() { @Override public void onAnimationEnd(Animation arg0) { ViewGroup parentGroup = (ViewGroup) parent; parentGroup.removeView(ScoreflexView.this); if (mScoreflexViewHandler != null) { mScoreflexViewHandler.onViewClosed(); mScoreflexViewHandler = null; } } @Override public void onAnimationRepeat(Animation arg0) { } @Override public void onAnimationStart(Animation arg0) { } }); startAnimation(animation); } else if (null != parent && parent instanceof ViewGroup) { ViewGroup parentGroup = (ViewGroup) parent; parentGroup.removeView(this); if (mScoreflexViewHandler != null) { mScoreflexViewHandler.onViewClosed(); mScoreflexViewHandler = null; } } }
From source file:com.kkbox.toolkit.app.KKFragment.java
@Override public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) { animationEnded = false;/*from w ww . j ava2s .c o m*/ Animation animation = null; if (enter && customEnterAnimation != 0) { animation = AnimationUtils.loadAnimation(activity, customEnterAnimation); } else if (!enter && customExitAnimation != 0) { animation = AnimationUtils.loadAnimation(activity, customExitAnimation); } else if (animationType == AnimationType.POP) { if (enter) { animation = AnimationUtils.loadAnimation(activity, R.anim.slide_in_left); } else { animation = AnimationUtils.loadAnimation(activity, R.anim.slide_out_right); } } else if (animationType == AnimationType.PUSH) { if (enter) { animation = AnimationUtils.loadAnimation(activity, R.anim.slide_in_right); } else { animation = AnimationUtils.loadAnimation(activity, R.anim.slide_out_left); } } else if (animationType == AnimationType.FADE_OUT) { if (enter) { animation = AnimationUtils.loadAnimation(activity, R.anim.fade_in); } else { animation = AnimationUtils.loadAnimation(activity, R.anim.fade_out); } } else if (animation == null) { animation = new Animation() { }; animation.setDuration(0); } animation.setAnimationListener(new AnimationListener() { @Override public void onAnimationEnd(Animation a) { animationEnded = true; if (dataFetchedStatus == DataFetchStatus.SUCCESS && !uiLoaded) { onLoadUI(); } } @Override public void onAnimationStart(Animation a) { } @Override public void onAnimationRepeat(Animation a) { } }); return animation; }
From source file:android.support.v7.app.MediaRouteControllerDialog.java
private void fadeInAddedRoutes() { Animation.AnimationListener listener = new Animation.AnimationListener() { @Override//w w w .j a va 2s .c o m public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { finishAnimation(true); } @Override public void onAnimationRepeat(Animation animation) { } }; boolean listenerRegistered = false; int first = mVolumeGroupList.getFirstVisiblePosition(); for (int i = 0; i < mVolumeGroupList.getChildCount(); ++i) { View view = mVolumeGroupList.getChildAt(i); int position = first + i; MediaRouter.RouteInfo route = mVolumeGroupAdapter.getItem(position); if (mGroupMemberRoutesAdded.contains(route)) { Animation alphaAnim = new AlphaAnimation(0.0f, 1.0f); alphaAnim.setDuration(mGroupListFadeInDurationMs); alphaAnim.setFillEnabled(true); alphaAnim.setFillAfter(true); if (!listenerRegistered) { listenerRegistered = true; alphaAnim.setAnimationListener(listener); } view.clearAnimation(); view.startAnimation(alphaAnim); } } }
From source file:com.segma.trim.MainActivity.java
private void showWarning(final String string) { //(findViewById(R.id.bt_go)).setEnabled(false); //(findViewById(R.id.save_file)).setEnabled(false); //textView.setEnabled(false); lockScreen();// www . j a v a 2 s . com final Animation in = new AlphaAnimation(0f, 1f) { { setDuration(250); } }; final Animation out = new AlphaAnimation(1f, 0f) { { setDuration(250); } }; out.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { textView.setText(string); textView.startAnimation(in); } @Override public void onAnimationRepeat(Animation animation) { } }); in.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { if (!textView.getText().toString().equals(WARNING_NO_IMAGE_IMPORTED)) { //textView.setEnabled(true); //(findViewById(R.id.bt_go)).setEnabled(true); //(findViewById(R.id.save_file)).setEnabled(true); unlockScreen(); } } @Override public void onAnimationRepeat(Animation animation) { } }); textView.startAnimation(out); new Handler().postDelayed(new Runnable() { @Override public void run() { out.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { textView.setText(MESSAGE_STARTUP); textView.startAnimation(in); } @Override public void onAnimationRepeat(Animation animation) { } }); textView.startAnimation(out); } }, 1500); }
From source file:com.yahala.ui.LaunchActivity.java
public void checkConnectionState() { final Animation animScalin; try {/*from ww w . j a v a 2 s. c om*/ final Animation animScalout; animScalin = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_down); animScalin.setFillEnabled(true); animScalin.setFillAfter(true); animScalin.setFillBefore(true); animScalout = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_up); animScalout.setFillEnabled(true); animScalout.setFillAfter(true); animScalout.setStartOffset(3000); connectionStatusLayout.setVisibility(View.VISIBLE); connectionStatusLayout.setAlpha(1); isVisible = true; animScalout.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { isVisible = false; } @Override public void onAnimationEnd(Animation animation) { isVisible = false; connectionStatusLayout.setVisibility(View.GONE); connectionStatusLayout.setAlpha(0); } @Override public void onAnimationRepeat(Animation animation) { } }); // connectionStatusLayout.startAnimation(animScalin); if (XMPPManager.getInstance().connectionState == ConnectionState.ONLINE) { connectionStatus.setText(LocaleController.getString("WaitingForNetwork", R.string.Updating)); connectionStatusLayout.startAnimation(animScalout); } else if (XMPPManager.getInstance().connectionState == ConnectionState.RECONNECT_NETWORK) { connectionStatusLayout.startAnimation(animScalin); connectionStatus .setText(LocaleController.getString("WaitingForNetwork", R.string.WaitingForNetwork)); } else if (XMPPManager.getInstance().connectionState == ConnectionState.DISCONNECTED) { connectionStatusLayout.startAnimation(animScalin); connectionStatus .setText(LocaleController.getString("WaitingForNetwork", R.string.WaitingForNetwork)); } else if (XMPPManager.getInstance().connectionState == ConnectionState.RECONNECT_DELAYED) { connectionStatusLayout.startAnimation(animScalin); connectionStatus .setText(LocaleController.getString("WaitingForNetwork", R.string.WaitingForNetwork)); } else if (XMPPManager.getInstance().connectionState == ConnectionState.CONNECTING) { connectionStatusLayout.startAnimation(animScalin); connectionStatus.setText(LocaleController.getString("WaitingForNetwork", R.string.Connecting)); } } catch (Exception e) { FileLog.e("Yahala", e); } }