android.support.annotation.AnimRes Java Examples

The following examples show how to use android.support.annotation.AnimRes. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: AndroidUtilCode   Author: Blankj   File: ActivityUtils.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Finish to the activity.
 *
 * @param activity      The activity.
 * @param isIncludeSelf True to include the activity, false otherwise.
 * @param enterAnim     A resource ID of the animation resource to use for the
 *                      incoming activity.
 * @param exitAnim      A resource ID of the animation resource to use for the
 *                      outgoing activity.
 */
public static boolean finishToActivity(@NonNull final Activity activity,
                                       final boolean isIncludeSelf,
                                       @AnimRes final int enterAnim,
                                       @AnimRes final int exitAnim) {
    List<Activity> activities = UtilsBridge.getActivityList();
    for (Activity act : activities) {
        if (act.equals(activity)) {
            if (isIncludeSelf) {
                finishActivity(act, enterAnim, exitAnim);
            }
            return true;
        }
        finishActivity(act, enterAnim, exitAnim);
    }
    return false;
}
 
Example #2
Source Project: scene   Author: bytedance   File: PopOptions.java    License: Apache License 2.0 5 votes vote down vote up
@NonNull
public PopOptions.Builder setAnimation(@NonNull Activity activity,
                                       @AnimRes @AnimatorRes int enterAnim,
                                       @AnimRes @AnimatorRes int exitAnim) {
    this.mNavigationAnimationExecutor = new AnimationOrAnimatorResourceExecutor(activity, enterAnim, exitAnim);
    return this;
}
 
Example #3
Source Project: android_9.0.0_r45   Author: lulululbj   File: NavOptions.java    License: Apache License 2.0 5 votes vote down vote up
NavOptions(int launchMode, @IdRes int popUpTo, boolean popUpToInclusive,
        @AnimRes @AnimatorRes int enterAnim, @AnimRes @AnimatorRes int exitAnim,
        @AnimRes @AnimatorRes int popEnterAnim, @AnimRes @AnimatorRes int popExitAnim) {
    mLaunchMode = launchMode;
    mPopUpTo = popUpTo;
    mPopUpToInclusive = popUpToInclusive;
    mEnterAnim = enterAnim;
    mExitAnim = exitAnim;
    mPopEnterAnim = popEnterAnim;
    mPopExitAnim = popExitAnim;
}
 
Example #4
Source Project: AndroidChromium   Author: JackyAndroid   File: CustomTabsIntent.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Sets the exit animations.
 *
 * @param context Application context.
 * @param enterResId Resource ID of the "enter" animation for the application.
 * @param exitResId Resource ID of the "exit" animation for the browser.
 */
public Builder setExitAnimations(
        @NonNull Context context, @AnimRes int enterResId, @AnimRes int exitResId) {
    Bundle bundle = ActivityOptionsCompat.makeCustomAnimation(
            context, enterResId, exitResId).toBundle();
    mIntent.putExtra(EXTRA_EXIT_ANIMATION_BUNDLE, bundle);
    return this;
}
 
Example #5
Source Project: ZZShow   Author: LuoboDcom   File: BaseRecyclerViewAdapter.java    License: Apache License 2.0 5 votes vote down vote up
/**
 *  item 加载动画
 * @param holder
 * @param position
 * @param type
 */
protected void setItemAppearAnimation(RecyclerView.ViewHolder holder, int position, @AnimRes int type){
    if(position > mLastPosition){
        Animation animation = AnimationUtils.loadAnimation(holder.itemView.getContext(),type);
        holder.itemView.startAnimation(animation);
        mLastPosition = position;
    }
}
 
