diff options
-rw-r--r-- | res/values/config.xml | 2 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/Launcher.java | 51 |
2 files changed, 38 insertions, 15 deletions
diff --git a/res/values/config.xml b/res/values/config.xml index 86d29242d..e8fd70584 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -6,8 +6,6 @@ <!-- DragController --> <integer name="config_flingToDeleteMinVelocity">-1500</integer> - <bool name="config_cyanogenmod">false</bool> - <!-- AllApps/Customize/AppsCustomize --> <!-- Which default transition effect to use on the AppsCustomize --> <string name="config_drawerDefaultTransitionEffect">Stack</string> 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 { |