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

Commit baecc0b2 authored by Filip Gruszczynski's avatar Filip Gruszczynski Committed by Android (Google) Code Review
Browse files

Merge "Disable activity's translucency until it starts being swiped away." into lmp-sprout-dev

parents 55bc7dc4 3f8dd144
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.internal.widget;

import android.animation.TimeInterpolator;
import android.app.Activity;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
@@ -102,6 +103,11 @@ public class SwipeDismissLayout extends FrameLayout {
                android.R.integer.config_shortAnimTime);
        mCancelInterpolator = new DecelerateInterpolator(1.5f);
        mDismissInterpolator = new AccelerateInterpolator(1.5f);
        // SwipeDismissLayout assumes that the host Activity is translucent
        // and temporarily disables translucency when it is fully visible.
        // As soon as the user starts swiping, we will re-enable
        // translucency.
        ((Activity) context).convertFromTranslucent();
    }

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

    protected void cancel() {
        ((Activity) getContext()).convertFromTranslucent();
        if (mProgressListener != null) {
            mProgressListener.onSwipeCancelled(this);
        }
+4 −0
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@
        <item name="windowBackground">@color/black</item>
        <item name="windowContentOverlay">@null</item>
        <item name="windowIsFloating">false</item>
        <!-- We need the windows to be translucent for SwipeToDismiss layout
             to work properly. -->
        <item name="windowIsTranslucent">true</item>
        <item name="windowSwipeToDismiss">true</item>
    </style>
@@ -38,6 +40,8 @@
        <item name="windowBackground">@color/white</item>
        <item name="windowContentOverlay">@null</item>
        <item name="windowIsFloating">false</item>
        <!-- We need the windows to be translucent for SwipeToDismiss layout
             to work properly. -->
        <item name="windowIsTranslucent">true</item>
        <item name="windowSwipeToDismiss">true</item>
    </style>