Merge "Clear all DragView in onSaveInstanceState" into sc-v2-dev am: 7ac2a71b94
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/16425110 Change-Id: I60f6a9e8ae87bb011f9e7f4a7b11748415f044c1
This commit is contained in:
@@ -1637,6 +1637,8 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
|
|||||||
AbstractFloatingView.closeOpenViews(this, false, TYPE_ALL & ~TYPE_REBIND_SAFE);
|
AbstractFloatingView.closeOpenViews(this, false, TYPE_ALL & ~TYPE_REBIND_SAFE);
|
||||||
finishAutoCancelActionMode();
|
finishAutoCancelActionMode();
|
||||||
|
|
||||||
|
DragView.removeAllViews(this);
|
||||||
|
|
||||||
if (mPendingRequestArgs != null) {
|
if (mPendingRequestArgs != null) {
|
||||||
outState.putParcelable(RUNTIME_STATE_PENDING_REQUEST_ARGS, mPendingRequestArgs);
|
outState.putParcelable(RUNTIME_STATE_PENDING_REQUEST_ARGS, mPendingRequestArgs);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -565,4 +565,19 @@ public abstract class DragView<T extends Context & ActivityContext> extends Fram
|
|||||||
iv.setImageDrawable(drawable);
|
iv.setImageDrawable(drawable);
|
||||||
return iv;
|
return iv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes any stray DragView from the DragLayer.
|
||||||
|
*/
|
||||||
|
public static void removeAllViews(ActivityContext activity) {
|
||||||
|
BaseDragLayer dragLayer = activity.getDragLayer();
|
||||||
|
// Iterate in reverse order. DragView is added later to the dragLayer,
|
||||||
|
// and will be one of the last views.
|
||||||
|
for (int i = dragLayer.getChildCount() - 1; i >= 0; i--) {
|
||||||
|
View child = dragLayer.getChildAt(i);
|
||||||
|
if (child instanceof DragView) {
|
||||||
|
dragLayer.removeView(child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user