diff options
author | Jorge Ruesga <jorge@ruesga.com> | 2013-03-03 05:37:13 +0100 |
---|---|---|
committer | Nebojsa Cvetkovic <nebkat@gmail.com> | 2013-03-03 08:51:34 +0000 |
commit | 1e39be6b64d2fb996120079d221463f0ecd47897 (patch) | |
tree | 039366e48f07bb3d1bda6bce42e2cddf4a9c7c19 | |
parent | 1e20d97c20b1529cabf054cff3e99a6cd954512c (diff) | |
download | packages_apps_trebuchet-1e39be6b64d2fb996120079d221463f0ecd47897.zip packages_apps_trebuchet-1e39be6b64d2fb996120079d221463f0ecd47897.tar.gz packages_apps_trebuchet-1e39be6b64d2fb996120079d221463f0ecd47897.tar.bz2 |
Launcher: Fix overflow menu button
On rotate screen, at all apps drawer in Trebuchet, the overflow menu icon overlays the market
icon. This changes contains:
1.- Modify the app_customize_pane layout to avoid that overflow button and market button overlap
each other.
2.- Move updateOverflowMenuButton() from runNewAppsAnimation to bindAllApplications. The overflow
button need to be updated every time the all app drawer change.
3.- Fix preferencesVisible assignment. If we are in CM and launcher is Trebuchet and device
has not permanent button, the overflow menu should be displayed.
4.- Fix onCreateOptionsMenu. On AllAppsVisible the menu should be recreated always
5.- Buttons padding (market and overflow) are reduced to avoid a bad visual effect when
both buttons are one beside the other.
Before: https://www.dropbox.com/s/i9vgp6sh35nsnjt/before_phone_portrait.png
After: https://www.dropbox.com/s/es5j35ny1jf9ey8/after_phone_portrait.png
https://www.dropbox.com/s/6sztai1hq0w9ngr/after_phone_landscape.png
Patchset 2: Remove unnecessary invalidateOptionsMenu() call
Change-Id: I7ec08ff00ed4705846c0b46639965899b16a143d
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
-rw-r--r-- | res/layout-sw720dp/market_button.xml | 4 | ||||
-rw-r--r-- | res/layout/apps_customize_pane.xml | 28 | ||||
-rw-r--r-- | res/layout/market_button.xml | 4 | ||||
-rw-r--r-- | res/layout/overflow_menu_button.xml | 4 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/Launcher.java | 22 |
5 files changed, 29 insertions, 33 deletions
diff --git a/res/layout-sw720dp/market_button.xml b/res/layout-sw720dp/market_button.xml index 7eaeafa..632d0c8 100644 --- a/res/layout-sw720dp/market_button.xml +++ b/res/layout-sw720dp/market_button.xml @@ -18,8 +18,8 @@ style="@style/MarketButton" android:onClick="onClickAppMarketButton" android:gravity="center" - android:paddingLeft="32dp" - android:paddingRight="32dp" + android:paddingLeft="8dp" + android:paddingRight="8dp" android:drawablePadding="10dp" android:background="@drawable/tab_widget_indicator_selector" android:text="@string/market" diff --git a/res/layout/apps_customize_pane.xml b/res/layout/apps_customize_pane.xml index bee51d7..507c2b6 100644 --- a/res/layout/apps_customize_pane.xml +++ b/res/layout/apps_customize_pane.xml @@ -40,18 +40,26 @@ android:background="@drawable/tab_unselected_holo" android:tabStripEnabled="false" android:divider="@null" /> - <include - android:id="@+id/overflow_menu_button" - layout="@layout/overflow_menu_button" + <RelativeLayout android:layout_width="wrap_content" android:layout_height="match_parent" - android:layout_gravity="right" /> - <include - android:id="@+id/market_button" - layout="@layout/market_button" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_gravity="right" /> + android:background="@drawable/tab_unselected_holo" + android:orientation="horizontal" + android:layout_gravity="right"> + <include + android:id="@+id/overflow_menu_button" + layout="@layout/overflow_menu_button" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_alignParentRight="true" /> + <include + android:id="@+id/market_button" + layout="@layout/market_button" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_toLeftOf="@id/overflow_menu_button" + android:layout_alignWithParentIfMissing="true" /> + </RelativeLayout> </FrameLayout> <FrameLayout android:id="@android:id/tabcontent" diff --git a/res/layout/market_button.xml b/res/layout/market_button.xml index 41e6ec7..461aec4 100644 --- a/res/layout/market_button.xml +++ b/res/layout/market_button.xml @@ -18,8 +18,8 @@ style="@style/MarketButton" android:onClick="onClickAppMarketButton" android:gravity="center" - android:paddingLeft="16dp" - android:paddingRight="16dp" + android:paddingLeft="5dp" + android:paddingRight="5dp" android:background="@drawable/tab_widget_indicator_selector" android:contentDescription="@string/market" android:shadowColor="@color/workspace_all_apps_and_delete_zone_text_shadow_color" diff --git a/res/layout/overflow_menu_button.xml b/res/layout/overflow_menu_button.xml index 9438cc6..d7b7371 100644 --- a/res/layout/overflow_menu_button.xml +++ b/res/layout/overflow_menu_button.xml @@ -20,8 +20,8 @@ android:onClick="onClickOverflowMenuButton" android:drawableLeft="@drawable/ic_menu_overflow" android:gravity="center" - android:paddingLeft="16dp" - android:paddingRight="16dp" + android:paddingLeft="5dp" + android:paddingRight="5dp" android:background="@drawable/tab_widget_indicator_selector" android:contentDescription="@string/menu" android:shadowColor="@color/workspace_all_apps_and_delete_zone_text_shadow_color" diff --git a/src/com/cyanogenmod/trebuchet/Launcher.java b/src/com/cyanogenmod/trebuchet/Launcher.java index 320b869..adcb61c 100644 --- a/src/com/cyanogenmod/trebuchet/Launcher.java +++ b/src/com/cyanogenmod/trebuchet/Launcher.java @@ -3314,17 +3314,7 @@ 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()); - - // 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)) { + if (activityName != null) { int coi = getCurrentOrientationIndexForGlobalIcons(); mAppMarketIntent = intent; sAppMarketIcon[coi] = updateTextButtonWithIconFromExternalActivity( @@ -3374,12 +3364,10 @@ public final class Launcher extends Activity // (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 { - overflowMenuButton.setVisibility(View.VISIBLE); - } + + boolean disabled = ViewConfiguration.get(this).hasPermanentMenuKey() || !preferencesVisible; + overflowMenuButton.setVisibility(disabled ? View.GONE : View.VISIBLE); + overflowMenuButton.setEnabled(!disabled); } /** |