summaryrefslogtreecommitdiffstats
path: root/core/java/com
diff options
context:
space:
mode:
authorFilip Gruszczynski <gruszczy@google.com>2014-10-23 10:56:24 -0700
committerFilip Gruszczynski <gruszczy@google.com>2014-10-23 10:56:24 -0700
commit625ec4849118f061a99558ad558b16020435a88d (patch)
treebe3537d2ff03d81cfdf556ea896db831d040e024 /core/java/com
parentce3d72e4ad78c16fd95f1fcba51cc241163cdb0d (diff)
downloadframeworks_base-625ec4849118f061a99558ad558b16020435a88d.zip
frameworks_base-625ec4849118f061a99558ad558b16020435a88d.tar.gz
frameworks_base-625ec4849118f061a99558ad558b16020435a88d.tar.bz2
Check if context is actually an activity.
Bug: 18101409 Change-Id: Iab21338ef4ccaab0ce66d664502e0b5e88ad9c50
Diffstat (limited to 'core/java/com')
-rw-r--r--core/java/com/android/internal/widget/SwipeDismissLayout.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/core/java/com/android/internal/widget/SwipeDismissLayout.java b/core/java/com/android/internal/widget/SwipeDismissLayout.java
index 7a4b23a..99b1bae 100644
--- a/core/java/com/android/internal/widget/SwipeDismissLayout.java
+++ b/core/java/com/android/internal/widget/SwipeDismissLayout.java
@@ -107,7 +107,9 @@ 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.
- ((Activity) context).convertFromTranslucent();
+ if (context instanceof Activity) {
+ ((Activity) context).convertFromTranslucent();
+ }
}
public void setOnDismissedListener(OnDismissedListener listener) {
@@ -203,7 +205,9 @@ public class SwipeDismissLayout extends FrameLayout {
mLastX = ev.getRawX();
updateSwiping(ev);
if (mSwiping) {
- ((Activity) getContext()).convertToTranslucent(null, null);
+ 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() {
- ((Activity) getContext()).convertFromTranslucent();
+ if (getContext() instanceof Activity) {
+ ((Activity) getContext()).convertFromTranslucent();
+ }
if (mProgressListener != null) {
mProgressListener.onSwipeCancelled(this);
}