Adding a flag (enabled by default) to remove the all-apps button.

am: bb011dad4e

Change-Id: I5d95b0c92db6be330256b51b8c90781efaa76413
This commit is contained in:
Sunny Goyal
2016-06-17 15:25:30 +00:00
committed by android-build-merger
13 changed files with 99 additions and 108 deletions
@@ -37,6 +37,7 @@ import android.util.Patterns;
import com.android.launcher3.LauncherProvider.SqlArguments;
import com.android.launcher3.LauncherSettings.Favorites;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.util.Thunk;
import org.xmlpull.v1.XmlPullParser;
@@ -157,7 +158,7 @@ public class AutoInstallsLayout {
protected final Resources mSourceRes;
protected final int mLayoutId;
private final int mHotseatAllAppsRank;
private final InvariantDeviceProfile mIdp;
private final int mRowCount;
private final int mColumnCount;
@@ -181,10 +182,9 @@ public class AutoInstallsLayout {
mSourceRes = res;
mLayoutId = layoutId;
InvariantDeviceProfile idp = LauncherAppState.getInstance().getInvariantDeviceProfile();
mHotseatAllAppsRank = idp.hotseatAllAppsRank;
mRowCount = idp.numRows;
mColumnCount = idp.numColumns;
mIdp = LauncherAppState.getInstance().getInvariantDeviceProfile();
mRowCount = mIdp.numRows;
mColumnCount = mIdp.numColumns;
}
/**
@@ -231,7 +231,8 @@ public class AutoInstallsLayout {
out[0] = Favorites.CONTAINER_HOTSEAT;
// Hack: hotseat items are stored using screen ids
long rank = Long.parseLong(getAttributeValue(parser, ATTR_RANK));
out[1] = (rank < mHotseatAllAppsRank) ? rank : (rank + 1);
out[1] = (FeatureFlags.NO_ALL_APPS_ICON || rank < mIdp.getAllAppsButtonRank())
? rank : (rank + 1);
} else {
out[0] = Favorites.CONTAINER_DESKTOP;
out[1] = Long.parseLong(getAttributeValue(parser, ATTR_SCREEN));
+4 -8
View File
@@ -239,14 +239,12 @@ public class FocusHelper {
if (keyCode == KeyEvent.KEYCODE_DPAD_UP &&
!profile.isVerticalBarLayout()) {
matrix = FocusLogic.createSparseMatrixWithHotseat(iconLayout, hotseatLayout,
true /* hotseat horizontal */, profile.inv.hotseatAllAppsRank);
matrix = FocusLogic.createSparseMatrixWithHotseat(iconLayout, hotseatLayout, profile);
iconIndex += iconParent.getChildCount();
parent = iconParent;
} else if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT &&
profile.isVerticalBarLayout()) {
matrix = FocusLogic.createSparseMatrixWithHotseat(iconLayout, hotseatLayout,
false /* hotseat horizontal */, profile.inv.hotseatAllAppsRank);
matrix = FocusLogic.createSparseMatrixWithHotseat(iconLayout, hotseatLayout, profile);
iconIndex += iconParent.getChildCount();
parent = iconParent;
} else if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT &&
@@ -372,12 +370,10 @@ public class FocusHelper {
// to take a user to the hotseat. For other dpad navigation, do not use the matrix extended
// with the hotseat.
if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN && !profile.isVerticalBarLayout()) {
matrix = FocusLogic.createSparseMatrixWithHotseat(iconLayout, hotseatLayout,
true /* horizontal */, profile.inv.hotseatAllAppsRank);
matrix = FocusLogic.createSparseMatrixWithHotseat(iconLayout, hotseatLayout, profile);
} else if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT &&
profile.isVerticalBarLayout()) {
matrix = FocusLogic.createSparseMatrixWithHotseat(iconLayout, hotseatLayout,
false /* horizontal */, profile.inv.hotseatAllAppsRank);
matrix = FocusLogic.createSparseMatrixWithHotseat(iconLayout, hotseatLayout, profile);
} else if (isUninstallKeyChord(e)) {
matrix = FocusLogic.createSparseMatrix(iconLayout);
if (UninstallDropTarget.supportsDrop(launcher, itemInfo)) {
+32 -37
View File
@@ -31,6 +31,7 @@ import android.view.ViewDebug;
import android.widget.FrameLayout;
import android.widget.TextView;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.dynamicui.ExtractedColors;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.userevent.nano.LauncherLogProto;
@@ -43,9 +44,6 @@ public class Hotseat extends FrameLayout
private Launcher mLauncher;
@ViewDebug.ExportedProperty(category = "launcher")
private int mAllAppsButtonRank;
@ViewDebug.ExportedProperty(category = "launcher")
private final boolean mHasVerticalHotseat;
@@ -106,16 +104,10 @@ public class Hotseat extends FrameLayout
return mHasVerticalHotseat ? (mContent.getCountY() - (rank + 1)) : 0;
}
public boolean isAllAppsButtonRank(int rank) {
return rank == mAllAppsButtonRank;
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
DeviceProfile grid = mLauncher.getDeviceProfile();
mAllAppsButtonRank = grid.inv.hotseatAllAppsRank;
mContent = (CellLayout) findViewById(R.id.layout);
if (grid.isLandscape && !grid.isLargeTablet) {
mContent.setGridSize(1, (int) grid.inv.numHotseatIcons);
@@ -130,38 +122,41 @@ public class Hotseat extends FrameLayout
void resetLayout() {
mContent.removeAllViewsInLayout();
// Add the Apps button
Context context = getContext();
if (!FeatureFlags.NO_ALL_APPS_ICON) {
// Add the Apps button
Context context = getContext();
int allAppsButtonRank = mLauncher.getDeviceProfile().inv.getAllAppsButtonRank();
LayoutInflater inflater = LayoutInflater.from(context);
TextView allAppsButton = (TextView)
inflater.inflate(R.layout.all_apps_button, mContent, false);
Drawable d = context.getResources().getDrawable(R.drawable.all_apps_button_icon);
LayoutInflater inflater = LayoutInflater.from(context);
TextView allAppsButton = (TextView)
inflater.inflate(R.layout.all_apps_button, mContent, false);
Drawable d = context.getResources().getDrawable(R.drawable.all_apps_button_icon);
mLauncher.resizeIconDrawable(d);
int scaleDownPx = getResources().getDimensionPixelSize(R.dimen.all_apps_button_scale_down);
Rect bounds = d.getBounds();
d.setBounds(bounds.left, bounds.top + scaleDownPx / 2, bounds.right - scaleDownPx,
bounds.bottom - scaleDownPx / 2);
allAppsButton.setCompoundDrawables(null, d, null, null);
mLauncher.resizeIconDrawable(d);
int scaleDownPx = getResources().getDimensionPixelSize(R.dimen.all_apps_button_scale_down);
Rect bounds = d.getBounds();
d.setBounds(bounds.left, bounds.top + scaleDownPx / 2, bounds.right - scaleDownPx,
bounds.bottom - scaleDownPx / 2);
allAppsButton.setCompoundDrawables(null, d, null, null);
allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label));
allAppsButton.setOnKeyListener(new HotseatIconKeyEventListener());
if (mLauncher != null) {
mLauncher.setAllAppsButton(allAppsButton);
allAppsButton.setOnTouchListener(mLauncher.getHapticFeedbackTouchListener());
allAppsButton.setOnClickListener(mLauncher);
allAppsButton.setOnLongClickListener(mLauncher);
allAppsButton.setOnFocusChangeListener(mLauncher.mFocusHandler);
allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label));
allAppsButton.setOnKeyListener(new HotseatIconKeyEventListener());
if (mLauncher != null) {
mLauncher.setAllAppsButton(allAppsButton);
allAppsButton.setOnTouchListener(mLauncher.getHapticFeedbackTouchListener());
allAppsButton.setOnClickListener(mLauncher);
allAppsButton.setOnLongClickListener(mLauncher);
allAppsButton.setOnFocusChangeListener(mLauncher.mFocusHandler);
}
// Note: We do this to ensure that the hotseat is always laid out in the orientation of
// the hotseat in order regardless of which orientation they were added
int x = getCellXFromOrder(allAppsButtonRank);
int y = getCellYFromOrder(allAppsButtonRank);
CellLayout.LayoutParams lp = new CellLayout.LayoutParams(x, y, 1, 1);
lp.canReorder = false;
mContent.addViewToCellLayout(allAppsButton, -1, allAppsButton.getId(), lp, true);
}
// Note: We do this to ensure that the hotseat is always laid out in the orientation of
// the hotseat in order regardless of which orientation they were added
int x = getCellXFromOrder(mAllAppsButtonRank);
int y = getCellYFromOrder(mAllAppsButtonRank);
CellLayout.LayoutParams lp = new CellLayout.LayoutParams(x,y,1,1);
lp.canReorder = false;
mContent.addViewToCellLayout(allAppsButton, -1, allAppsButton.getId(), lp, true);
}
@Override
@@ -23,6 +23,8 @@ import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.util.Thunk;
import java.util.ArrayList;
@@ -77,9 +79,6 @@ public class InvariantDeviceProfile {
float hotseatIconSize;
int defaultLayoutId;
// Derived invariant properties
public int hotseatAllAppsRank;
DeviceProfile landscapeProfile;
DeviceProfile portraitProfile;
@@ -141,7 +140,6 @@ public class InvariantDeviceProfile {
numRows = closestProfile.numRows;
numColumns = closestProfile.numColumns;
numHotseatIcons = closestProfile.numHotseatIcons;
hotseatAllAppsRank = (int) (numHotseatIcons / 2);
defaultLayoutId = closestProfile.defaultLayoutId;
numFolderRows = closestProfile.numFolderRows;
numFolderColumns = closestProfile.numFolderColumns;
@@ -304,6 +302,17 @@ public class InvariantDeviceProfile {
return this;
}
public int getAllAppsButtonRank() {
if (ProviderConfig.IS_DOGFOOD_BUILD && FeatureFlags.NO_ALL_APPS_ICON) {
throw new IllegalAccessError("Accessing all apps rank when all-apps is disabled");
}
return numHotseatIcons / 2;
}
public boolean isAllAppsButtonRank(int rank) {
return rank == getAllAppsButtonRank();
}
private float weight(float x0, float y0, float x1, float y1, float pow) {
float d = dist(x0, y0, x1, y1);
if (Float.compare(d, 0f) == 0) {
+9 -17
View File
@@ -1457,13 +1457,14 @@ public class Launcher extends Activity
/**
* Sets the all apps button. This method is called from {@link Hotseat}.
* TODO: Get rid of this.
*/
public void setAllAppsButton(View allAppsButton) {
mAllAppsButton = allAppsButton;
}
public View getAllAppsButton() {
return mAllAppsButton;
public View getStartViewForAllAppsRevealAnimation() {
return FeatureFlags.NO_ALL_APPS_ICON ? mPageIndicator : mAllAppsButton;
}
public View getWidgetsButton() {
@@ -2491,7 +2492,7 @@ public class Launcher extends Activity
if (v instanceof FolderIcon) {
onClickFolderIcon(v);
}
} else if (v instanceof PageIndicator || v == mAllAppsButton) {
} else if (v instanceof PageIndicator || (v == mAllAppsButton && mAllAppsButton != null)) {
onClickAllAppsButton(v);
} else if (tag instanceof AppInfo) {
startAppShortcutOrInfoActivity(v);
@@ -3096,7 +3097,7 @@ public class Launcher extends Activity
if (isWorkspaceLocked()) return false;
if (mState != State.WORKSPACE) return false;
if (v == mAllAppsButton) {
if (v == mAllAppsButton && mAllAppsButton != null) {
onLongClickAllAppsButton(v);
return true;
}
@@ -3127,7 +3128,6 @@ public class Launcher extends Activity
// The hotseat touch handling does not go through Workspace, and we always allow long press
// on hotseat items.
final boolean inHotseat = isHotseatLayout(v);
if (!mDragController.isDragging()) {
if (itemUnderLongClick == null) {
// User long pressed on empty space
@@ -3138,13 +3138,12 @@ public class Launcher extends Activity
} else {
showOverviewMode(true);
mHotseat.requestDisallowInterceptTouchEvent(true);
}
} else {
final boolean isAllAppsButton = inHotseat && isAllAppsButtonRank(
mHotseat.getOrderInHotseat(
longClickCellInfo.cellX,
longClickCellInfo.cellY));
final boolean isAllAppsButton =
!FeatureFlags.NO_ALL_APPS_ICON && isHotseatLayout(v) &&
mDeviceProfile.inv.isAllAppsButtonRank(mHotseat.getOrderInHotseat(
longClickCellInfo.cellX, longClickCellInfo.cellY));
if (!(itemUnderLongClick instanceof Folder || isAllAppsButton)) {
// User long pressed on an item
mWorkspace.startDrag(longClickCellInfo);
@@ -3989,13 +3988,6 @@ public class Launcher extends Activity
}
}
public boolean isAllAppsButtonRank(int rank) {
if (mHotseat != null) {
return mHotseat.isAllAppsButtonRank(rank);
}
return false;
}
private boolean canRunNewAppsAnimation() {
long diff = System.currentTimeMillis() - mDragController.getLastGestureUpTime();
return diff > (NEW_APPS_ANIMATION_INACTIVE_TIMEOUT_SECONDS * 1000)
@@ -439,7 +439,6 @@ public class LauncherBackupHelper implements BackupHelper {
data.desktopRows = profile.numRows;
data.desktopCols = profile.numColumns;
data.hotseatCount = profile.numHotseatIcons;
data.allappsRank = profile.hotseatAllAppsRank;
return data;
}
+2 -3
View File
@@ -196,7 +196,6 @@ public class LauncherModel extends BroadcastReceiver
public void bindAppInfosRemoved(ArrayList<AppInfo> appInfos);
public void notifyWidgetProvidersChanged();
public void bindWidgetsModel(WidgetsModel model);
public boolean isAllAppsButtonRank(int rank);
public void onPageBoundSynchronously(int page);
public void executeOnNextDraw(ViewOnDrawExecutor executor);
}
@@ -1450,8 +1449,8 @@ public class LauncherModel extends BroadcastReceiver
long containerIndex = item.screenId;
if (item.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
// Return early if we detect that an item is under the hotseat button
if (mCallbacks == null ||
mCallbacks.get().isAllAppsButtonRank((int) item.screenId)) {
if (!FeatureFlags.NO_ALL_APPS_ICON &&
profile.isAllAppsButtonRank((int) item.screenId)) {
Log.e(TAG, "Error loading shortcut into hotseat " + item
+ " into position (" + item.screenId + ":" + item.cellX + ","
+ item.cellY + ") occupied by all apps");
@@ -142,7 +142,7 @@ public class LauncherStateTransitionAnimation {
public void startAnimationToAllApps(final Workspace.State fromWorkspaceState,
final boolean animated, final boolean startSearchAfterTransition) {
final AllAppsContainerView toView = mLauncher.getAppsView();
final View buttonView = mLauncher.getAllAppsButton();
final View buttonView = mLauncher.getStartViewForAllAppsRevealAnimation();
PrivateTransitionCallbacks cb = new PrivateTransitionCallbacks(1f) {
@Override
public float getMaterialRevealViewStartFinalRadius() {
@@ -525,7 +525,7 @@ public class LauncherStateTransitionAnimation {
};
// Only animate the search bar if animating to spring loaded mode from all apps
mCurrentAnimation = startAnimationToWorkspaceFromOverlay(fromWorkspaceState, toWorkspaceState,
mLauncher.getAllAppsButton(), appsView,
mLauncher.getStartViewForAllAppsRevealAnimation(), appsView,
animated, type, onCompleteRunnable, cb);
}
+2 -2
View File
@@ -2509,9 +2509,9 @@ public class Workspace extends PagedView
// Don't show the message if we are dropping on the AllApps button and the hotseat
// is full
boolean isHotseat = mLauncher.isHotseatLayout(dropTargetLayout);
if (mTargetCell != null && isHotseat) {
if (mTargetCell != null && isHotseat && !FeatureFlags.NO_ALL_APPS_ICON) {
Hotseat hotseat = mLauncher.getHotseat();
if (hotseat.isAllAppsButtonRank(
if (mLauncher.getDeviceProfile().inv.isAllAppsButtonRank(
hotseat.getOrderInHotseat(mTargetCell[0], mTargetCell[1]))) {
return false;
}
@@ -49,7 +49,7 @@ public class GridSizeMigrationTask {
private static final boolean DEBUG = true;
private static final String KEY_MIGRATION_SRC_WORKSPACE_SIZE = "migration_src_workspace_size";
private static final String KEY_MIGRATION_SRC_HOTSEAT_SIZE = "migration_src_hotseat_size";
private static final String KEY_MIGRATION_SRC_HOTSEAT_COUNT = "migration_src_hotseat_count";
// Set of entries indicating minimum size a widget can be resized to. This is used during
// restore in case the widget has not been installed yet.
@@ -78,9 +78,7 @@ public class GridSizeMigrationTask {
private final boolean mShouldRemoveX, mShouldRemoveY;
private final int mSrcHotseatSize;
private final int mSrcAllAppsRank;
private final int mDestHotseatSize;
private final int mDestAllAppsRank;
protected GridSizeMigrationTask(Context context, InvariantDeviceProfile idp,
HashSet<String> validPackages, HashMap<String, Point> widgetMinSize,
@@ -100,22 +98,19 @@ public class GridSizeMigrationTask {
mShouldRemoveY = mTrgY < mSrcY;
// Non-used variables
mSrcHotseatSize = mSrcAllAppsRank = mDestHotseatSize = mDestAllAppsRank = -1;
mSrcHotseatSize = mDestHotseatSize = -1;
}
protected GridSizeMigrationTask(Context context,
InvariantDeviceProfile idp, HashSet<String> validPackages,
int srcHotseatSize, int srcAllAppsRank,
int destHotseatSize, int destAllAppsRank) {
int srcHotseatSize, int destHotseatSize) {
mContext = context;
mIdp = idp;
mValidPackages = validPackages;
mSrcHotseatSize = srcHotseatSize;
mSrcAllAppsRank = srcAllAppsRank;
mDestHotseatSize = destHotseatSize;
mDestAllAppsRank = destAllAppsRank;
// Non-used variables
mSrcX = mSrcY = mTrgX = mTrgY = -1;
@@ -187,7 +182,7 @@ public class GridSizeMigrationTask {
}
newScreenId++;
if (newScreenId == mDestAllAppsRank) {
if (!FeatureFlags.NO_ALL_APPS_ICON && mIdp.isAllAppsButtonRank(newScreenId)) {
newScreenId++;
}
}
@@ -894,8 +889,7 @@ public class GridSizeMigrationTask {
Utilities.getPrefs(context).edit()
.putString(KEY_MIGRATION_SRC_WORKSPACE_SIZE,
getPointString((int) srcProfile.desktopCols, (int) srcProfile.desktopRows))
.putString(KEY_MIGRATION_SRC_HOTSEAT_SIZE,
getPointString((int) srcProfile.hotseatCount, srcProfile.allappsRank))
.putInt(KEY_MIGRATION_SRC_HOTSEAT_COUNT, (int) srcProfile.hotseatCount)
.putStringSet(KEY_MIGRATION_WIDGET_MINSIZE, widgets)
.apply();
}
@@ -909,10 +903,9 @@ public class GridSizeMigrationTask {
InvariantDeviceProfile idp = LauncherAppState.getInstance().getInvariantDeviceProfile();
String gridSizeString = getPointString(idp.numColumns, idp.numRows);
String hotseatSizeString = getPointString(idp.numHotseatIcons, idp.hotseatAllAppsRank);
if (gridSizeString.equals(prefs.getString(KEY_MIGRATION_SRC_WORKSPACE_SIZE, "")) &&
hotseatSizeString.equals(prefs.getString(KEY_MIGRATION_SRC_HOTSEAT_SIZE, ""))) {
idp.numHotseatIcons != prefs.getInt(KEY_MIGRATION_SRC_HOTSEAT_COUNT, idp.numHotseatIcons)) {
// Skip if workspace and hotseat sizes have not changed.
return true;
}
@@ -923,17 +916,13 @@ public class GridSizeMigrationTask {
HashSet validPackages = getValidPackages(context);
// Hotseat
Point srcHotseatSize = parsePoint(prefs.getString(
KEY_MIGRATION_SRC_HOTSEAT_SIZE, hotseatSizeString));
if (srcHotseatSize.x != idp.numHotseatIcons ||
srcHotseatSize.y != idp.hotseatAllAppsRank) {
int srcHotseatCount = prefs.getInt(KEY_MIGRATION_SRC_HOTSEAT_COUNT, idp.numHotseatIcons);
if (srcHotseatCount != idp.numHotseatIcons) {
// Migrate hotseat.
dbChanged = new GridSizeMigrationTask(context,
LauncherAppState.getInstance().getInvariantDeviceProfile(),
validPackages,
srcHotseatSize.x, srcHotseatSize.y,
idp.numHotseatIcons, idp.hotseatAllAppsRank).migrateHotseat();
validPackages, srcHotseatCount, idp.numHotseatIcons).migrateHotseat();
}
// Grid size
@@ -1014,7 +1003,7 @@ public class GridSizeMigrationTask {
// Save current configuration, so that the migration does not run again.
prefs.edit()
.putString(KEY_MIGRATION_SRC_WORKSPACE_SIZE, gridSizeString)
.putString(KEY_MIGRATION_SRC_HOTSEAT_SIZE, hotseatSizeString)
.putInt(KEY_MIGRATION_SRC_HOTSEAT_COUNT, idp.numHotseatIcons)
.remove(KEY_MIGRATION_WIDGET_MINSIZE)
.apply();
}
+12 -5
View File
@@ -22,7 +22,10 @@ import android.view.View;
import android.view.ViewGroup;
import com.android.launcher3.CellLayout;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.ShortcutAndWidgetContainer;
import com.android.launcher3.config.FeatureFlags;
import java.util.Arrays;
@@ -190,15 +193,17 @@ public class FocusLogic {
* in portrait orientation. In landscape, [(icon + hotseat) column count x (icon row count)]
*/
// TODO: get rid of the dynamic matrix creation
public static int[][] createSparseMatrixWithHotseat(CellLayout iconLayout,
CellLayout hotseatLayout, boolean isHotseatHorizontal, int allappsiconRank) {
public static int[][] createSparseMatrixWithHotseat(
CellLayout iconLayout, CellLayout hotseatLayout, DeviceProfile dp) {
ViewGroup iconParent = iconLayout.getShortcutsAndWidgets();
ViewGroup hotseatParent = hotseatLayout.getShortcutsAndWidgets();
boolean moreIconsInHotseatThanWorkspace = isHotseatHorizontal ?
hotseatLayout.getCountX() > iconLayout.getCountX() :
hotseatLayout.getCountY() > iconLayout.getCountY();
boolean isHotseatHorizontal = !dp.isVerticalBarLayout();
boolean moreIconsInHotseatThanWorkspace = !FeatureFlags.NO_ALL_APPS_ICON &&
(isHotseatHorizontal
? hotseatLayout.getCountX() > iconLayout.getCountX()
: hotseatLayout.getCountY() > iconLayout.getCountY());
int m, n;
if (isHotseatHorizontal) {
@@ -210,6 +215,7 @@ public class FocusLogic {
}
int[][] matrix = createFullMatrix(m, n);
if (moreIconsInHotseatThanWorkspace) {
int allappsiconRank = dp.inv.getAllAppsButtonRank();
if (isHotseatHorizontal) {
for (int j = 0; j < n; j++) {
matrix[allappsiconRank][j] = ALL_APPS_COLUMN;
@@ -229,6 +235,7 @@ public class FocusLogic {
int cx = ((CellLayout.LayoutParams) cell.getLayoutParams()).cellX;
int cy = ((CellLayout.LayoutParams) cell.getLayoutParams()).cellY;
if (moreIconsInHotseatThanWorkspace) {
int allappsiconRank = dp.inv.getAllAppsButtonRank();
if (isHotseatHorizontal && cx >= allappsiconRank) {
// Add 1 to account for the All Apps button.
cx++;
@@ -33,4 +33,6 @@ public final class FeatureFlags {
// Feature flag to enable moving the QSB on the 0th screen of the workspace
public static final boolean QSB_ON_FIRST_SCREEN = true;
// When enabled the all-apps icon is not added to the hotseat.
public static final boolean NO_ALL_APPS_ICON = true;
}
@@ -58,7 +58,8 @@ public class GridSizeMigrationTaskTest extends ProviderTestCase2<TestLauncherPro
addItem(APPLICATION, 4, HOTSEAT, 0, 0),
};
new GridSizeMigrationTask(getMockContext(), mIdp, mValidPackages, 5, 2, 3, 1)
mIdp.numHotseatIcons = 3;
new GridSizeMigrationTask(getMockContext(), mIdp, mValidPackages, 5, 3)
.migrateHotseat();
// First & last items are dropped as they have the least weight.
verifyHotseat(hotseatItems[1], -1, hotseatItems[3]);
@@ -73,7 +74,8 @@ public class GridSizeMigrationTaskTest extends ProviderTestCase2<TestLauncherPro
addItem(10, 4, HOTSEAT, 0, 0),
};
new GridSizeMigrationTask(getMockContext(), mIdp, mValidPackages, 5, 2, 3, 1)
mIdp.numHotseatIcons = 3;
new GridSizeMigrationTask(getMockContext(), mIdp, mValidPackages, 5, 3)
.migrateHotseat();
// First & third items are dropped as they have the least weight.
verifyHotseat(hotseatItems[1], -1, hotseatItems[4]);