Example #6
Source Project: PermissMe   Author: tumblr   File: PermissMe.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Launches the intent passed in and deals with any of the parameters specified
 *
 * @param activityIntent
 * 		the activity intent to launch
 * @param callerActivity
 * 		the caller activity to launch the intent with
 * @param launchOptionsBundle
 * 		Additional options for how the Activity should be started, passed in through
 * 		{@link AppCompatActivity#startActivity(Intent, Bundle)} or
 * 		{@link AppCompatActivity#startActivityForResult(Intent, int, Bundle)}
 * @param targetFragment
 * 		a target fragment if specified to receive the callback
 * 		{@link AppCompatActivity#onActivityResult(int, int, Intent)} with the specified request code parameter
 * @param enterAnim
 * 		the res id of the activity-enter animation, 0 if none specified
 * @param exitAnim
 * 		the res id of the activity-exit animation, 0 if none specified
 * @param requestCode
 * 		the request code to start the destination activity with
 * 		{@link AppCompatActivity#startActivityForResult(Intent, int)}
 * @param shouldFinishActivityAfterResult
 * 		boolean whether should finish the caller activity after launching the
 */
@SuppressWarnings("checkstyle:parameternumber")
@VisibleForTesting
/*package*/ static void launchIntentWithParameters(@NonNull final Intent activityIntent,
                                                   @NonNull final AppCompatActivity callerActivity,
                                                   @Nullable final Bundle launchOptionsBundle,
                                                   @Nullable final Fragment targetFragment,
                                                   @AnimRes final int enterAnim,
                                                   @AnimRes final int exitAnim,
                                                   final int requestCode,
                                                   final boolean shouldFinishActivityAfterResult) {
	// Launch the activity on the main thread incase there are some animations the caller wants executed
	PermissMeUtils.runOnUiThread(new Runnable() {
		@Override
		public void run() {
			if (requestCode != 0) {
				if (targetFragment != null) {
					targetFragment.startActivityForResult(activityIntent, requestCode, launchOptionsBundle);
				} else {
					callerActivity.startActivityForResult(activityIntent, requestCode, launchOptionsBundle);
				}
			} else {
				callerActivity.startActivity(activityIntent, launchOptionsBundle);
			}

			if (enterAnim != 0 || exitAnim != 0) {
				PermissMe.overrideDefaultTransition(callerActivity, enterAnim, exitAnim);
			}

			if (shouldFinishActivityAfterResult) {
				callerActivity.finish();
			}
		}
	});
}
 
Example #7
Source Project: SweetTips   Author: HuanHaiLiuXin   File: SweetToast.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 设置当前SweetToast实例的出入场动画(App中自定义)
 * @param animEnter
 * @param animExit
 * @return
 */
public SweetToast setAnimations(@AnimRes int animEnter,@AnimRes int animExit){
    try {
        Animation enter = AnimationUtils.loadAnimation(mContentView.getContext(),animEnter);
        Animation exit = AnimationUtils.loadAnimation(mContentView.getContext(),animExit);
        return setAnimations(enter,exit);
    }catch (Exception e){
        //用户传入的动画资源找不到/出现异常,直接返回
        Log.e("幻海流心","setAnimations ->  e:"+e.getLocalizedMessage());
        return this;
    }
}
 
Example #8
Source Project: PowerFileExplorer   Author: PowerExplorer   File: FinestWebView.java    License: GNU General Public License v3.0 5 votes vote down vote up
public Builder setCustomAnimations(@AnimRes int animationOpenEnter,
								   @AnimRes int animationOpenExit, @AnimRes int animationCloseEnter,
								   @AnimRes int animationCloseExit) {
	this.animationOpenEnter = animationOpenEnter;
	this.animationOpenExit = animationOpenExit;
	this.animationCloseEnter = animationCloseEnter;
	this.animationCloseExit = animationCloseExit;
	return this;
}
 
Example #9
Source Project: TextBannerView   Author: ChessLuo   File: TextBannerView.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 设置进入动画和离开动画
 *
 * @param inAnimResId  进入动画的resID
 * @param outAnimResID 离开动画的resID
 */
private void setInAndOutAnimation(@AnimRes int inAnimResId, @AnimRes int outAnimResID) {
    Animation inAnim = AnimationUtils.loadAnimation(getContext(), inAnimResId);
    inAnim.setDuration(animDuration);
    mViewFlipper.setInAnimation(inAnim);

    Animation outAnim = AnimationUtils.loadAnimation(getContext(), outAnimResID);
    outAnim.setDuration(animDuration);
    mViewFlipper.setOutAnimation(outAnim);
}
 
Example #10
Source Project: AndroidUtilCode   Author: Blankj   File: ActivityUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Start the activity for result.
 *
 * @param extras      The Bundle of extras to add to this intent.
 * @param pkg         The name of the package.
 * @param cls         The name of the class.
 * @param requestCode if &gt;= 0, this code will be returned in
 *                    onActivityResult() when the activity exits.
 * @param enterAnim   A resource ID of the animation resource to use for the
 *                    incoming activity.
 * @param exitAnim    A resource ID of the animation resource to use for the
 *                    outgoing activity.
 */
public static void startActivityForResult(@NonNull final Bundle extras,
                                          @NonNull final Activity activity,
                                          @NonNull final String pkg,
                                          @NonNull final String cls,
                                          final int requestCode,
                                          @AnimRes final int enterAnim,
                                          @AnimRes final int exitAnim) {
    startActivityForResult(activity, extras, pkg, cls,
            requestCode, getOptionsBundle(activity, enterAnim, exitAnim));
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
        activity.overridePendingTransition(enterAnim, exitAnim);
    }
}
 
Example #11
Source Project: MultiContactPicker   Author: broakenmedia   File: MultiContactPicker.java    License: Apache License 2.0 5 votes vote down vote up
public Builder setActivityAnimations(@AnimRes Integer animationOpenEnter, @AnimRes Integer animationOpenExit, @AnimRes Integer animationCloseEnter, @AnimRes Integer
        animationCloseExit){
    this.animationOpenEnter = animationOpenEnter;
    this.animationOpenExit = animationOpenExit;
    this.animationCloseEnter = animationCloseEnter;
    this.animationCloseExit = animationCloseExit;
    return this;
}
 
Example #12
Source Project: FragmentStack   Author: Mr-wangyong   File: StackManager.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Set page switch animation
 *
 * @param nextIn  The next page to enter the animation
 * @param nextOut The next page out of the animation
 * @param quitIn  The current page into the animation
 * @param quitOut Exit animation for the current page
 */
public void setAnim(@AnimRes int nextIn, @AnimRes int nextOut, @AnimRes int quitIn, @AnimRes int quitOut) {
    this.nextIn = nextIn;
    this.nextOut = nextOut;
    this.quitIn = quitIn;
    this.quitOut = quitOut;
    next_in = AnimationUtils.loadAnimation(context, quitIn);
    next_out = AnimationUtils.loadAnimation(context, quitOut);
}
 
Example #13
Source Project: AndroidUtilCode   Author: Blankj   File: ActivityUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Finish the activities whose type not equals the activity class.
 *
 * @param clz       The activity class.
 * @param enterAnim A resource ID of the animation resource to use for the
 *                  incoming activity.
 * @param exitAnim  A resource ID of the animation resource to use for the
 *                  outgoing activity.
 */
public static void finishOtherActivities(@NonNull final Class<? extends Activity> clz,
                                         @AnimRes final int enterAnim,
                                         @AnimRes final int exitAnim) {
    List<Activity> activities = UtilsBridge.getActivityList();
    for (Activity act : activities) {
        if (!act.getClass().equals(clz)) {
            finishActivity(act, enterAnim, exitAnim);
        }
    }
}
 
Example #14
Source Project: flowr   Author: Fueled   File: Flowr.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Set a Custom Animation to a Fragment transaction.
 *
 * @param enterAnim    The animation resource to be used when the next fragment enters.
 * @param exitAnim     The animation resource to be used when the current fragment exits.
 * @param popEnterAnim The animation resource to be used when the previous fragment enters on back pressed.
 * @param popExitAnim  The animation resource to be used when the current fragment exits on back pressed..
 */
public Builder setCustomTransactionAnimation(@AnimRes int enterAnim, @AnimRes int exitAnim,
                                             @AnimRes int popEnterAnim, @AnimRes int popExitAnim) {
    data.setEnterAnim(enterAnim);
    data.setExitAnim(exitAnim);
    data.setPopEnterAnim(popEnterAnim);
    data.setPopExitAnim(popExitAnim);
    return this;

}
 
Example #15
Source Project: SweetTips   Author: HuanHaiLiuXin   File: SnackbarUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 设置SweetSnackbar实例的 入场动画 及 离场动画
 * @param animateIn
 * @param animateOut
 * @return
 */
public SnackbarUtils anim(@AnimRes int animateIn, @AnimRes int animateOut){
    if(getSnackbar()!=null){
        getSnackbar().setAnimations(animateIn,animateOut);
    }
    return this;
}
 
Example #16
Source Project: SweetTips   Author: HuanHaiLiuXin   File: SweetToast.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 设置当前SweetToast实例的出入场动画(App中自定义)
 * @param animEnter
 * @param animExit
 * @return
 */
public SweetToast setAnimations(@AnimRes int animEnter,@AnimRes int animExit){
    try {
        Animation enter = AnimationUtils.loadAnimation(mContentView.getContext(),animEnter);
        Animation exit = AnimationUtils.loadAnimation(mContentView.getContext(),animExit);
        return setAnimations(enter,exit);
    }catch (Exception e){
        //用户传入的动画资源找不到/出现异常,直接返回
        Log.e("幻海流心","setAnimations ->  e:"+e.getLocalizedMessage());
        return this;
    }
}
 
Example #17
Source Project: EasyIntro   Author: meness   File: EasyIntroCarouselFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void withOverlaySlideAnimation(@AnimRes int enter, @AnimRes int exit, @AnimRes int popEnter, @AnimRes int popExit) {
    // define animations for whole overlay slides
    mOverlaySlidesAnimations[0] = enter;
    mOverlaySlidesAnimations[1] = exit;
    mOverlaySlidesAnimations[2] = popEnter;
    mOverlaySlidesAnimations[3] = popExit;
}
 
Example #18
Source Project: ForceDoze   Author: theblixguy   File: CustomTabs.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Method used to set the Animations when the Custom Tab opens
 * @param exitEnterAnimation The Enter Animation of the new activity
 * @param exitCloseAnimation The Close Animation of the custom tab
 */
public Style setExitAnimation(@AnimRes int exitEnterAnimation, @AnimRes int
        exitCloseAnimation){
    this.exitEnterAnimation = exitEnterAnimation;
    this.exitCloseAnimation = exitCloseAnimation;
    return this;
}
 
Example #19
Source Project: AndroidUtilCode   Author: Blankj   File: ActivityUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Start the activity.
 *
 * @param clz       The activity class.
 * @param enterAnim A resource ID of the animation resource to use for the
 *                  incoming activity.
 * @param exitAnim  A resource ID of the animation resource to use for the
 *                  outgoing activity.
 */
public static void startActivity(@NonNull final Class<? extends Activity> clz,
                                 @AnimRes final int enterAnim,
                                 @AnimRes final int exitAnim) {
    Context context = UtilsBridge.getTopActivityOrApp();
    startActivity(context, null, context.getPackageName(), clz.getName(),
            getOptionsBundle(context, enterAnim, exitAnim));
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN && context instanceof Activity) {
        ((Activity) context).overridePendingTransition(enterAnim, exitAnim);
    }
}
 
Example #20
Source Project: AndroidUtilCode   Author: Blankj   File: ActivityUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Start the activity.
 *
 * @param activity  The activity.
 * @param clz       The activity class.
 * @param enterAnim A resource ID of the animation resource to use for the
 *                  incoming activity.
 * @param exitAnim  A resource ID of the animation resource to use for the
 *                  outgoing activity.
 */
public static void startActivity(@NonNull final Activity activity,
                                 @NonNull final Class<? extends Activity> clz,
                                 @AnimRes final int enterAnim,
                                 @AnimRes final int exitAnim) {
    startActivity(activity, null, activity.getPackageName(), clz.getName(),
            getOptionsBundle(activity, enterAnim, exitAnim));
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
        activity.overridePendingTransition(enterAnim, exitAnim);
    }
}
 
Example #21
Source Project: SweetTips   Author: HuanHaiLiuXin   File: SnackbarUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 设置SweetSnackbar实例的 入场动画 及 离场动画
 * @param animateIn
 * @param animateOut
 * @return
 */
public SnackbarUtils anim(@AnimRes int animateIn, @AnimRes int animateOut){
    if(getSnackbar()!=null){
        getSnackbar().setAnimations(animateIn,animateOut);
    }
    return this;
}
 
Example #22
Source Project: AndroidUtilCode   Author: Blankj   File: ActivityUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Start the activity.
 *
 * @param extras    The Bundle of extras to add to this intent.
 * @param activity  The activity.
 * @param clz       The activity class.
 * @param enterAnim A resource ID of the animation resource to use for the
 *                  incoming activity.
 * @param exitAnim  A resource ID of the animation resource to use for the
 *                  outgoing activity.
 */
public static void startActivity(@NonNull final Bundle extras,
                                 @NonNull final Activity activity,
                                 @NonNull final Class<? extends Activity> clz,
                                 @AnimRes final int enterAnim,
                                 @AnimRes final int exitAnim) {
    startActivity(activity, extras, activity.getPackageName(), clz.getName(),
            getOptionsBundle(activity, enterAnim, exitAnim));
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
        activity.overridePendingTransition(enterAnim, exitAnim);
    }
}
 
