summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/Hotseat.java
diff options
context:
space:
mode:
authorNilesh Agrawal <nileshagrawal@google.com>2014-01-09 17:14:01 -0800
committerDanesh M <daneshm90@gmail.com>2014-06-06 22:54:24 -0700
commitff307f908514c635a4e35c051014ad815a5fa965 (patch)
tree0afdf72979317e300a61c23c8ddc7c937e099b18 /src/com/android/launcher3/Hotseat.java
parentf13fc619f41827beae0adf7cea8c8288dcbfa085 (diff)
downloadandroid_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.java45
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;