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

Commit b977ade1 authored by Filip Gruszczynski's avatar Filip Gruszczynski Committed by Android Git Automerger
Browse files

am 625ec484: Check if context is actually an activity.

* commit '625ec484':
  Check if context is actually an activity.
parents 713869b2 625ec484
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -107,8 +107,10 @@ public class SwipeDismissLayout extends FrameLayout {
        // and temporarily disables translucency when it is fully visible.
        // As soon as the user starts swiping, we will re-enable
        // translucency.
        if (context instanceof Activity) {
            ((Activity) context).convertFromTranslucent();
        }
    }

    public void setOnDismissedListener(OnDismissedListener listener) {
        mDismissedListener = listener;
@@ -203,7 +205,9 @@ public class SwipeDismissLayout extends FrameLayout {
                mLastX = ev.getRawX();
                updateSwiping(ev);
                if (mSwiping) {
                    if (getContext() instanceof Activity) {
                        ((Activity) getContext()).convertToTranslucent(null, null);
                    }
                    setProgress(ev.getRawX() - mDownX);
                    break;
                }
@@ -225,7 +229,9 @@ public class SwipeDismissLayout extends FrameLayout {
    }

    protected void cancel() {
        if (getContext() instanceof Activity) {
            ((Activity) getContext()).convertFromTranslucent();
        }
        if (mProgressListener != null) {
            mProgressListener.onSwipeCancelled(this);
        }