Example #23
Source Project: AndroidUtilCode   Author: Blankj   File: ActivityUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Start the activity.
 *
 * @param extras    The Bundle of extras to add to this intent.
 * @param pkg       The name of the package.
 * @param cls       The name of the class.
 * @param enterAnim A resource ID of the animation resource to use for the
 *                  incoming activity.
 * @param exitAnim  A resource ID of the animation resource to use for the
 *                  outgoing activity.
 */
public static void startActivity(@NonNull final Bundle extras,
                                 @NonNull final String pkg,
                                 @NonNull final String cls,
                                 @AnimRes final int enterAnim,
                                 @AnimRes final int exitAnim) {
    Context context = UtilsBridge.getTopActivityOrApp();
    startActivity(context, extras, pkg, cls, getOptionsBundle(context, enterAnim, exitAnim));
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN && context instanceof Activity) {
        ((Activity) context).overridePendingTransition(enterAnim, exitAnim);
    }
}
 
Example #24
Source Project: AndroidUtilCode   Author: Blankj   File: ActivityUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Start the activity.
 *
 * @param intent    The description of the activity to start.
 * @param enterAnim A resource ID of the animation resource to use for the
 *                  incoming activity.
 * @param exitAnim  A resource ID of the animation resource to use for the
 *                  outgoing activity.
 * @return {@code true}: success<br>{@code false}: fail
 */
