下面列出了android.support.annotation.AnimRes#android.support.annotation.AnimatorRes 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public void configureIndicator(int indicatorWidth, int indicatorHeight, int indicatorMargin,
@AnimatorRes int animatorId, @AnimatorRes int animatorReverseId,
@DrawableRes int indicatorBackgroundId,
@DrawableRes int indicatorUnselectedBackgroundId) {
mIndicatorWidth = indicatorWidth;
mIndicatorHeight = indicatorHeight;
mIndicatorMargin = indicatorMargin;
mAnimatorResId = animatorId;
mAnimatorReverseResId = animatorReverseId;
mIndicatorBackgroundResId = indicatorBackgroundId;
mIndicatorUnselectedBackgroundResId = indicatorUnselectedBackgroundId;
checkIndicatorConfig(getContext());
}
public void configureIndicator(int indicatorWidth, int indicatorHeight, int indicatorMargin,
@AnimatorRes int animatorId, @AnimatorRes int animatorReverseId,
@DrawableRes int indicatorBackgroundId,
@DrawableRes int indicatorUnselectedBackgroundId) {
mIndicatorWidth = indicatorWidth;
mIndicatorHeight = indicatorHeight;
mIndicatorMargin = indicatorMargin;
mAnimatorResId = animatorId;
mAnimatorReverseResId = animatorReverseId;
mIndicatorBackgroundResId = indicatorBackgroundId;
mIndicatorUnselectedBackgroundResId = indicatorUnselectedBackgroundId;
checkIndicatorConfig(getContext());
}
public void configureIndicator(int indicatorWidth, int indicatorHeight, int indicatorMargin,
@AnimatorRes int animatorId, @AnimatorRes int animatorReverseId,
@DrawableRes int indicatorBackgroundId,
@DrawableRes int indicatorUnselectedBackgroundId) {
mIndicatorWidth = indicatorWidth;
mIndicatorHeight = indicatorHeight;
mIndicatorMargin = indicatorMargin;
mAnimatorResId = animatorId;
mAnimatorReverseResId = animatorReverseId;
mIndicatorBackgroundResId = indicatorBackgroundId;
mIndicatorUnselectedBackgroundResId = indicatorUnselectedBackgroundId;
checkIndicatorConfig(getContext());
}
public void configureIndicator(int indicatorWidth, int indicatorHeight, int indicatorMargin,
@AnimatorRes int animatorId, @AnimatorRes int animatorReverseId,
@DrawableRes int indicatorBackgroundId,
@DrawableRes int indicatorUnselectedBackgroundId) {
mIndicatorWidth = indicatorWidth;
mIndicatorHeight = indicatorHeight;
mIndicatorMargin = indicatorMargin;
mAnimatorResId = animatorId;
mAnimatorReverseResId = animatorReverseId;
mIndicatorBackgroundResId = indicatorBackgroundId;
mIndicatorUnselectedBackgroundResId = indicatorUnselectedBackgroundId;
checkIndicatorConfig(getContext());
}
public void configureIndicator(int indicatorWidth, int indicatorHeight, int indicatorMargin,
@AnimatorRes int animatorId, @AnimatorRes int animatorReverseId,
@DrawableRes int indicatorBackgroundId,
@DrawableRes int indicatorUnselectedBackgroundId) {
mIndicatorWidth = indicatorWidth;
mIndicatorHeight = indicatorHeight;
mIndicatorMargin = indicatorMargin;
mAnimatorResId = animatorId;
mAnimatorReverseResId = animatorReverseId;
mIndicatorBackgroundResId = indicatorBackgroundId;
mIndicatorUnselectedBackgroundResId = indicatorUnselectedBackgroundId;
checkIndicatorConfig(getContext());
}
public void configureIndicator(int indicatorWidth, int indicatorHeight, int indicatorMargin,
@AnimatorRes int animatorId, @AnimatorRes int animatorReverseId,
@DrawableRes int indicatorBackgroundId,
@DrawableRes int indicatorUnselectedBackgroundId) {
mIndicatorWidth = indicatorWidth;
mIndicatorHeight = indicatorHeight;
mIndicatorMargin = indicatorMargin;
mAnimatorResId = animatorId;
mAnimatorReverseResId = animatorReverseId;
mIndicatorBackgroundResId = indicatorBackgroundId;
mIndicatorUnselectedBackgroundResId = indicatorUnselectedBackgroundId;
checkIndicatorConfig(getContext());
}
@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;
}
@NonNull
public Builder setAnimation(@NonNull Activity activity,
@AnimRes @AnimatorRes int enterAnim,
@AnimRes @AnimatorRes int exitAnim) {
this.mNavigationAnimationExecutor = new AnimationOrAnimatorResourceExecutor(activity, enterAnim, exitAnim);
return this;
}
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;
}
protected HandleAnimationManager(View handle, @AnimatorRes int grabAnimator, @AnimatorRes int releaseAnimator) {
if (grabAnimator != -1) {
this.grabAnimator = (AnimatorSet) AnimatorInflater.loadAnimator(handle.getContext(), grabAnimator);
this.grabAnimator.setTarget(handle);
}
if (releaseAnimator != -1) {
this.releaseAnimator = (AnimatorSet) AnimatorInflater.loadAnimator(handle.getContext(), releaseAnimator);
this.releaseAnimator.setTarget(handle);
}
}
public AnimationOrAnimatorResourceExecutor(Activity activity, @AnimatorRes @AnimRes int enterResId, @AnimatorRes @AnimRes int exitResId) {
mEnterAnimator = AnimationOrAnimator.loadAnimation(activity, enterResId);
mExitAnimator = AnimationOrAnimator.loadAnimation(activity, exitResId);
}
/**
* The custom enter Animation/Animator that should be run.
* @return the resource id of a Animation or Animator or -1 if none.
*/
@AnimRes @AnimatorRes
public int getEnterAnim() {
return mEnterAnim;
}
/**
* The custom exit Animation/Animator that should be run.
* @return the resource id of a Animation or Animator or -1 if none.
*/
@AnimRes @AnimatorRes
public int getExitAnim() {
return mExitAnim;
}
public FragmentWrapper addAnimStart(@AnimRes @AnimatorRes int startAn) {
transaction.setCustomAnimations(startAn, 0);
return this;
}
public FragmentWrapper addAnimEnd(@AnimRes @AnimatorRes int endAn) {
transaction.setCustomAnimations(0, endAn);
return this;
}
public ChipWidget showMotionSpecResource(@AnimatorRes int id) {
view.setShowMotionSpecResource(id);
return self();
}
public ChipWidget hideMotionSpecResource(@AnimatorRes int id) {
view.setHideMotionSpecResource(id);
return self();
}
public Builder setIconAnimation(@AnimatorRes int iconAnimation) {
params.iconAnimator = (AnimatorSet) AnimatorInflater.loadAnimator(context, iconAnimation);
return this;
}
public void setLoadingAnim(@AnimatorRes int animId) {
mLoadingAnim = AnimatorInflater.loadAnimator(getContext(), animId);
}
public Builder withGrabAnimator(@AnimatorRes int grabAnimator) {
this.grabAnimator = grabAnimator;
return this;
}
public Builder withReleaseAnimator(@AnimatorRes int releaseAnimator) {
this.releaseAnimator = releaseAnimator;
return this;
}
public AbsBuilder<T> withShowAnimator(@AnimatorRes int showAnimatorResource){
this.showAnimatorResource = showAnimatorResource;
return this;
}
public AbsBuilder<T> withHideAnimator(@AnimatorRes int hideAnimatorResource){
this.hideAnimatorResource = hideAnimatorResource;
return this;
}
/**
* Replace fragment.
*
* @param srcFragment The source of fragment.
* @param destFragment The destination of fragment.
* @param enterAnim An animation or animator resource ID used for the enter animation on the
* view of the fragment being added or attached.
* @param exitAnim An animation or animator resource ID used for the exit animation on the
* view of the fragment being removed or detached.
*/
public static void replace(@NonNull final Fragment srcFragment,
@NonNull final Fragment destFragment,
@AnimatorRes @AnimRes final int enterAnim,
@AnimatorRes @AnimRes final int exitAnim) {
replace(srcFragment, destFragment, null, false, enterAnim, exitAnim, 0, 0);
}
/**
* Replace fragment.
*
* @param srcFragment The source of fragment.
* @param destFragment The destination of fragment.
* @param isAddStack True to add fragment in stack, false otherwise.
* @param enterAnim An animation or animator resource ID used for the enter animation on the
* view of the fragment being added or attached.
* @param exitAnim An animation or animator resource ID used for the exit animation on the
* view of the fragment being removed or detached.
*/
public static void replace(@NonNull final Fragment srcFragment,
@NonNull final Fragment destFragment,
final boolean isAddStack,
@AnimatorRes @AnimRes final int enterAnim,
@AnimatorRes @AnimRes final int exitAnim) {
replace(srcFragment, destFragment, null, isAddStack, enterAnim, exitAnim, 0, 0);
}
/**
* Replace fragment.
*
* @param srcFragment The source of fragment.
* @param destFragment The destination of fragment.
* @param enterAnim An animation or animator resource ID used for the enter animation on the
* view of the fragment being added or attached.
* @param exitAnim An animation or animator resource ID used for the exit animation on the
* view of the fragment being removed or detached.
* @param popEnterAnim An animation or animator resource ID used for the enter animation on the
* view of the fragment being readded or reattached caused by
* popBackStack() or similar methods.
* @param popExitAnim An animation or animator resource ID used for the enter animation on the
* view of the fragment being removed or detached caused by
* popBackStack() or similar methods.
*/
public static void replace(@NonNull final Fragment srcFragment,
@NonNull final Fragment destFragment,
@AnimatorRes @AnimRes final int enterAnim,
@AnimatorRes @AnimRes final int exitAnim,
@AnimatorRes @AnimRes final int popEnterAnim,
@AnimatorRes @AnimRes final int popExitAnim) {
replace(srcFragment, destFragment, null, false,
enterAnim, exitAnim, popEnterAnim, popExitAnim);
}
/**
* Replace fragment.
*
* @param srcFragment The source of fragment.
* @param destFragment The destination of fragment.
* @param isAddStack True to add fragment in stack, false otherwise.
* @param enterAnim An animation or animator resource ID used for the enter animation on the
* view of the fragment being added or attached.
* @param exitAnim An animation or animator resource ID used for the exit animation on the
* view of the fragment being removed or detached.
* @param popEnterAnim An animation or animator resource ID used for the enter animation on the
* view of the fragment being readded or reattached caused by
* popBackStack() or similar methods.
* @param popExitAnim An animation or animator resource ID used for the enter animation on the
* view of the fragment being removed or detached caused by
* popBackStack() or similar methods.
*/
public static void replace(@NonNull final Fragment srcFragment,
@NonNull final Fragment destFragment,
final boolean isAddStack,
@AnimatorRes @AnimRes final int enterAnim,
@AnimatorRes @AnimRes final int exitAnim,
@AnimatorRes @AnimRes final int popEnterAnim,
@AnimatorRes @AnimRes final int popExitAnim) {
replace(srcFragment, destFragment, null, isAddStack,
enterAnim, exitAnim, popEnterAnim, popExitAnim);
}
/**
* Replace fragment.
*
* @param fm The manager of fragment.
* @param containerId The id of container.
* @param fragment The new fragment to place in the container.
* @param enterAnim An animation or animator resource ID used for the enter animation on the
* view of the fragment being added or attached.
* @param exitAnim An animation or animator resource ID used for the exit animation on the
* view of the fragment being removed or detached.
*/
public static void replace(@NonNull final FragmentManager fm,
@NonNull final Fragment fragment,
@IdRes final int containerId,
@AnimatorRes @AnimRes final int enterAnim,
@AnimatorRes @AnimRes final int exitAnim) {
replace(fm, fragment, containerId, null, false, enterAnim, exitAnim, 0, 0);
}
/**
* Replace fragment.
*
* @param fm The manager of fragment.
* @param containerId The id of container.
* @param fragment The new fragment to place in the container.
* @param isAddStack True to add fragment in stack, false otherwise.
* @param enterAnim An animation or animator resource ID used for the enter animation on the
* view of the fragment being added or attached.
* @param exitAnim An animation or animator resource ID used for the exit animation on the
* view of the fragment being removed or detached.
*/
public static void replace(@NonNull final FragmentManager fm,
@NonNull final Fragment fragment,
@IdRes final int containerId,
final boolean isAddStack,
@AnimatorRes @AnimRes final int enterAnim,
@AnimatorRes @AnimRes final int exitAnim) {
replace(fm, fragment, containerId, null, isAddStack, enterAnim, exitAnim, 0, 0);
}
/**
* Replace fragment.
*
* @param fm The manager of fragment.
* @param containerId The id of container.
* @param fragment The new fragment to place in the container.
* @param enterAnim An animation or animator resource ID used for the enter animation on the
* view of the fragment being added or attached.
* @param exitAnim An animation or animator resource ID used for the exit animation on the
* view of the fragment being removed or detached.
* @param popEnterAnim An animation or animator resource ID used for the enter animation on the
* view of the fragment being readded or reattached caused by
* popBackStack() or similar methods.
* @param popExitAnim An animation or animator resource ID used for the enter animation on the
* view of the fragment being removed or detached caused by
* popBackStack() or similar methods.
*/
public static void replace(@NonNull final FragmentManager fm,
@NonNull final Fragment fragment,
@IdRes final int containerId,
@AnimatorRes @AnimRes final int enterAnim,
@AnimatorRes @AnimRes final int exitAnim,
@AnimatorRes @AnimRes final int popEnterAnim,
@AnimatorRes @AnimRes final int popExitAnim) {
replace(fm, fragment, containerId, null, false,
enterAnim, exitAnim, popEnterAnim, popExitAnim);
}