类android.support.annotation.AnimRes源码实例Demo

下面列出了怎么用android.support.annotation.AnimRes的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: AndroidUtilCode   文件: ActivityUtils.java
/**
 * 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;
}
 
源代码2 项目: scene   文件: PopOptions.java
@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;
}
 
源代码3 项目: android_9.0.0_r45   文件: NavOptions.java
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;
}
 
源代码4 项目: AndroidChromium   文件: CustomTabsIntent.java
/**
 * 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;
}
 
源代码5 项目: ZZShow   文件: BaseRecyclerViewAdapter.java
/**
 *  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;
    }
}
 
源代码6 项目: PermissMe   文件: PermissMe.java
/**
 * 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();
			}
		}
	});
}
 
源代码7 项目: SweetTips   文件: SweetToast.java
/**
 * 设置当前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;
    }
}
 
源代码8 项目: PowerFileExplorer   文件: FinestWebView.java
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;
}
 
源代码9 项目: TextBannerView   文件: TextBannerView.java
/**
 * 设置进入动画和离开动画
 *
 * @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);
}
 
源代码10 项目: AndroidUtilCode   文件: ActivityUtils.java
/**
 * 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);
    }
}
 
源代码11 项目: MultiContactPicker   文件: MultiContactPicker.java
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;
}
 
源代码12 项目: FragmentStack   文件: StackManager.java
/**
 * 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);
}
 
源代码13 项目: AndroidUtilCode   文件: ActivityUtils.java
/**
 * 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);
        }
    }
}
 
源代码14 项目: flowr   文件: Flowr.java
/**
 * 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;

}
 
源代码15 项目: SweetTips   文件: SnackbarUtils.java
/**
 * 设置SweetSnackbar实例的 入场动画 及 离场动画
 * @param animateIn
 * @param animateOut
 * @return
 */
public SnackbarUtils anim(@AnimRes int animateIn, @AnimRes int animateOut){
    if(getSnackbar()!=null){
        getSnackbar().setAnimations(animateIn,animateOut);
    }
    return this;
}
 
源代码16 项目: SweetTips   文件: SweetToast.java
/**
 * 设置当前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;
    }
}
 
源代码17 项目: EasyIntro   文件: EasyIntroCarouselFragment.java
@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;
}
 
源代码18 项目: ForceDoze   文件: CustomTabs.java
/**
 * 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;
}
 
源代码19 项目: AndroidUtilCode   文件: ActivityUtils.java
/**
 * 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);
    }
}
 
源代码20 项目: AndroidUtilCode   文件: ActivityUtils.java
/**
 * 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);
    }
}
 
源代码21 项目: SweetTips   文件: SnackbarUtils.java
/**
 * 设置SweetSnackbar实例的 入场动画 及 离场动画
 * @param animateIn
 * @param animateOut
 * @return
 */
public SnackbarUtils anim(@AnimRes int animateIn, @AnimRes int animateOut){
    if(getSnackbar()!=null){
        getSnackbar().setAnimations(animateIn,animateOut);
    }
    return this;
}
 
源代码22 项目: AndroidUtilCode   文件: ActivityUtils.java
/**
 * 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);
    }
}
 
源代码23 项目: AndroidUtilCode   文件: ActivityUtils.java
/**
 * 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);
    }
}
 
源代码24 项目: AndroidUtilCode   文件: ActivityUtils.java
/**
 * 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;
}
 
源代码25 项目: TabStacker   文件: AnimationSet.java
@AnimRes int getPushOutAnim() {
    return mPushOutAnim;
}
 
源代码26 项目: TabStacker   文件: AnimationSet.java
@AnimRes int getPopOutAnim() {
    return mPopOutAnim;
}
 
@Override
public boolean navigateTo(Type fragmentClass, Bundle bundle, @AnimRes int enterAnimId, @AnimRes int exitAnimId) {
    return false;
}
 
源代码28 项目: SmartGo   文件: BaseActivityLauncher.java
protected <T extends BaseActivityLauncher> T animate(final T son, @AnimRes int enterResId, @AnimRes int exitResId){
    ActivityAnimate.animate(mFrom,mActivityOptionsBox,enterResId,exitResId);
    return son;
}
 
源代码29 项目: SmartGo   文件: Explicit.java
public Explicit animate(@AnimRes int enterResId, @AnimRes int exitResId){
    return animate(this,enterResId,exitResId);
}
 
源代码30 项目: PowerFileExplorer   文件: ResourcesUtil.java
public static XmlResourceParser getAnimation(@AnimRes int animRes) {
    return Base.getResources().getAnimation(animRes);
}
 
 同包方法