From 2e89356efe086682bf023768683e4fc44bcfd321 Mon Sep 17 00:00:00 2001 From: Ztiany Date: Wed, 9 Oct 2019 14:08:26 +0800 Subject: [PATCH] optimize Fragment Animation --- .../base/app/fragment/AnimatorHelper.java | 102 ----------------- .../base/app/fragment/BaseFragment.java | 8 +- .../fragment/DefaultHorizontalAnimator.java | 40 +++---- .../base/app/fragment/DefaultNoAnimator.java | 42 +++---- .../app/fragment/DefaultScaleAnimator.java | 56 ++++++++++ .../app/fragment/DefaultVerticalAnimator.java | 40 +++---- .../base/app/fragment/FragmentAnimator.java | 102 +---------------- .../app/fragment/FragmentAnimatorHelper.java | 103 ++++++++++++++++++ .../android/base/app/fragment/Fragments.kt | 4 +- .../base/utils/android/views/ResourceEx.kt | 17 ++- .../anim/{no_anim.xml => base_no_anim.xml} | 0 ...p_enter.xml => h_fragment_close_enter.xml} | 0 .../main/res/anim/h_fragment_close_exit.xml | 20 ++++ .../src/main/res/anim/h_fragment_exit.xml | 10 -- ...nt_enter.xml => h_fragment_open_enter.xml} | 0 .../main/res/anim/h_fragment_open_exit.xml | 19 ++++ .../src/main/res/anim/h_fragment_pop_exit.xml | 9 -- .../src/main/res/anim/pop_exit_no_anim.xml | 9 -- ...p_enter.xml => v_fragment_close_enter.xml} | 0 ...ent_exit.xml => v_fragment_close_exit.xml} | 0 ...nt_enter.xml => v_fragment_open_enter.xml} | 0 ..._pop_exit.xml => v_fragment_open_exit.xml} | 0 22 files changed, 270 insertions(+), 311 deletions(-) delete mode 100644 lib_base/src/main/java/com/android/base/app/fragment/AnimatorHelper.java create mode 100644 lib_base/src/main/java/com/android/base/app/fragment/DefaultScaleAnimator.java create mode 100644 lib_base/src/main/java/com/android/base/app/fragment/FragmentAnimatorHelper.java rename lib_base/src/main/res/anim/{no_anim.xml => base_no_anim.xml} (100%) rename lib_base/src/main/res/anim/{h_fragment_pop_enter.xml => h_fragment_close_enter.xml} (100%) create mode 100644 lib_base/src/main/res/anim/h_fragment_close_exit.xml delete mode 100644 lib_base/src/main/res/anim/h_fragment_exit.xml rename lib_base/src/main/res/anim/{h_fragment_enter.xml => h_fragment_open_enter.xml} (100%) create mode 100644 lib_base/src/main/res/anim/h_fragment_open_exit.xml delete mode 100644 lib_base/src/main/res/anim/h_fragment_pop_exit.xml delete mode 100644 lib_base/src/main/res/anim/pop_exit_no_anim.xml rename lib_base/src/main/res/anim/{v_fragment_pop_enter.xml => v_fragment_close_enter.xml} (100%) rename lib_base/src/main/res/anim/{v_fragment_exit.xml => v_fragment_close_exit.xml} (100%) rename lib_base/src/main/res/anim/{v_fragment_enter.xml => v_fragment_open_enter.xml} (100%) rename lib_base/src/main/res/anim/{v_fragment_pop_exit.xml => v_fragment_open_exit.xml} (100%) diff --git a/lib_base/src/main/java/com/android/base/app/fragment/AnimatorHelper.java b/lib_base/src/main/java/com/android/base/app/fragment/AnimatorHelper.java deleted file mode 100644 index 26065ca..0000000 --- a/lib_base/src/main/java/com/android/base/app/fragment/AnimatorHelper.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.android.base.app.fragment; - -import android.content.Context; -import android.view.animation.Animation; -import android.view.animation.AnimationUtils; - -import com.android.base.R; - -import androidx.fragment.app.FragmentTransaction; - -public final class AnimatorHelper { - - private Animation noneAnim, noneAnimFixed; - private Animation enterAnim, exitAnim, popEnterAnim, popExitAnim; - - private Context context; - private FragmentAnimator fragmentAnimator; - - AnimatorHelper(Context context, FragmentAnimator fragmentAnimator) { - this.context = context; - notifyChanged(fragmentAnimator); - } - - void notifyChanged(FragmentAnimator fragmentAnimator) { - this.fragmentAnimator = fragmentAnimator; - if (fragmentAnimator != null) { - initEnterAnim(); - initExitAnim(); - initPopEnterAnim(); - initPopExitAnim(); - } - } - - public Animation getNoneAnim() { - if (noneAnim == null) { - noneAnim = AnimationUtils.loadAnimation(context, R.anim.no_anim); - } - return noneAnim; - } - - public Animation getNoneAnimFixed() { - if (noneAnimFixed == null) { - noneAnimFixed = new Animation() { - }; - } - return noneAnimFixed; - } - - private Animation initEnterAnim() { - if (fragmentAnimator.getEnter() == 0) { - enterAnim = AnimationUtils.loadAnimation(context, R.anim.no_anim); - } else { - enterAnim = AnimationUtils.loadAnimation(context, fragmentAnimator.getEnter()); - } - return enterAnim; - } - - private Animation initExitAnim() { - if (fragmentAnimator.getExit() == 0) { - exitAnim = AnimationUtils.loadAnimation(context, R.anim.no_anim); - } else { - exitAnim = AnimationUtils.loadAnimation(context, fragmentAnimator.getExit()); - } - return exitAnim; - } - - private Animation initPopEnterAnim() { - if (fragmentAnimator.getPopEnter() == 0) { - popEnterAnim = AnimationUtils.loadAnimation(context, R.anim.no_anim); - } else { - popEnterAnim = AnimationUtils.loadAnimation(context, fragmentAnimator.getPopEnter()); - } - return popEnterAnim; - } - - private Animation initPopExitAnim() { - if (fragmentAnimator.getPopExit() == 0) { - popExitAnim = AnimationUtils.loadAnimation(context, R.anim.no_anim); - } else { - popExitAnim = AnimationUtils.loadAnimation(context, fragmentAnimator.getPopExit()); - } - return popExitAnim; - } - - Animation onCreateAnimation(BaseFragment baseFragment, int transit, boolean enter, int nextAnim) { - if (transit == FragmentTransaction.TRANSIT_FRAGMENT_OPEN) { - if (enter) { - return enterAnim; - } else { - return popExitAnim; - } - } else if (transit == FragmentTransaction.TRANSIT_FRAGMENT_CLOSE) { - if (enter) { - return popEnterAnim; - } else { - return exitAnim; - } - } - return null; - } - -} \ No newline at end of file diff --git a/lib_base/src/main/java/com/android/base/app/fragment/BaseFragment.java b/lib_base/src/main/java/com/android/base/app/fragment/BaseFragment.java index 71392c2..d61c027 100644 --- a/lib_base/src/main/java/com/android/base/app/fragment/BaseFragment.java +++ b/lib_base/src/main/java/com/android/base/app/fragment/BaseFragment.java @@ -46,7 +46,7 @@ public class BaseFragment extends Fragment implements LoadingView, OnBackPressLi /* just for cache*/ private View mCachedView; - private AnimatorHelper mAnimatorHelper; + private FragmentAnimatorHelper mFragmentAnimatorHelper; private final FragmentDelegates mFragmentDelegates = new FragmentDelegates(this); @@ -301,10 +301,10 @@ public class BaseFragment extends Fragment implements LoadingView, OnBackPressLi @Nullable @Override public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) { - if (mAnimatorHelper == null) { - mAnimatorHelper = new AnimatorHelper(getContext(), FragmentConfig.defaultFragmentAnimator()); + if (mFragmentAnimatorHelper == null) { + mFragmentAnimatorHelper = new FragmentAnimatorHelper(getContext(), FragmentConfig.defaultFragmentAnimator()); } - return mAnimatorHelper.onCreateAnimation(this, transit, enter, nextAnim); + return mFragmentAnimatorHelper.onCreateAnimation(transit, enter); } } \ No newline at end of file diff --git a/lib_base/src/main/java/com/android/base/app/fragment/DefaultHorizontalAnimator.java b/lib_base/src/main/java/com/android/base/app/fragment/DefaultHorizontalAnimator.java index 241a787..4883b09 100644 --- a/lib_base/src/main/java/com/android/base/app/fragment/DefaultHorizontalAnimator.java +++ b/lib_base/src/main/java/com/android/base/app/fragment/DefaultHorizontalAnimator.java @@ -1,44 +1,32 @@ package com.android.base.app.fragment; -import android.os.Parcel; -import android.os.Parcelable; +import android.view.animation.Animation; +import android.view.animation.AnimationUtils; import com.android.base.R; +import com.android.base.utils.BaseUtils; -public class DefaultHorizontalAnimator extends FragmentAnimator implements Parcelable { +public class DefaultHorizontalAnimator implements FragmentAnimator { - public DefaultHorizontalAnimator() { - enter = R.anim.h_fragment_enter; - exit = R.anim.h_fragment_exit; - popEnter = R.anim.h_fragment_pop_enter; - popExit = R.anim.h_fragment_pop_exit; + @Override + public Animation makeOpenEnter() { + return AnimationUtils.loadAnimation(BaseUtils.getAppContext(), R.anim.h_fragment_open_enter); } - protected DefaultHorizontalAnimator(Parcel in) { - super(in); + @Override + public Animation makeOpenExit() { + return AnimationUtils.loadAnimation(BaseUtils.getAppContext(), R.anim.h_fragment_open_exit); } @Override - public void writeToParcel(Parcel dest, int flags) { - super.writeToParcel(dest, flags); + public Animation makeCloseEnter() { + return AnimationUtils.loadAnimation(BaseUtils.getAppContext(), R.anim.h_fragment_close_enter); } @Override - public int describeContents() { - return 0; + public Animation makeCloseExit() { + return AnimationUtils.loadAnimation(BaseUtils.getAppContext(), R.anim.h_fragment_close_exit); } - public static final Creator CREATOR = new Creator() { - @Override - public DefaultHorizontalAnimator createFromParcel(Parcel in) { - return new DefaultHorizontalAnimator(in); - } - - @Override - public DefaultHorizontalAnimator[] newArray(int size) { - return new DefaultHorizontalAnimator[size]; - } - }; - } \ No newline at end of file diff --git a/lib_base/src/main/java/com/android/base/app/fragment/DefaultNoAnimator.java b/lib_base/src/main/java/com/android/base/app/fragment/DefaultNoAnimator.java index 645e04d..4944d82 100644 --- a/lib_base/src/main/java/com/android/base/app/fragment/DefaultNoAnimator.java +++ b/lib_base/src/main/java/com/android/base/app/fragment/DefaultNoAnimator.java @@ -1,42 +1,32 @@ package com.android.base.app.fragment; -import android.os.Parcel; -import android.os.Parcelable; +import android.view.animation.Animation; +import android.view.animation.AnimationUtils; -public class DefaultNoAnimator extends FragmentAnimator implements Parcelable { +import com.android.base.R; +import com.android.base.utils.BaseUtils; - public DefaultNoAnimator() { - enter = 0; - exit = 0; - popEnter = 0; - popExit = 0; - } +public class DefaultNoAnimator implements FragmentAnimator { - protected DefaultNoAnimator(Parcel in) { - super(in); + @Override + public Animation makeOpenEnter() { + return AnimationUtils.loadAnimation(BaseUtils.getAppContext(), R.anim.base_no_anim); } @Override - public void writeToParcel(Parcel dest, int flags) { - super.writeToParcel(dest, flags); + public Animation makeOpenExit() { + return AnimationUtils.loadAnimation(BaseUtils.getAppContext(), R.anim.base_no_anim); } @Override - public int describeContents() { - return 0; + public Animation makeCloseEnter() { + return AnimationUtils.loadAnimation(BaseUtils.getAppContext(), R.anim.base_no_anim); } - public static final Creator CREATOR = new Creator() { - @Override - public DefaultNoAnimator createFromParcel(Parcel in) { - return new DefaultNoAnimator(in); - } - - @Override - public DefaultNoAnimator[] newArray(int size) { - return new DefaultNoAnimator[size]; - } - }; + @Override + public Animation makeCloseExit() { + return AnimationUtils.loadAnimation(BaseUtils.getAppContext(), R.anim.base_no_anim); + } } \ No newline at end of file diff --git a/lib_base/src/main/java/com/android/base/app/fragment/DefaultScaleAnimator.java b/lib_base/src/main/java/com/android/base/app/fragment/DefaultScaleAnimator.java new file mode 100644 index 0000000..5cd75ff --- /dev/null +++ b/lib_base/src/main/java/com/android/base/app/fragment/DefaultScaleAnimator.java @@ -0,0 +1,56 @@ +package com.android.base.app.fragment; + + +import android.view.animation.AlphaAnimation; +import android.view.animation.Animation; +import android.view.animation.AnimationSet; +import android.view.animation.DecelerateInterpolator; +import android.view.animation.Interpolator; +import android.view.animation.ScaleAnimation; + + +public class DefaultScaleAnimator implements FragmentAnimator { + + private static final Interpolator DECELERATE_QUINT = new DecelerateInterpolator(2.5f); + private static final Interpolator DECELERATE_CUBIC = new DecelerateInterpolator(1.5f); + + private static final int ANIM_DUR = 220; + + @Override + public Animation makeOpenEnter() { + return makeOpenCloseAnimation(1.125f, 1.0f, 0, 1); + } + + @Override + public Animation makeOpenExit() { + return makeOpenCloseAnimation(1.0f, .975f, 1, 0); + } + + @Override + public Animation makeCloseEnter() { + return makeOpenCloseAnimation(.975f, 1.0f, 0, 1); + } + + @Override + public Animation makeCloseExit() { + return makeOpenCloseAnimation(1.0f, 1.075f, 1, 0); + } + + private static Animation makeOpenCloseAnimation(float startScale, float endScale, float startAlpha, float endAlpha) { + AnimationSet set = new AnimationSet(false); + + ScaleAnimation scale = new ScaleAnimation(startScale, endScale, startScale, endScale, + Animation.RELATIVE_TO_SELF, .5f, Animation.RELATIVE_TO_SELF, .5f); + scale.setInterpolator(DECELERATE_QUINT); + scale.setDuration(ANIM_DUR); + set.addAnimation(scale); + + AlphaAnimation alpha = new AlphaAnimation(startAlpha, endAlpha); + alpha.setInterpolator(DECELERATE_CUBIC); + alpha.setDuration(ANIM_DUR); + set.addAnimation(alpha); + + return set; + } + +} \ No newline at end of file diff --git a/lib_base/src/main/java/com/android/base/app/fragment/DefaultVerticalAnimator.java b/lib_base/src/main/java/com/android/base/app/fragment/DefaultVerticalAnimator.java index 868cea9..418d4b6 100644 --- a/lib_base/src/main/java/com/android/base/app/fragment/DefaultVerticalAnimator.java +++ b/lib_base/src/main/java/com/android/base/app/fragment/DefaultVerticalAnimator.java @@ -1,43 +1,31 @@ package com.android.base.app.fragment; -import android.os.Parcel; -import android.os.Parcelable; +import android.view.animation.Animation; +import android.view.animation.AnimationUtils; import com.android.base.R; +import com.android.base.utils.BaseUtils; -public class DefaultVerticalAnimator extends FragmentAnimator implements Parcelable { +public class DefaultVerticalAnimator implements FragmentAnimator { - public DefaultVerticalAnimator() { - enter = R.anim.v_fragment_enter; - exit = R.anim.v_fragment_exit; - popEnter = R.anim.v_fragment_pop_enter; - popExit = R.anim.v_fragment_pop_exit; + @Override + public Animation makeOpenEnter() { + return AnimationUtils.loadAnimation(BaseUtils.getAppContext(), R.anim.v_fragment_open_enter); } - protected DefaultVerticalAnimator(Parcel in) { - super(in); + @Override + public Animation makeOpenExit() { + return AnimationUtils.loadAnimation(BaseUtils.getAppContext(), R.anim.v_fragment_open_exit); } @Override - public void writeToParcel(Parcel dest, int flags) { - super.writeToParcel(dest, flags); + public Animation makeCloseEnter() { + return AnimationUtils.loadAnimation(BaseUtils.getAppContext(), R.anim.v_fragment_close_enter); } @Override - public int describeContents() { - return 0; + public Animation makeCloseExit() { + return AnimationUtils.loadAnimation(BaseUtils.getAppContext(), R.anim.v_fragment_close_exit); } - public static final Creator CREATOR = new Creator() { - @Override - public DefaultVerticalAnimator createFromParcel(Parcel in) { - return new DefaultVerticalAnimator(in); - } - - @Override - public DefaultVerticalAnimator[] newArray(int size) { - return new DefaultVerticalAnimator[size]; - } - }; - } \ No newline at end of file diff --git a/lib_base/src/main/java/com/android/base/app/fragment/FragmentAnimator.java b/lib_base/src/main/java/com/android/base/app/fragment/FragmentAnimator.java index de93ae5..16b07e5 100644 --- a/lib_base/src/main/java/com/android/base/app/fragment/FragmentAnimator.java +++ b/lib_base/src/main/java/com/android/base/app/fragment/FragmentAnimator.java @@ -1,105 +1,15 @@ package com.android.base.app.fragment; -import android.os.Parcel; -import android.os.Parcelable; +import android.view.animation.Animation; -import androidx.annotation.AnimRes; +public interface FragmentAnimator { -public class FragmentAnimator implements Parcelable { + Animation makeOpenEnter(); - @AnimRes protected int enter; - @AnimRes protected int exit; - @AnimRes protected int popEnter; - @AnimRes protected int popExit; + Animation makeOpenExit(); - public FragmentAnimator() { - } + Animation makeCloseEnter(); - public FragmentAnimator(int enter, int exit) { - this.enter = enter; - this.exit = exit; - } - - public FragmentAnimator(int enter, int exit, int popEnter, int popExit) { - this.enter = enter; - this.exit = exit; - this.popEnter = popEnter; - this.popExit = popExit; - } - - public FragmentAnimator copy() { - return new FragmentAnimator(getEnter(), getExit(), getPopEnter(), getPopExit()); - } - - protected FragmentAnimator(Parcel in) { - enter = in.readInt(); - exit = in.readInt(); - popEnter = in.readInt(); - popExit = in.readInt(); - } - - public static final Creator CREATOR = new Creator() { - @Override - public FragmentAnimator createFromParcel(Parcel in) { - return new FragmentAnimator(in); - } - - @Override - public FragmentAnimator[] newArray(int size) { - return new FragmentAnimator[size]; - } - }; - - public int getEnter() { - return enter; - } - - public FragmentAnimator setEnter(int enter) { - this.enter = enter; - return this; - } - - public int getExit() { - return exit; - } - - /** - * enter animation - */ - public FragmentAnimator setExit(int exit) { - this.exit = exit; - return this; - } - - public int getPopEnter() { - return popEnter; - } - - public FragmentAnimator setPopEnter(int popEnter) { - this.popEnter = popEnter; - return this; - } - - public int getPopExit() { - return popExit; - } - - public FragmentAnimator setPopExit(int popExit) { - this.popExit = popExit; - return this; - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(enter); - dest.writeInt(exit); - dest.writeInt(popEnter); - dest.writeInt(popExit); - } + Animation makeCloseExit(); } \ No newline at end of file diff --git a/lib_base/src/main/java/com/android/base/app/fragment/FragmentAnimatorHelper.java b/lib_base/src/main/java/com/android/base/app/fragment/FragmentAnimatorHelper.java new file mode 100644 index 0000000..0c8c44e --- /dev/null +++ b/lib_base/src/main/java/com/android/base/app/fragment/FragmentAnimatorHelper.java @@ -0,0 +1,103 @@ +package com.android.base.app.fragment; + +import android.content.Context; +import android.view.animation.Animation; +import android.view.animation.AnimationUtils; + +import com.android.base.R; + +import androidx.fragment.app.FragmentTransaction; + +public final class FragmentAnimatorHelper { + + private Context context; + private FragmentAnimator fragmentAnimator; + + FragmentAnimatorHelper(Context context, FragmentAnimator fragmentAnimator) { + this.context = context; + this.fragmentAnimator = fragmentAnimator; + } + + public void changeAnimation(FragmentAnimator fragmentAnimator) { + this.fragmentAnimator = fragmentAnimator; + } + + public Animation getNoneAnim() { + return AnimationUtils.loadAnimation(context, R.anim.base_no_anim); + } + + public Animation getNoneAnimFixed() { + return new Animation() { + }; + } + + private Animation initEnterAnim() { + if (fragmentAnimator == null) { + return AnimationUtils.loadAnimation(context, R.anim.base_no_anim); + } else { + Animation animation = fragmentAnimator.makeOpenEnter(); + if (animation == null) { + return AnimationUtils.loadAnimation(context, R.anim.base_no_anim); + } else { + return animation; + } + } + } + + private Animation initExitAnim() { + if (fragmentAnimator == null) { + return AnimationUtils.loadAnimation(context, R.anim.base_no_anim); + } else { + Animation animation = fragmentAnimator.makeOpenExit(); + if (animation == null) { + return AnimationUtils.loadAnimation(context, R.anim.base_no_anim); + } else { + return animation; + } + } + } + + private Animation initPopEnterAnim() { + if (fragmentAnimator == null) { + return AnimationUtils.loadAnimation(context, R.anim.base_no_anim); + } else { + Animation animation = fragmentAnimator.makeCloseEnter(); + if (animation == null) { + return AnimationUtils.loadAnimation(context, R.anim.base_no_anim); + } else { + return animation; + } + } + } + + private Animation initPopExitAnim() { + if (fragmentAnimator == null) { + return AnimationUtils.loadAnimation(context, R.anim.base_no_anim); + } else { + Animation animation = fragmentAnimator.makeCloseExit(); + if (animation == null) { + return AnimationUtils.loadAnimation(context, R.anim.base_no_anim); + } else { + return animation; + } + } + } + + Animation onCreateAnimation(int transit, boolean enter) { + if (transit == FragmentTransaction.TRANSIT_FRAGMENT_OPEN) { + if (enter) { + return initEnterAnim(); + } else { + return initExitAnim(); + } + } else if (transit == FragmentTransaction.TRANSIT_FRAGMENT_CLOSE) { + if (enter) { + return initPopEnterAnim(); + } else { + return initPopExitAnim(); + } + } + return null; + } + +} \ No newline at end of file diff --git a/lib_base/src/main/java/com/android/base/app/fragment/Fragments.kt b/lib_base/src/main/java/com/android/base/app/fragment/Fragments.kt index b3887a9..97bd1c2 100644 --- a/lib_base/src/main/java/com/android/base/app/fragment/Fragments.kt +++ b/lib_base/src/main/java/com/android/base/app/fragment/Fragments.kt @@ -277,13 +277,13 @@ class EnhanceFragmentTransaction constructor( * 如果 [tag] ==null 则使用 fragment 对应 class 的全限定类名。 */ fun addWithStack(containerId: Int = 0, fragment: Fragment, tag: String? = null, transition: Boolean = true): EnhanceFragmentTransaction { - //hide top - hideTopFragment() //set add to stack val nonnullTag = (tag ?: fragment.javaClassName()) addToBackStack(nonnullTag) //add fragmentTransaction.add(confirmLayoutId(containerId), fragment, nonnullTag) + //hide top + hideTopFragment() if (transition) { //set a transition setOpeningTransition() diff --git a/lib_base/src/main/java/com/android/base/utils/android/views/ResourceEx.kt b/lib_base/src/main/java/com/android/base/utils/android/views/ResourceEx.kt index 5ea10ae..343bd43 100644 --- a/lib_base/src/main/java/com/android/base/utils/android/views/ResourceEx.kt +++ b/lib_base/src/main/java/com/android/base/utils/android/views/ResourceEx.kt @@ -6,6 +6,7 @@ import android.content.Context import android.content.res.TypedArray import android.graphics.drawable.Drawable import android.net.Uri +import android.util.TypedValue import android.view.View import androidx.annotation.* @@ -66,10 +67,24 @@ fun Context.drawableFromId(@DrawableRes id: Int): Drawable? { * * 返回资源 id */ -fun getResource(name: String, defType: String, defPackage: String): Int { +fun getResourceId(name: String, defType: String, defPackage: String): Int { return BaseUtils.getResources().getIdentifier(name, defType, defPackage) } +/** + * - attr, like [android.R.attr.selectableItemBackground] or other attr id. + */ +fun getResourceId(context: Context, attr: Int): Int { + return try { + val outValue = TypedValue() + context.theme.resolveAttribute(attr, outValue, true) + outValue.resourceId + } catch (e: Exception) { + e.printStackTrace() + 0 + } +} + fun getText(@StringRes id: Int): CharSequence { return BaseUtils.getResources().getText(id) } diff --git a/lib_base/src/main/res/anim/no_anim.xml b/lib_base/src/main/res/anim/base_no_anim.xml similarity index 100% rename from lib_base/src/main/res/anim/no_anim.xml rename to lib_base/src/main/res/anim/base_no_anim.xml diff --git a/lib_base/src/main/res/anim/h_fragment_pop_enter.xml b/lib_base/src/main/res/anim/h_fragment_close_enter.xml similarity index 100% rename from lib_base/src/main/res/anim/h_fragment_pop_enter.xml rename to lib_base/src/main/res/anim/h_fragment_close_enter.xml diff --git a/lib_base/src/main/res/anim/h_fragment_close_exit.xml b/lib_base/src/main/res/anim/h_fragment_close_exit.xml new file mode 100644 index 0000000..9287ccd --- /dev/null +++ b/lib_base/src/main/res/anim/h_fragment_close_exit.xml @@ -0,0 +1,20 @@ + + + + + + + + \ No newline at end of file diff --git a/lib_base/src/main/res/anim/h_fragment_exit.xml b/lib_base/src/main/res/anim/h_fragment_exit.xml deleted file mode 100644 index d18e69e..0000000 --- a/lib_base/src/main/res/anim/h_fragment_exit.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/lib_base/src/main/res/anim/h_fragment_enter.xml b/lib_base/src/main/res/anim/h_fragment_open_enter.xml similarity index 100% rename from lib_base/src/main/res/anim/h_fragment_enter.xml rename to lib_base/src/main/res/anim/h_fragment_open_enter.xml diff --git a/lib_base/src/main/res/anim/h_fragment_open_exit.xml b/lib_base/src/main/res/anim/h_fragment_open_exit.xml new file mode 100644 index 0000000..fd600d2 --- /dev/null +++ b/lib_base/src/main/res/anim/h_fragment_open_exit.xml @@ -0,0 +1,19 @@ + + + + + + + + \ No newline at end of file diff --git a/lib_base/src/main/res/anim/h_fragment_pop_exit.xml b/lib_base/src/main/res/anim/h_fragment_pop_exit.xml deleted file mode 100644 index 1dd1579..0000000 --- a/lib_base/src/main/res/anim/h_fragment_pop_exit.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/lib_base/src/main/res/anim/pop_exit_no_anim.xml b/lib_base/src/main/res/anim/pop_exit_no_anim.xml deleted file mode 100644 index 208938a..0000000 --- a/lib_base/src/main/res/anim/pop_exit_no_anim.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/lib_base/src/main/res/anim/v_fragment_pop_enter.xml b/lib_base/src/main/res/anim/v_fragment_close_enter.xml similarity index 100% rename from lib_base/src/main/res/anim/v_fragment_pop_enter.xml rename to lib_base/src/main/res/anim/v_fragment_close_enter.xml diff --git a/lib_base/src/main/res/anim/v_fragment_exit.xml b/lib_base/src/main/res/anim/v_fragment_close_exit.xml similarity index 100% rename from lib_base/src/main/res/anim/v_fragment_exit.xml rename to lib_base/src/main/res/anim/v_fragment_close_exit.xml diff --git a/lib_base/src/main/res/anim/v_fragment_enter.xml b/lib_base/src/main/res/anim/v_fragment_open_enter.xml similarity index 100% rename from lib_base/src/main/res/anim/v_fragment_enter.xml rename to lib_base/src/main/res/anim/v_fragment_open_enter.xml diff --git a/lib_base/src/main/res/anim/v_fragment_pop_exit.xml b/lib_base/src/main/res/anim/v_fragment_open_exit.xml similarity index 100% rename from lib_base/src/main/res/anim/v_fragment_pop_exit.xml rename to lib_base/src/main/res/anim/v_fragment_open_exit.xml