diff options
author | Filip Gruszczynski <gruszczy@google.com> | 2015-02-23 18:05:27 -0800 |
---|---|---|
committer | Filip Gruszczynski <gruszczy@google.com> | 2015-02-24 16:59:45 -0800 |
commit | 23958c6e2ffd4e76a88bc553fe2874d2f5f3f5e2 (patch) | |
tree | 0b8049cab215d58a0d3bb8f17d180afe6a79d699 /core | |
parent | c0c395162ff14b83694158663470ad60e065d9a9 (diff) | |
download | frameworks_base-23958c6e2ffd4e76a88bc553fe2874d2f5f3f5e2.zip frameworks_base-23958c6e2ffd4e76a88bc553fe2874d2f5f3f5e2.tar.gz frameworks_base-23958c6e2ffd4e76a88bc553fe2874d2f5f3f5e2.tar.bz2 |
Force translucency from windowIsTranslucent on SwipeDismissLayout.
Bug: 18799741
Change-Id: Ifb05869f1bf080d7555d7728dc085c41cc2c277c
Diffstat (limited to 'core')
-rw-r--r-- | core/java/com/android/internal/widget/SwipeDismissLayout.java | 13 | ||||
-rw-r--r-- | core/res/res/values/attrs.xml | 8 | ||||
-rw-r--r-- | core/res/res/values/themes_micro.xml | 6 |
3 files changed, 16 insertions, 11 deletions
diff --git a/core/java/com/android/internal/widget/SwipeDismissLayout.java b/core/java/com/android/internal/widget/SwipeDismissLayout.java index d617c05..89990c2 100644 --- a/core/java/com/android/internal/widget/SwipeDismissLayout.java +++ b/core/java/com/android/internal/widget/SwipeDismissLayout.java @@ -19,6 +19,7 @@ package com.android.internal.widget; import android.animation.TimeInterpolator; import android.app.Activity; import android.content.Context; +import android.content.res.TypedArray; import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; @@ -38,6 +39,7 @@ public class SwipeDismissLayout extends FrameLayout { private static final String TAG = "SwipeDismissLayout"; private static final float DISMISS_MIN_DRAG_WIDTH_RATIO = .33f; + private boolean mUseDynamicTranslucency = true; public interface OnDismissedListener { void onDismissed(SwipeDismissLayout layout); @@ -85,7 +87,7 @@ 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 (getContext() instanceof Activity) { + if (mUseDynamicTranslucency && getContext() instanceof Activity) { ((Activity) getContext()).convertFromTranslucent(); } } @@ -117,6 +119,11 @@ public class SwipeDismissLayout extends FrameLayout { android.R.integer.config_shortAnimTime); mCancelInterpolator = new DecelerateInterpolator(1.5f); mDismissInterpolator = new AccelerateInterpolator(1.5f); + TypedArray a = context.getTheme().obtainStyledAttributes( + com.android.internal.R.styleable.Theme); + mUseDynamicTranslucency = !a.hasValue( + com.android.internal.R.styleable.Window_windowIsTranslucent); + a.recycle(); } public void setOnDismissedListener(OnDismissedListener listener) { @@ -230,7 +237,7 @@ public class SwipeDismissLayout extends FrameLayout { mLastX = ev.getRawX(); updateSwiping(ev); if (mSwiping) { - if (getContext() instanceof Activity) { + if (mUseDynamicTranslucency && getContext() instanceof Activity) { ((Activity) getContext()).convertToTranslucent(null, null); } setProgress(ev.getRawX() - mDownX); @@ -254,7 +261,7 @@ public class SwipeDismissLayout extends FrameLayout { } protected void cancel() { - if (getContext() instanceof Activity) { + if (mUseDynamicTranslucency && getContext() instanceof Activity) { ((Activity) getContext()).convertFromTranslucent(); } if (mProgressListener != null) { diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index 2fd7d30..8492eaa 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -329,7 +329,9 @@ <attr name="windowOverscan" format="boolean" /> <!-- Flag indicating whether this is a floating window. --> <attr name="windowIsFloating" format="boolean" /> - <!-- Flag indicating whether this is a translucent window. --> + <!-- Flag indicating whether this is a translucent window. If this attribute is unset (but + not if set to false), the window might still be considered translucent, if + windowSwipeToDismiss is set to true. --> <attr name="windowIsTranslucent" format="boolean" /> <!-- Flag indicating that this window's background should be the user's current wallpaper. Corresponds @@ -455,7 +457,9 @@ <attr name="windowTranslucentNavigation" format="boolean" /> <!-- Flag to indicate that a window can be swiped away to be dismissed. - Corresponds to {@link android.view.Window#FEATURE_SWIPE_TO_DISMISS} --> + Corresponds to {@link android.view.Window#FEATURE_SWIPE_TO_DISMISS}. It will also + dynamically change translucency of the window, if the windowIsTranslucent is not set. + If windowIsTranslucent is set (to either true or false) it will obey that setting. --> <attr name="windowSwipeToDismiss" format="boolean" /> <!-- Flag indicating whether this window requests that content changes be performed diff --git a/core/res/res/values/themes_micro.xml b/core/res/res/values/themes_micro.xml index 1ebc708..e730dff 100644 --- a/core/res/res/values/themes_micro.xml +++ b/core/res/res/values/themes_micro.xml @@ -24,9 +24,6 @@ <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> <!-- Required to force windowInsets dispatch through application UI. --> <item name="windowOverscan">true</item> @@ -42,9 +39,6 @@ <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> <!-- Required to force windowInsets dispatch through application UI. --> <item name="windowOverscan">true</item> |