public static boolean startActivity(@NonNull final Intent intent,
                                    @AnimRes final int enterAnim,
                                    @AnimRes final int exitAnim) {
    Context context = UtilsBridge.getTopActivityOrApp();
    boolean isSuccess = startActivity(intent, context, getOptionsBundle(context, enterAnim, exitAnim));
    if (isSuccess) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN && context instanceof Activity) {
            ((Activity) context).overridePendingTransition(enterAnim, exitAnim);
        }
    }
    return isSuccess;
}
 
Example #25
Source Project: TabStacker   Author: smart-fun   File: AnimationSet.java    License: Apache License 2.0 4 votes vote down vote up
@AnimRes int getPushOutAnim() {
    return mPushOutAnim;
}
 
Example #26
Source Project: TabStacker   Author: smart-fun   File: AnimationSet.java    License: Apache License 2.0 4 votes vote down vote up
@AnimRes int getPopOutAnim() {
    return mPopOutAnim;
}
 
Example #27
Source Project: fragment-navigation-2.0   Author: gyorgygabor   File: EmptyNavigationFacade.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public boolean navigateTo(Type fragmentClass, Bundle bundle, @AnimRes int enterAnimId, @AnimRes int exitAnimId) {
    return false;
}
 
Example #28
Source Project: SmartGo   Author: huazhouwang   File: BaseActivityLauncher.java    License: Apache License 2.0 4 votes vote down vote up
protected <T extends BaseActivityLauncher> T animate(final T son, @AnimRes int enterResId, @AnimRes int exitResId){
    ActivityAnimate.animate(mFrom,mActivityOptionsBox,enterResId,exitResId);
    return son;
}
 
Example #29
Source Project: SmartGo   Author: huazhouwang   File: Explicit.java    License: Apache License 2.0 4 votes vote down vote up
public Explicit animate(@AnimRes int enterResId, @AnimRes int exitResId){
    return animate(this,enterResId,exitResId);
}
 
Example #30
Source Project: PowerFileExplorer   Author: PowerExplorer   File: ResourcesUtil.java    License: GNU General Public License v3.0 4 votes vote down vote up
public static XmlResourceParser getAnimation(@AnimRes int animRes) {
    return Base.getResources().getAnimation(animRes);
}