Merging update and modify model callbacks
Instead of the dispatcher specifying the type, the UI checks th diff. This ensures that the UI is updated correctly in all paths Bug: 390572144 Flag: EXEMPT refactor Test: Manually verified folder edit path where these callbacks were getting dispatched Change-Id: Ib73eed5da87a847753a78453a48ab4fc495c1199
This commit is contained in:
1 parent
c562b3ce4e
commit
007cfecf5e
14 files changed
+211
-87
No files matched your search
@@ -1076,10 +1076,8 @@ public class CellLayout extends ViewGroup {
|
||||
int delay, boolean permanent, boolean adjustOccupied) {
|
||||
ShortcutAndWidgetContainer clc = getShortcutsAndWidgets();
|
||||
|
||||
if (clc.indexOfChild(child) != -1 && (child instanceof Reorderable)) {
|
||||
if (clc.indexOfChild(child) != -1 && (child instanceof Reorderable item)) {
|
||||
final CellLayoutLayoutParams lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
||||
final ItemInfo info = (ItemInfo) child.getTag();
|
||||
final Reorderable item = (Reorderable) child;
|
||||
|
||||
// We cancel any existing animations
|
||||
if (mReorderAnimators.containsKey(lp)) {
|
||||
@@ -1485,7 +1483,7 @@ public class CellLayout extends ViewGroup {
|
||||
lp.setCellX(lp.getTmpCellX());
|
||||
lp.setCellY(lp.getTmpCellY());
|
||||
if (requiresDbUpdate) {
|
||||
Launcher.cast(mActivity).getModelWriter().modifyItemInDatabase(info, container,
|
||||
mActivity.getModelWriter().modifyItemInDatabase(info, container,
|
||||
screenId, lp.getCellX(), lp.getCellY(), lp.cellHSpan, lp.cellVSpan);
|
||||
}
|
||||
}
|
||||
@@ -1855,8 +1853,7 @@ public class CellLayout extends ViewGroup {
|
||||
|
||||
public void markCellsAsOccupiedForView(View view) {
|
||||
if (view instanceof LauncherAppWidgetHostView
|
||||
&& view.getTag() instanceof LauncherAppWidgetInfo) {
|
||||
LauncherAppWidgetInfo info = (LauncherAppWidgetInfo) view.getTag();
|
||||
&& view.getTag() instanceof LauncherAppWidgetInfo info) {
|
||||
CellPos pos = mActivity.getCellPosMapper().mapModelToPresenter(info);
|
||||
mOccupied.markCells(pos.cellX, pos.cellY, info.spanX, info.spanY, true);
|
||||
return;
|
||||
@@ -1869,8 +1866,7 @@ public class CellLayout extends ViewGroup {
|
||||
|
||||
public void markCellsAsUnoccupiedForView(View view) {
|
||||
if (view instanceof LauncherAppWidgetHostView
|
||||
&& view.getTag() instanceof LauncherAppWidgetInfo) {
|
||||
LauncherAppWidgetInfo info = (LauncherAppWidgetInfo) view.getTag();
|
||||
&& view.getTag() instanceof LauncherAppWidgetInfo info) {
|
||||
CellPos pos = mActivity.getCellPosMapper().mapModelToPresenter(info);
|
||||
mOccupied.markCells(pos.cellX, pos.cellY, info.spanX, info.spanY, false);
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user