diff options
author | Nilesh Agrawal <nileshagrawal@google.com> | 2014-01-09 17:14:01 -0800 |
---|---|---|
committer | Danesh M <daneshm90@gmail.com> | 2014-06-06 22:54:24 -0700 |
commit | ff307f908514c635a4e35c051014ad815a5fa965 (patch) | |
tree | 0afdf72979317e300a61c23c8ddc7c937e099b18 /src/com/android/launcher3/Hotseat.java | |
parent | f13fc619f41827beae0adf7cea8c8288dcbfa085 (diff) | |
download | android_packages_apps_Trebuchet-ff307f908514c635a4e35c051014ad815a5fa965.tar.gz android_packages_apps_Trebuchet-ff307f908514c635a4e35c051014ad815a5fa965.tar.bz2 android_packages_apps_Trebuchet-ff307f908514c635a4e35c051014ad815a5fa965.zip |
Allow DISABLE_ALL_APPS to be set using a system property.
- Moving the property to LauncherAppState
- The property is only read on dogfood builds.
The property can be set using setprop or /data/local.prop
Change-Id: I14c7354efb12edb93f97e81687a6f920cc634e9a
Diffstat (limited to 'src/com/android/launcher3/Hotseat.java')
-rw-r--r-- | src/com/android/launcher3/Hotseat.java | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java index 2812b4129..a09d83e79 100644 --- a/src/com/android/launcher3/Hotseat.java +++ b/src/com/android/launcher3/Hotseat.java @@ -95,6 +95,14 @@ public class Hotseat extends FrameLayout { return hasVerticalHotseat() ? (mContent.getCountY() - (rank + 1)) : 0; } + public boolean isAllAppsButtonRank(int rank) { + if (LauncherAppState.isDisableAllApps()) { + return false; + } else { + return rank == mAllAppsButtonRank; + } + } + /** This returns the coordinates of an app in a given cell, relative to the DragLayer */ Rect getCellCoordinates(int cellX, int cellY) { Rect coords = new Rect(); @@ -134,6 +142,39 @@ public class Hotseat extends FrameLayout { void resetLayout() { mContent.removeAllViewsInLayout(); + + if (!LauncherAppState.isDisableAllApps()) { + // 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); + Utilities.resizeIconDrawable(d); + allAppsButton.setCompoundDrawables(null, d, null, null); + + allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label)); + if (mLauncher != null) { + allAppsButton.setOnTouchListener(mLauncher.getHapticFeedbackTouchListener()); + } + allAppsButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(android.view.View v) { + if (mLauncher != null) { + mLauncher.onClickAllAppsButton(v); + } + } + }); + + // 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, 0, lp, true); + } } @Override @@ -149,7 +190,7 @@ public class Hotseat extends FrameLayout { void addAllAppsFolder(IconCache iconCache, ArrayList<AppInfo> allApps, ArrayList<ComponentName> onWorkspace, Launcher launcher, Workspace workspace) { - if (AppsCustomizePagedView.DISABLE_ALL_APPS) { + if (LauncherAppState.isDisableAllApps()) { FolderInfo fi = new FolderInfo(); fi.cellX = getCellXFromOrder(mAllAppsButtonRank); @@ -179,7 +220,7 @@ public class Hotseat extends FrameLayout { } void addAppsToAllAppsFolder(ArrayList<AppInfo> apps) { - if (AppsCustomizePagedView.DISABLE_ALL_APPS) { + if (LauncherAppState.isDisableAllApps()) { View v = mContent.getChildAt(getCellXFromOrder(mAllAppsButtonRank), getCellYFromOrder(mAllAppsButtonRank)); FolderIcon fi = null; |