Merge "Fix bug with resize frame in Launcher3." into sc-v2-dev am: ea38519fa4 am: 6bfd14613b
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/16057107 Change-Id: I1c600ea73a6e37bb79794650efa003874703e757
This commit is contained in:
@@ -215,7 +215,7 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O
|
||||
|
||||
dl.addView(frame);
|
||||
frame.mIsOpen = true;
|
||||
frame.snapToWidget(false);
|
||||
frame.post(() -> frame.snapToWidget(false));
|
||||
}
|
||||
|
||||
private void setupForWidget(LauncherAppWidgetHostView widgetView, CellLayout cellLayout,
|
||||
|
||||
@@ -1391,22 +1391,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
|
||||
final LauncherAppWidgetHostView launcherHostView = (LauncherAppWidgetHostView) hostView;
|
||||
CellLayout cellLayout = getCellLayout(launcherInfo.container, launcherInfo.screenId);
|
||||
if (mStateManager.getState() == NORMAL) {
|
||||
// Show resize frame once the widget layout is drawn.
|
||||
View.OnLayoutChangeListener onLayoutChangeListener =
|
||||
new View.OnLayoutChangeListener() {
|
||||
@Override
|
||||
public void onLayoutChange(View view, int left, int top, int right,
|
||||
int bottom, int oldLeft, int oldTop, int oldRight,
|
||||
int oldBottom) {
|
||||
AppWidgetResizeFrame.showForWidget(launcherHostView, cellLayout);
|
||||
launcherHostView.removeOnLayoutChangeListener(this);
|
||||
}
|
||||
};
|
||||
launcherHostView.addOnLayoutChangeListener(onLayoutChangeListener);
|
||||
// There is a small chance that the layout was already drawn before the layout
|
||||
// change listener was registered, which means that the resize frame wouldn't be
|
||||
// shown. Directly call requestLayout to force a layout change.
|
||||
launcherHostView.requestLayout();
|
||||
AppWidgetResizeFrame.showForWidget(launcherHostView, cellLayout);
|
||||
} else {
|
||||
mStateManager.addStateListener(new StateManager.StateListener<LauncherState>() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user