androidx.annotation.AnimRes Java Examples

The following examples show how to use androidx.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 File: UCrop.java    From PictureSelector with Apache License 2.0 5 votes vote down vote up
/**
 * Send the crop Intent from animation an Activity
 *
 * @param activity Activity to receive result
 */
public void startAnimationActivity(@NonNull Activity activity, @AnimRes int activityCropEnterAnimation) {
    if (activityCropEnterAnimation != 0) {
        start(activity, REQUEST_CROP, activityCropEnterAnimation);
    } else {
        start(activity, REQUEST_CROP);
    }
}
 
Example #2
Source File: CustomTabsIntent.java    From Telegram with GNU General Public License v2.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 #3
Source File: CustomTabsIntent.java    From Telegram-FOSS with GNU General Public License v2.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 #4
Source File: SyncCapableCommCareActivity.java    From commcare-android with Apache License 2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void addAnimationToMenuItem(MenuItem menuItem, @LayoutRes int layoutResource,
                                    @AnimRes int animationId) {
    LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    ImageView iv = (ImageView)inflater.inflate(layoutResource, null);
    Animation animation = AnimationUtils.loadAnimation(this, animationId);
    iv.startAnimation(animation);
    menuItem.setActionView(iv);
}
 
Example #5
Source File: BaseFragmentActivityTest.java    From edx-app-android with Apache License 2.0 5 votes vote down vote up
/**
 * Generic method for asserting pending transition animation
 *
 * @param shadowActivity The shadow activity
 * @param enterAnim      The enter animation resource
 * @param exitAnim       The exit animation resource
 */
private static void assertOverridePendingTransition(ShadowActivity shadowActivity,
                                                    @AnimRes int enterAnim, @AnimRes int exitAnim) {
    assertEquals(enterAnim, shadowActivity
            .getPendingTransitionEnterAnimationResourceId());
    assertEquals(exitAnim, shadowActivity
            .getPendingTransitionExitAnimationResourceId());
}
 
Example #6
Source File: ViewTranslationWrapper.java    From AsteroidOSSync with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Set view on error animation
 *
 * @param errorAnimation new animation
 * @return ViewTranslationWrapper object
 */
public ViewTranslationWrapper setErrorAnimation(@AnimRes int errorAnimation) {
    if (errorAnimation != 0) {
        this.errorAnimation = AnimationUtils.loadAnimation(view.getContext(), errorAnimation);
    }
    return this;
}
 
Example #7
Source File: UCrop.java    From PictureSelector with Apache License 2.0 5 votes vote down vote up
/**
 * Send the crop Intent from animation an Multiple Activity
 *
 * @param activity Activity to receive result
 */
public void startAnimationMultipleCropActivity(@NonNull Activity activity,
                                               @AnimRes int activityCropEnterAnimation) {
    if (activityCropEnterAnimation != 0) {
        startMultiple(activity, REQUEST_MULTI_CROP, activityCropEnterAnimation);
    } else {
        startMultiple(activity, REQUEST_MULTI_CROP);
    }
}
 
Example #8
Source File: PictureWindowAnimationStyle.java    From PictureSelector with Apache License 2.0 5 votes vote down vote up
public PictureWindowAnimationStyle(@AnimRes int activityEnterAnimation,
                                   @AnimRes int activityExitAnimation,
                                   @AnimRes int activityPreviewEnterAnimation,
                                   @AnimRes int activityPreviewExitAnimation) {
    super();
    this.activityEnterAnimation = activityEnterAnimation;
    this.activityExitAnimation = activityExitAnimation;
    this.activityPreviewEnterAnimation = activityPreviewEnterAnimation;
    this.activityPreviewExitAnimation = activityPreviewExitAnimation;
}
 
Example #9
Source File: NavigationDrawerFragment.java    From Twire with GNU General Public License v3.0 5 votes vote down vote up
private void setInstantOnClick(@IdRes int viewRes, final Class activityClass, @AnimRes final int inAnimation) {
    View view = getActivity().findViewById(viewRes);
    view.setOnClickListener(view1 -> {
        Intent intent = new Intent(getActivity(), activityClass);

        ActivityOptionsCompat searchAnim = ActivityOptionsCompat.makeCustomAnimation(getActivity(), inAnimation, R.anim.fade_out_semi_anim);
        ActivityCompat.startActivity(getActivity(), intent, searchAnim.toBundle());
        mDrawerLayout.closeDrawer(containerView);
    });
}
 
