diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2016-06-15 15:42:29 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2016-06-17 08:17:22 -0700 |
commit | bb011dad4e69bec027be1e00d573a3095b318b43 (patch) | |
tree | 71c459e2f2c45584075087ce843cdbf692dadaf5 /src/com/android/launcher3/Hotseat.java | |
parent | 0af8af3a6090bc0309cb126a1ccfb2a66e058783 (diff) | |
download | android_packages_apps_Trebuchet-bb011dad4e69bec027be1e00d573a3095b318b43.tar.gz android_packages_apps_Trebuchet-bb011dad4e69bec027be1e00d573a3095b318b43.tar.bz2 android_packages_apps_Trebuchet-bb011dad4e69bec027be1e00d573a3095b318b43.zip |
Adding a flag (enabled by default) to remove the all-apps button.
All apps can still be opened by clicking the caret.
Bug: 29398447
Change-Id: I61f1b05cea83a0a49d7cc16c518c5419618ba779
Diffstat (limited to 'src/com/android/launcher3/Hotseat.java')
-rw-r--r-- | src/com/android/launcher3/Hotseat.java | 75 |
1 files changed, 35 insertions, 40 deletions
diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java index 7e1ecf5af..9f86a0b25 100644 --- a/src/com/android/launcher3/Hotseat.java +++ b/src/com/android/launcher3/Hotseat.java @@ -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; @@ -44,9 +45,6 @@ public class Hotseat extends FrameLayout private Launcher mLauncher; @ViewDebug.ExportedProperty(category = "launcher") - private int mAllAppsButtonRank; - - @ViewDebug.ExportedProperty(category = "launcher") private final boolean mHasVerticalHotseat; @ViewDebug.ExportedProperty(category = "launcher") @@ -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(); - - 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); - - 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); - } + 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); + + 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); + } - // 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); + // 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); + } } @Override |