Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5f15cd0f authored by Nishith  Khanna's avatar Nishith Khanna
Browse files

Merge branch '2845-u-vanishingdock' into 'v1-u'

Fix tablet dock vanishing on reorder and reset

See merge request e/os/BlissLauncher3!94
parents 7bdda63e f53d101b
Loading
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -847,14 +847,13 @@ public class Launcher extends StatefulActivity<LauncherState>
            mCellPosMapper = new TwoPanelCellPosMapper(mDeviceProfile.inv.numColumns);
        } else {
            if (mDeviceProfile.isLandscape) {
                mCellPosMapper = new CellPosMapper.TransposeCellPosMapper(mDeviceProfile.inv,
                        mDeviceProfile.isVerticalBarLayout(), mDeviceProfile.numShownHotseatIcons);
                mCellPosMapper = new CellPosMapper.TransposeCellPosMapper(mDeviceProfile.inv);
            } else {
                mCellPosMapper = new CellPosMapper(mDeviceProfile.isVerticalBarLayout(),
                        mDeviceProfile.numShownHotseatIcons);
                mCellPosMapper = CellPosMapper.DEFAULT;
            }
        }
        mModelWriter = mModel.getWriter(true, mCellPosMapper, this);
        mModelWriter = mModel.getWriter(getDeviceProfile().isVerticalBarLayout(), true,
                mCellPosMapper, this);
        return true;
    }

+4 −4
Original line number Diff line number Diff line
@@ -207,10 +207,10 @@ public class LauncherModel implements InstallSessionTracker.Callback {
    }

    @NonNull
    public ModelWriter getWriter(final boolean verifyChanges, CellPosMapper cellPosMapper,
            @Nullable final Callbacks owner) {
        return new ModelWriter(mApp.getContext(), this, mBgDataModel, verifyChanges, cellPosMapper,
                owner);
    public ModelWriter getWriter(final boolean hasVerticalHotseat, final boolean verifyChanges,
            CellPosMapper cellPosMapper, @Nullable final Callbacks owner) {
        return new ModelWriter(mApp.getContext(), this, mBgDataModel,
                hasVerticalHotseat, verifyChanges, cellPosMapper, owner);
    }

    /**
+4 −24
Original line number Diff line number Diff line
@@ -29,14 +29,9 @@ import java.util.Objects;
 */
public class CellPosMapper {

    public static final CellPosMapper DEFAULT = new CellPosMapper(false, -1);
    private final boolean mHasVerticalHotseat;
    private final int mNumOfHotseat;
    public static final CellPosMapper DEFAULT = new CellPosMapper();

    public CellPosMapper(boolean hasVerticalHotseat, int numOfHotseat) {
        mHasVerticalHotseat = hasVerticalHotseat;
        mNumOfHotseat = numOfHotseat;
    }
    private CellPosMapper() { }

    /**
     * Maps the position in model to the position in view
@@ -50,10 +45,6 @@ public class CellPosMapper {
     */
    public CellPos mapPresenterToModel(int presenterX, int presenterY, int presenterScreen,
            int container) {
        if (container == Favorites.CONTAINER_HOTSEAT) {
            presenterScreen = mHasVerticalHotseat
                    ? mNumOfHotseat - presenterY - 1 : presenterX;
        }
        return new CellPos(presenterX, presenterY, presenterScreen);
    }

@@ -65,9 +56,7 @@ public class CellPosMapper {

        private final InvariantDeviceProfile mIDP;

        public TransposeCellPosMapper(InvariantDeviceProfile idp,
                boolean hasVerticalHotseat, int numOfHotseat) {
            super(hasVerticalHotseat, numOfHotseat);
        public TransposeCellPosMapper(InvariantDeviceProfile idp) {
            this.mIDP = idp;
        }

@@ -105,7 +94,6 @@ public class CellPosMapper {
        private final int mColumnCount;

        public TwoPanelCellPosMapper(int columnCount) {
            super(false, -1);
            mColumnCount = columnCount;
        }

@@ -156,13 +144,5 @@ public class CellPosMapper {
        public int hashCode() {
            return Objects.hash(cellX, cellY, screenId);
        }

        @Override
        public String toString() {
            return "CellPos{"
                    + "cellX=" + cellX
                    + ", cellY=" + cellY
                    + ", screenId=" + screenId + '}';
        }
    }
}
+3 −2
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import com.android.launcher3.DragSource;
import com.android.launcher3.DropTarget;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.celllayout.CellPosMapper;
import com.android.launcher3.dragndrop.DragOptions;
import com.android.launcher3.logging.InstanceId;
import com.android.launcher3.logging.StatsLogManager.StatsLogger;
@@ -185,8 +186,8 @@ public class LauncherDelegate {
        @Override
        ModelWriter getModelWriter() {
            if (mWriter == null) {
                mWriter = LauncherAppState.getInstance((Context) mContext).getModel().getWriter(
                        false, mContext.getCellPosMapper(), null);
                mWriter = LauncherAppState.getInstance((Context) mContext).getModel()
                        .getWriter(false, false, CellPosMapper.DEFAULT, null);
            }
            return mWriter;
        }
+2 −1
Original line number Diff line number Diff line
@@ -386,7 +386,8 @@ public abstract class BaseLauncherBinder {
            }

            ModelWriter writer = mApp.getModel()
                    .getWriter(false /* verifyChanges */, CellPosMapper.DEFAULT, null);
                    .getWriter(mApp.getInvariantDeviceProfile().getDeviceProfile(mApp.getContext()).isVerticalBarLayout(),
                            false /* verifyChanges */, CellPosMapper.DEFAULT, null);
            List<Pair<ItemInfo, View>> bindItems = items.stream().map(i ->
                    Pair.create(i, inflater.inflateItem(i, writer, null))).toList();
            executeCallbacksTask(c -> c.bindInflatedItems(bindItems), executor);
Loading