Example #10
Source File: ResourceUtils.java    From DevUtils with Apache License 2.0 5 votes vote down vote up
/**
 * 获取 Animation
 * @param id resource identifier
 * @return XmlResourceParser
 */
public static XmlResourceParser getAnimation(@AnimatorRes @AnimRes final int id) {
    try {
        return DevUtils.getContext().getResources().getAnimation(id);
    } catch (Exception e) {
        LogPrintUtils.eTag(TAG, e, "getAnimation");
    }
    return null;
}
 
Example #11
Source File: TabBarFragment.java    From AndroidNavigation with MIT License 5 votes vote down vote up
void showTabBarWhenPop(@AnimRes int anim) {
    if (tabBar != null) {
        tabBarHidden = false;
        setNeedsNavigationBarAppearanceUpdate();
        if (anim != R.anim.nav_none) {
            Animation animation = AnimationUtils.loadAnimation(getContext(), anim);
            animation.setAnimationListener(new TabBarAnimationListener(false));
            tabBar.startAnimation(animation);
        } else {
            tabBar.setVisibility(View.VISIBLE);
            tabBar.setTranslationY(0);
        }
    }
}
 
Example #12
Source File: TabBarFragment.java    From AndroidNavigation with MIT License 5 votes vote down vote up
void hideTabBarWhenPush(@AnimRes int anim) {
    if (tabBar != null) {
        tabBarHidden = true;
        setNeedsNavigationBarAppearanceUpdate();
        if (anim != R.anim.nav_none) {
            Animation animation = AnimationUtils.loadAnimation(getContext(), anim);
            animation.setAnimationListener(new TabBarAnimationListener(true));
            tabBar.startAnimation(animation);
        } else {
            tabBar.setVisibility(View.GONE);
            tabBar.setTranslationY(tabBar.getHeight());
        }
    }
}
 
Example #13
Source File: UCropMulti.java    From Matisse-Kotlin with Apache License 2.0 5 votes vote down vote up
/**
 * Send the crop Intent from animation an Activity
 *
 * @param activity Activity to receive result
 */
public void startAnimation(@NonNull Activity activity, @AnimRes int activityCropEnterAnimation) {
    if (activityCropEnterAnimation != 0) {
        start(activity, REQUEST_MULTI_CROP, activityCropEnterAnimation);
    } else {
        start(activity, REQUEST_MULTI_CROP);
    }
}
 
Example #14
Source File: UCrop.java    From Matisse-Kotlin with Apache License 2.0 5 votes vote down vote up
/**
 * Send the crop Intent from animation an Activity
 *
 * @param activity Activity to receive result
 */
public void startAnimation(@NonNull Activity activity, @AnimRes int activityCropEnterAnimation) {
    if (activityCropEnterAnimation != 0) {
        start(activity, REQUEST_CROP, activityCropEnterAnimation);
    } else {
        start(activity, REQUEST_CROP);
    }
}
 
Example #15
Source File: UCrop.java    From PictureSelector with Apache License 2.0 4 votes vote down vote up
/**
 * @param activityCropExitAnimation activity exit animation
 */
public void setCropExitAnimation(@AnimRes int activityCropExitAnimation) {
    mOptionBundle.putInt(EXTRA_WINDOW_EXIT_ANIMATION, activityCropExitAnimation);
}
 
Example #16
Source File: SimpleTransitionAnimation.java    From Alligator with MIT License 4 votes vote down vote up
/**
 * @param enterAnimation animation resource that will be used for an appearing activity/fragment
 * @param exitAnimation  animation resource that will be used for a disappearing activity/fragment
 */
public SimpleTransitionAnimation(@AnimRes int enterAnimation, @AnimRes int exitAnimation) {
	mEnterAnimation = enterAnimation;
	mExitAnimation = exitAnimation;
}
 
Example #17
Source File: InviteActivity.java    From mollyim-android with GNU General Public License v3.0 4 votes vote down vote up
private Animation loadAnimation(@AnimRes int animResId) {
  final Animation animation = AnimationUtils.loadAnimation(this, animResId);
  animation.setInterpolator(new FastOutSlowInInterpolator());
  return animation;
}
 
Example #18
Source File: UCropMulti.java    From Matisse-Kotlin with Apache License 2.0 4 votes vote down vote up
/**
 * @param activityCropExitAnimation activity exit animation
 */
