Check if context is actually an activity.
Bug: 18101409 Change-Id: Iab21338ef4ccaab0ce66d664502e0b5e88ad9c50
This commit is contained in:
@@ -107,8 +107,10 @@ public class SwipeDismissLayout extends FrameLayout {
|
|||||||
// and temporarily disables translucency when it is fully visible.
|
// and temporarily disables translucency when it is fully visible.
|
||||||
// As soon as the user starts swiping, we will re-enable
|
// As soon as the user starts swiping, we will re-enable
|
||||||
// translucency.
|
// translucency.
|
||||||
|
if (context instanceof Activity) {
|
||||||
((Activity) context).convertFromTranslucent();
|
((Activity) context).convertFromTranslucent();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setOnDismissedListener(OnDismissedListener listener) {
|
public void setOnDismissedListener(OnDismissedListener listener) {
|
||||||
mDismissedListener = listener;
|
mDismissedListener = listener;
|
||||||
@@ -203,7 +205,9 @@ public class SwipeDismissLayout extends FrameLayout {
|
|||||||
mLastX = ev.getRawX();
|
mLastX = ev.getRawX();
|
||||||
updateSwiping(ev);
|
updateSwiping(ev);
|
||||||
if (mSwiping) {
|
if (mSwiping) {
|
||||||
|
if (getContext() instanceof Activity) {
|
||||||
((Activity) getContext()).convertToTranslucent(null, null);
|
((Activity) getContext()).convertToTranslucent(null, null);
|
||||||
|
}
|
||||||
setProgress(ev.getRawX() - mDownX);
|
setProgress(ev.getRawX() - mDownX);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -225,7 +229,9 @@ public class SwipeDismissLayout extends FrameLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void cancel() {
|
protected void cancel() {
|
||||||
|
if (getContext() instanceof Activity) {
|
||||||
((Activity) getContext()).convertFromTranslucent();
|
((Activity) getContext()).convertFromTranslucent();
|
||||||
|
}
|
||||||
if (mProgressListener != null) {
|
if (mProgressListener != null) {
|
||||||
mProgressListener.onSwipeCancelled(this);
|
mProgressListener.onSwipeCancelled(this);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user