Use the number of shown hotseat icons instead of database items to store into the DB

It seems this issue was originated from ag/14129534 and we should no
longer use numDatabaseHotseatIcons form IDP and use numShownHotseatIcons
from the DP.

Fix: 305119735
Flag: NA
Test: manuall testing, we don't have this test for landscape
Change-Id: Ie530748f9b77d89ac3298c187ae767643d505cb3
This commit is contained in:
Sebastian Franco committed 2023-11-15 21:34:38 -06:00
1 parent 572b5b09fd
commit 2d023e26c6
8 files changed
+83 -51

No files matched your search

@@ -28,7 +28,6 @@ import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherModel;
import com.android.launcher3.LauncherModel.CallbackTask;
import com.android.launcher3.LauncherSettings.Favorites;
@@ -74,7 +73,6 @@ public class ModelWriter {
@Nullable
private final Callbacks mOwner;
private final boolean mHasVerticalHotseat;
private final boolean mVerifyChanges;
// Keep track of delete operations that occur when an Undo option is present; we may not commit.
@@ -83,12 +81,10 @@ public class ModelWriter {
private final CellPosMapper mCellPosMapper;
public ModelWriter(Context context, LauncherModel model, BgDataModel dataModel,
boolean hasVerticalHotseat, boolean verifyChanges, CellPosMapper cellPosMapper,
@Nullable Callbacks owner) {
boolean verifyChanges, CellPosMapper cellPosMapper, @Nullable Callbacks owner) {
mContext = context;
mModel = model;
mBgDataModel = dataModel;
mHasVerticalHotseat = hasVerticalHotseat;
mVerifyChanges = verifyChanges;
mOwner = owner;
mCellPosMapper = cellPosMapper;
@@ -102,14 +98,8 @@ public class ModelWriter {
item.container = container;
item.cellX = modelPos.cellX;
item.cellY = modelPos.cellY;
// We store hotseat items in canonical form which is this orientation invariant position
// in the hotseat
if (container == Favorites.CONTAINER_HOTSEAT) {
item.screenId = mHasVerticalHotseat
? LauncherAppState.getIDP(mContext).numDatabaseHotseatIcons - cellY - 1 : cellX;
} else {
item.screenId = modelPos.screenId;
}
item.screenId = modelPos.screenId;
}
/**