Merge "Disable activity's translucency until it starts being swiped away." into lmp-sprout-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
baecc0b2d1
@@ -17,6 +17,7 @@
|
|||||||
package com.android.internal.widget;
|
package com.android.internal.widget;
|
||||||
|
|
||||||
import android.animation.TimeInterpolator;
|
import android.animation.TimeInterpolator;
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -102,6 +103,11 @@ public class SwipeDismissLayout extends FrameLayout {
|
|||||||
android.R.integer.config_shortAnimTime);
|
android.R.integer.config_shortAnimTime);
|
||||||
mCancelInterpolator = new DecelerateInterpolator(1.5f);
|
mCancelInterpolator = new DecelerateInterpolator(1.5f);
|
||||||
mDismissInterpolator = new AccelerateInterpolator(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) {
|
public void setOnDismissedListener(OnDismissedListener listener) {
|
||||||
@@ -197,6 +203,7 @@ public class SwipeDismissLayout extends FrameLayout {
|
|||||||
mLastX = ev.getRawX();
|
mLastX = ev.getRawX();
|
||||||
updateSwiping(ev);
|
updateSwiping(ev);
|
||||||
if (mSwiping) {
|
if (mSwiping) {
|
||||||
|
((Activity) getContext()).convertToTranslucent(null, null);
|
||||||
setProgress(ev.getRawX() - mDownX);
|
setProgress(ev.getRawX() - mDownX);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -218,6 +225,7 @@ public class SwipeDismissLayout extends FrameLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void cancel() {
|
protected void cancel() {
|
||||||
|
((Activity) getContext()).convertFromTranslucent();
|
||||||
if (mProgressListener != null) {
|
if (mProgressListener != null) {
|
||||||
mProgressListener.onSwipeCancelled(this);
|
mProgressListener.onSwipeCancelled(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
<item name="windowBackground">@color/black</item>
|
<item name="windowBackground">@color/black</item>
|
||||||
<item name="windowContentOverlay">@null</item>
|
<item name="windowContentOverlay">@null</item>
|
||||||
<item name="windowIsFloating">false</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="windowIsTranslucent">true</item>
|
||||||
<item name="windowSwipeToDismiss">true</item>
|
<item name="windowSwipeToDismiss">true</item>
|
||||||
</style>
|
</style>
|
||||||
@@ -38,6 +40,8 @@
|
|||||||
<item name="windowBackground">@color/white</item>
|
<item name="windowBackground">@color/white</item>
|
||||||
<item name="windowContentOverlay">@null</item>
|
<item name="windowContentOverlay">@null</item>
|
||||||
<item name="windowIsFloating">false</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="windowIsTranslucent">true</item>
|
||||||
<item name="windowSwipeToDismiss">true</item>
|
<item name="windowSwipeToDismiss">true</item>
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user