Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3f3ec782 authored by Andrey Epin's avatar Andrey Epin Committed by Automerger Merge Worker
Browse files

Merge "Add null-safety checks" into tm-qpr-dev am: 4c318891 am: abd9f849

parents acb54193 abd9f849
Loading
Loading
Loading
Loading
+14 −7
Original line number Diff line number Diff line
@@ -2953,12 +2953,14 @@ public class ChooserActivity extends ResolverActivity implements

    private void startFinishAnimation() {
        View rootView = findRootView();
        if (rootView != null) {
            rootView.startAnimation(new FinishAnimation(this, rootView));
        }
    }

    private boolean maybeCancelFinishAnimation() {
        View rootView = findRootView();
        Animation animation = rootView.getAnimation();
        Animation animation = rootView == null ? null : rootView.getAnimation();
        if (animation instanceof FinishAnimation) {
            boolean hasEnded = animation.hasEnded();
            animation.cancel();
@@ -4086,11 +4088,13 @@ public class ChooserActivity extends ResolverActivity implements
     */
    private static class FinishAnimation extends AlphaAnimation implements
            Animation.AnimationListener {
        @Nullable
        private Activity mActivity;
        @Nullable
        private View mRootView;
        private final float mFromAlpha;

        FinishAnimation(Activity activity, View rootView) {
        FinishAnimation(@NonNull Activity activity, @NonNull View rootView) {
            super(rootView.getAlpha(), 0.0f);
            mActivity = activity;
            mRootView = rootView;
@@ -4114,7 +4118,9 @@ public class ChooserActivity extends ResolverActivity implements

        @Override
        public void cancel() {
            if (mRootView != null) {
                mRootView.setAlpha(mFromAlpha);
            }
            cleanup();
            super.cancel();
        }
@@ -4125,9 +4131,10 @@ public class ChooserActivity extends ResolverActivity implements

        @Override
        public void onAnimationEnd(Animation animation) {
            if (mActivity != null) {
                mActivity.finish();
            Activity activity = mActivity;
            cleanup();
            if (activity != null) {
                activity.finish();
            }
        }