summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authornebkat <nebkat@gmail.com>2012-12-24 05:48:51 -0800
committernebkat <nebkat@teamhacksung.org>2012-12-27 10:36:24 +0000
commit477017c309634ccdeadb1fdd2cf5057daa470e3c (patch)
treef6a6d2d9f2866d9d7d381049e58e9a31cd48c5a3 /src
parent5f6c9fbc6392f713cd24014d4a0fb76425c83189 (diff)
downloadandroid_packages_apps_Trebuchet-477017c309634ccdeadb1fdd2cf5057daa470e3c.tar.gz
android_packages_apps_Trebuchet-477017c309634ccdeadb1fdd2cf5057daa470e3c.tar.bz2
android_packages_apps_Trebuchet-477017c309634ccdeadb1fdd2cf5057daa470e3c.zip
Revert "Revert "Launcher: Trebuchet settings visibility""
This reverts commit 3872581cda9466b73cf40d388a84f20e5d8da00a Change-Id: I741e009242b5739ec22154fb1edba18530fbb0fd
Diffstat (limited to 'src')
-rw-r--r--src/com/cyanogenmod/trebuchet/Launcher.java51
1 files changed, 38 insertions, 13 deletions
diff --git a/src/com/cyanogenmod/trebuchet/Launcher.java b/src/com/cyanogenmod/trebuchet/Launcher.java
index 21cc4ec57..d87e40c97 100644
--- a/src/com/cyanogenmod/trebuchet/Launcher.java
+++ b/src/com/cyanogenmod/trebuchet/Launcher.java
@@ -1718,17 +1718,17 @@ public final class Launcher extends Activity
menu.add(0, MENU_MANAGE_APPS, 0, R.string.menu_manage_apps)
.setIcon(android.R.drawable.ic_menu_manage)
.setIntent(manageApps)
- .setAlphabeticShortcut('M');
- if (!getResources().getBoolean(R.bool.config_cyanogenmod)) {
- menu.add(0, MENU_PREFERENCES, 0, R.string.menu_preferences)
- .setIcon(android.R.drawable.ic_menu_preferences)
- .setIntent(preferences)
- .setAlphabeticShortcut('O');
- }
+ .setAlphabeticShortcut('A');
+
+ menu.add(0, MENU_PREFERENCES, 0, R.string.menu_preferences)
+ .setIcon(android.R.drawable.ic_menu_preferences)
+ .setIntent(preferences)
+ .setAlphabeticShortcut('P');
+
menu.add(0, MENU_SYSTEM_SETTINGS, 0, R.string.menu_settings)
.setIcon(android.R.drawable.ic_menu_preferences)
.setIntent(settings)
- .setAlphabeticShortcut('P');
+ .setAlphabeticShortcut('S');
if (!helpUrl.isEmpty()) {
menu.add(0, MENU_HELP, 0, R.string.menu_help)
.setIcon(android.R.drawable.ic_menu_help)
@@ -1748,6 +1748,15 @@ public final class Launcher extends Activity
boolean allAppsVisible = (mAppsCustomizeTabHost.getVisibility() == View.VISIBLE);
menu.setGroupVisible(MENU_GROUP_WALLPAPER, !allAppsVisible);
+ Intent launcherIntent = new Intent(Intent.ACTION_MAIN);
+ launcherIntent.addCategory(Intent.CATEGORY_HOME);
+ launcherIntent.addCategory(Intent.CATEGORY_DEFAULT);
+ ActivityInfo defaultLauncher = getPackageManager().resolveActivity(launcherIntent, PackageManager.MATCH_DEFAULT_ONLY).activityInfo;
+ // Hide preferences if not on CyanogenMod or not default launcher
+ // (in which case preferences don't get shown in system settings)
+ boolean preferencesVisible = !getPackageManager().hasSystemFeature("com.cyanogenmod.android") ||
+ !defaultLauncher.packageName.equals(getClass().getPackage().getName());
+ menu.findItem(MENU_PREFERENCES).setVisible(preferencesVisible);
return true;
}
@@ -3418,8 +3427,17 @@ public final class Launcher extends Activity
// Find the app market activity by resolving an intent.
// (If multiple app markets are installed, it will return the ResolverActivity.)
ComponentName activityName = intent.resolveActivity(getPackageManager());
- if (activityName != null && (ViewConfiguration.get(this).hasPermanentMenuKey() ||
- getResources().getBoolean(R.bool.config_cyanogenmod))) {
+
+ // Check to see if overflow menu is shown
+ Intent launcherIntent = new Intent(Intent.ACTION_MAIN);
+ launcherIntent.addCategory(Intent.CATEGORY_HOME);
+ launcherIntent.addCategory(Intent.CATEGORY_DEFAULT);
+ ActivityInfo defaultLauncher = getPackageManager().resolveActivity(launcherIntent, PackageManager.MATCH_DEFAULT_ONLY).activityInfo;
+ // Hide preferences if not on CyanogenMod or not default launcher
+ // (in which case preferences don't get shown in system settings)
+ boolean preferencesVisible = !getPackageManager().hasSystemFeature("com.cyanogenmod.android") ||
+ !defaultLauncher.packageName.equals(getClass().getPackage().getName());
+ if (activityName != null && (ViewConfiguration.get(this).hasPermanentMenuKey() || !preferencesVisible)) {
int coi = getCurrentOrientationIndexForGlobalIcons();
mAppMarketIntent = intent;
sAppMarketIcon[coi] = updateTextButtonWithIconFromExternalActivity(
@@ -3460,9 +3478,16 @@ public final class Launcher extends Activity
}
private void updateOverflowMenuButton() {
- View overflowMenuButton = findViewById(R.id.overflow_menu_button);
- if (ViewConfiguration.get(this).hasPermanentMenuKey() ||
- getResources().getBoolean(R.bool.config_cyanogenmod)) {
+ final View overflowMenuButton = findViewById(R.id.overflow_menu_button);
+ Intent launcherIntent = new Intent(Intent.ACTION_MAIN);
+ launcherIntent.addCategory(Intent.CATEGORY_HOME);
+ launcherIntent.addCategory(Intent.CATEGORY_DEFAULT);
+ ActivityInfo defaultLauncher = getPackageManager().resolveActivity(launcherIntent, PackageManager.MATCH_DEFAULT_ONLY).activityInfo;
+ // Hide preferences if not on CyanogenMod or not default launcher
+ // (in which case preferences don't get shown in system settings)
+ boolean preferencesVisible = !getPackageManager().hasSystemFeature("com.cyanogenmod.android") ||
+ !defaultLauncher.packageName.equals(getClass().getPackage().getName());
+ if (ViewConfiguration.get(this).hasPermanentMenuKey() || !preferencesVisible) {
overflowMenuButton.setVisibility(View.GONE);
overflowMenuButton.setEnabled(false);
} else {