public Options setCropExitAnimation(@AnimRes int activityCropExitAnimation) {
    mOptionBundle.putInt(EXTRA_WINDOW_EXIT_ANIMATION, activityCropExitAnimation);
    return this;
}
 
Example #19
Source File: PictureWindowAnimationStyle.java    From PictureSelector with Apache License 2.0 4 votes vote down vote up
public PictureWindowAnimationStyle(@AnimRes int activityEnterAnimation,
                                   @AnimRes int activityExitAnimation) {
    super();
    this.activityEnterAnimation = activityEnterAnimation;
    this.activityExitAnimation = activityExitAnimation;
}
 
Example #20
Source File: UCrop.java    From Matisse-Kotlin with Apache License 2.0 4 votes vote down vote up
/**
 * @param activityCropExitAnimation activity exit animation
 */
public Options setCropExitAnimation(@AnimRes int activityCropExitAnimation) {
    mOptionBundle.putInt(EXTRA_WINDOW_EXIT_ANIMATION, activityCropExitAnimation);
    return this;
}
 
Example #21
Source File: CustomTabsIntent.java    From Telegram-FOSS with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Sets the start animations.
 *
 * @param context Application context.
 * @param enterResId Resource ID of the "enter" animation for the browser.
 * @param exitResId Resource ID of the "exit" animation for the application.
 */
public Builder setStartAnimations(
        @NonNull Context context, @AnimRes int enterResId, @AnimRes int exitResId) {
    mStartAnimationBundle = ActivityOptionsCompat.makeCustomAnimation(
            context, enterResId, exitResId).toBundle();
    return this;
}
 
Example #22
Source File: CustomTabsIntent.java    From Telegram with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Sets the start animations.
 *
 * @param context Application context.
 * @param enterResId Resource ID of the "enter" animation for the browser.
 * @param exitResId Resource ID of the "exit" animation for the application.
 */
public Builder setStartAnimations(
        @NonNull Context context, @AnimRes int enterResId, @AnimRes int exitResId) {
    mStartAnimationBundle = ActivityOptionsCompat.makeCustomAnimation(
            context, enterResId, exitResId).toBundle();
    return this;
}
 
Example #23
Source File: UCrop.java    From PictureSelector with Apache License 2.0 2 votes vote down vote up
/**
 * Send the crop Intent from an Activity with a custom request code or animation
 *
 * @param activity    Activity to receive result
 * @param requestCode requestCode for result
 */
public void startMultiple(@NonNull Activity activity, int requestCode, @AnimRes int activityCropEnterAnimation) {
    activity.startActivityForResult(getMultipleIntent(activity), requestCode);
    activity.overridePendingTransition(activityCropEnterAnimation, R.anim.ucrop_anim_fade_in);
}
 
Example #24
Source File: UCropMulti.java    From Matisse-Kotlin with Apache License 2.0 2 votes vote down vote up
/**
 * Send the crop Intent from an Activity with a custom request code or animation
 *
 * @param activity    Activity to receive result
 * @param requestCode requestCode for result
 */
public void start(@NonNull Activity activity, int requestCode, @AnimRes int activityCropEnterAnimation) {
    activity.startActivityForResult(getIntent(activity), requestCode);
    activity.overridePendingTransition(activityCropEnterAnimation, R.anim.ucrop_anim_fade_in);
}
 
Example #25
Source File: UCrop.java    From PictureSelector with Apache License 2.0 2 votes vote down vote up
/**
 * Send the crop Intent from an Activity with a custom request code or animation
 *
 * @param activity    Activity to receive result
 * @param requestCode requestCode for result
 */
public void start(@NonNull Activity activity, int requestCode, @AnimRes int activityCropEnterAnimation) {
    activity.startActivityForResult(getIntent(activity), requestCode);
    activity.overridePendingTransition(activityCropEnterAnimation, R.anim.ucrop_anim_fade_in);
}
 
Example #26
Source File: UCrop.java    From Matisse-Kotlin with Apache License 2.0 2 votes vote down vote up
/**
 * Send the crop Intent from an Activity with a custom request code or animation
 *
 * @param activity    Activity to receive result
 * @param requestCode requestCode for result
 */
public void start(@NonNull Activity activity, int requestCode, @AnimRes int activityCropEnterAnimation) {
    activity.startActivityForResult(getIntent(activity), requestCode);
    activity.overridePendingTransition(activityCropEnterAnimation, R.anim.ucrop_anim_fade_in);
}