From 49767aefe5b32d523ba1e43696f8adafa64a778f Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Mon, 29 Nov 2010 14:48:30 -0800 Subject: [PATCH] Adding background protection for tab labels in AllApps/Customize and modified padding to match mockups. Change-Id: I7f3b37d892fdf5a702a66d68e1bbdf333068d7ec --- res/color/tab_widget_indicator_color.xml | 20 ++++++++++++ res/drawable-hdpi/tab_selected_focused_holo.9.png | Bin 0 -> 218 bytes res/drawable-hdpi/tab_selected_holo.9.png | Bin 0 -> 159 bytes .../tab_selected_pressed_focused_holo.9.png | Bin 0 -> 522 bytes res/drawable-hdpi/tab_selected_pressed_holo.9.png | Bin 0 -> 271 bytes .../tab_unselected_focused_holo.9.png | Bin 0 -> 216 bytes res/drawable-hdpi/tab_unselected_holo.9.png | Bin 131 -> 147 bytes .../tab_unselected_pressed_focused_holo.9.png | Bin 0 -> 536 bytes .../tab_unselected_pressed_holo.9.png | Bin 0 -> 265 bytes res/drawable-mdpi/tab_selected_focused_holo.9.png | Bin 0 -> 203 bytes res/drawable-mdpi/tab_selected_holo.9.png | Bin 0 -> 144 bytes .../tab_selected_pressed_focused_holo.9.png | Bin 0 -> 454 bytes res/drawable-mdpi/tab_selected_pressed_holo.9.png | Bin 0 -> 231 bytes .../tab_unselected_focused_holo.9.png | Bin 0 -> 196 bytes .../tab_unselected_pressed_focused_holo.9.png | Bin 0 -> 459 bytes .../tab_unselected_pressed_holo.9.png | Bin 0 -> 223 bytes res/drawable/tab_widget_indicator_selector.xml | 34 ++++++++++++++++++++ res/layout-xlarge-land/all_apps_tabbed.xml | 2 +- res/layout-xlarge-land/launcher.xml | 2 +- res/layout-xlarge/tab_widget_indicator.xml | 35 +++++++++++++++++++++ src/com/android/launcher2/AllAppsTabbed.java | 21 +++++++++---- src/com/android/launcher2/Launcher.java | 26 ++++++++++----- 22 files changed, 124 insertions(+), 16 deletions(-) create mode 100644 res/color/tab_widget_indicator_color.xml create mode 100644 res/drawable-hdpi/tab_selected_focused_holo.9.png create mode 100644 res/drawable-hdpi/tab_selected_holo.9.png create mode 100644 res/drawable-hdpi/tab_selected_pressed_focused_holo.9.png create mode 100644 res/drawable-hdpi/tab_selected_pressed_holo.9.png create mode 100644 res/drawable-hdpi/tab_unselected_focused_holo.9.png create mode 100644 res/drawable-hdpi/tab_unselected_pressed_focused_holo.9.png create mode 100644 res/drawable-hdpi/tab_unselected_pressed_holo.9.png create mode 100644 res/drawable-mdpi/tab_selected_focused_holo.9.png create mode 100644 res/drawable-mdpi/tab_selected_holo.9.png create mode 100644 res/drawable-mdpi/tab_selected_pressed_focused_holo.9.png create mode 100644 res/drawable-mdpi/tab_selected_pressed_holo.9.png create mode 100644 res/drawable-mdpi/tab_unselected_focused_holo.9.png create mode 100644 res/drawable-mdpi/tab_unselected_pressed_focused_holo.9.png create mode 100644 res/drawable-mdpi/tab_unselected_pressed_holo.9.png create mode 100644 res/drawable/tab_widget_indicator_selector.xml create mode 100644 res/layout-xlarge/tab_widget_indicator.xml diff --git a/res/color/tab_widget_indicator_color.xml b/res/color/tab_widget_indicator_color.xml new file mode 100644 index 000000000..cbe9e3e19 --- /dev/null +++ b/res/color/tab_widget_indicator_color.xml @@ -0,0 +1,20 @@ + + + + + + + diff --git a/res/drawable-hdpi/tab_selected_focused_holo.9.png b/res/drawable-hdpi/tab_selected_focused_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..1ba35d554811207106066427813fcb04219ceca0 GIT binary patch literal 218 zcmeAS@N?(olHy`uVBq!ia0vp^Ahs6=8<1?uI(iXEu@pObhHwBu4M$1`kk47*5n0T@ zz}*SLjOHg#uLTO$c)B=-cyzwKX3N!Jz|;27Jm`Z{+)9fIj;{i;N3<&!`V|J|{B5-A z;!Me$|7>w|K&ao+XnFQk7J`XUo4O4v85%kQ<{q~VH7tofBIkbFfWgQ6*{|@6L0sMH zQYIM}7C1Ju@&04vYT*C4$z_>o`B!zj&#WE%f_zopr0H#GqV*mgE literal 0 HcmV?d00001 diff --git a/res/drawable-hdpi/tab_selected_holo.9.png b/res/drawable-hdpi/tab_selected_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..ef913cc8e5934d06c04d90547972f2c5ef4179ba GIT binary patch literal 159 zcmeAS@N?(olHy`uVBq!ia0vp^EI=&4!3HD^x83^;5-4`^4B-HR8jh3>AfL0qBeIx* zfx8og8O=|gUJDd-^mK6yk(iqNU! w14Yi9OG`fx&=|@MQYSb^i_N2f@$PSi2|ERZALZLD1scZS>FVdQ&MBb@0Gc5ykpKVy literal 0 HcmV?d00001 diff --git a/res/drawable-hdpi/tab_selected_pressed_focused_holo.9.png b/res/drawable-hdpi/tab_selected_pressed_focused_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..d7e968806aed3d191fae9f7b4adacd19697ec317 GIT binary patch literal 522 zcmV+l0`>igP)Y1NsF{aOK#K&;wFc$Z$xU^={HaR;mz@qPDK%u{~pFAqmB${!Ru73zB$v zOMmS5*G~YjT)qxAl30}CAaY~_U{l7aYXLy}_nWO7cDv^-0IXKG!R_Vl*AWc>0YD&y zlwbVr(3w%fr1LE3KXMGr42d)SPC~dCH0k=0Lkpd3GDn5xDltV>3XMdo%uz7^ogn>V@560bfA5((B0S2iz-E2Wt04z_4dP<YpSBT8lrJKTrMg2EfG8n8-eoq$FOo$>0! zRWLIb+6;Zq1UiaIR#Yw8kfWw^tdJRsVhZ)d1(3A|qKRy0Lsz|LbmFrjV#Cj4Yi$bv zjp+jb%#KH6`{j-Vfc54uIz-0n@&4*x9FYElBi5S(kPhjS_j+@{H`$fQ!T=IjPXGV_ M07*qoM6N<$g0^_tDgXcg literal 0 HcmV?d00001 diff --git a/res/drawable-hdpi/tab_selected_pressed_holo.9.png b/res/drawable-hdpi/tab_selected_pressed_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..b8b1fcfe26558d8465c82a517b81f59ed9e15673 GIT binary patch literal 271 zcmeAS@N?(olHy`uVBq!ia0vp^EI{nV!3HGfEdH7V5-4`^4B-HR8jh3>AfL0qBeIx* zfx8og8O=|gUJDf5=;`7ZV$r*IiZ$P11p$})OhKon?2O=>a4a`(g11Z2`(U?4Czl=Y zs7cveCa5y&>b{wg4hvQ>?8m-wJO{FI~6V#8L--CZMAo{j@=)i P;~6|%{an^LB{Ts5hF@xd literal 0 HcmV?d00001 diff --git a/res/drawable-hdpi/tab_unselected_focused_holo.9.png b/res/drawable-hdpi/tab_unselected_focused_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..256e8e7302e490535b52dfe719dae0c40c4434ce GIT binary patch literal 216 zcmeAS@N?(olHy`uVBq!ia0vp^Ahs6=8<1?uI(iXEu@pObhHwBu4M$1`kk47*5n0T@ zz}*SLjOHg#uLTNLdAc};cyzwKX3N*)Akp%$oTpR#k=L<9&I{TXD8zMgNA~i%)Hy|P zNgKs)I{R+({VmP8VvisG(aX{DEcyH9q3KVC1{J;2rP0AWs}+-a9>;xVdGTvzHlOQi z5wUz87_iY6Ik5KcnpK}m?)AU6KeZuu$=z?O^q=n)|J67l-~`YW44$rjF6*2UngCq( BO<@24 literal 0 HcmV?d00001 diff --git a/res/drawable-hdpi/tab_unselected_holo.9.png b/res/drawable-hdpi/tab_unselected_holo.9.png index db6fc144c22cdc9cb25c5a30e950b8cee622ce0b..eaa306aee14b3074962b9eb69f7d66f40b3bbc7b 100644 GIT binary patch delta 23 dcmZo>oXj{ug_ot+$uool2x>S|IwmS60RTgn1=Iil delta 9 QcmbQt*vvRVWui$u01mMN@c;k- diff --git a/res/drawable-hdpi/tab_unselected_pressed_focused_holo.9.png b/res/drawable-hdpi/tab_unselected_pressed_focused_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..d17b82026b6454ebd44f7dbe3231abf23b26fccb GIT binary patch literal 536 zcmV+z0_XjSP)DJBbQD0#AUB zH}C^0-a~%p}r-FEkk`qbJ!z4GNE43s#KK zNDRs@3KsWHgcd0#zy)_t5P&p3Jj$#!qre@_`~aORytx@CS|N~E-DYX7!3q)ywwf#R zi~LF{d_BSz^f=YGK|9ZM0fn=bk}vu+>y{m!nweA@)C183mI|l2t~*ywL~IbQ%zQ@4 zjBbYqbD2|k7rF+l5n4N-Q9@^P4dyB)b11YKCe8!~6qBszTC`ZB>NPgV3`H}Adi(;& z=z(Y=hl8P;erL4fy&+@A?PjoH0D#W)0RU#3jdA!27YP8@x1Y1W&i>rr94*ncBrxA_ awZm^n)5h{@F-;->0000AfL0qBeIx* zfx8og8O=|gUJDdl?djqeV$r*HiZ>UNAy3=>Ev(b^_D(ndz;y3`cLig<=9yzVUhr(= zy=>Op8o=>W-qR~Elp(fRMX9Pys*<=;4p% z$vbwLGM|#MO=eHa>XFT;pUnH0>(<^9#og7CE2b>DEIj#wikm>Z{_L+2#b+FPHd-`X zSTSYOWC67{ot1t(p#@(z{r1}$FW9_q^^vE4D$lIGP?r|boFyt I=akR{08mR~WB>pF literal 0 HcmV?d00001 diff --git a/res/drawable-mdpi/tab_selected_focused_holo.9.png b/res/drawable-mdpi/tab_selected_focused_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..9a33cd2d92874dd09f4eb5d3f924eebe97b25c40 GIT binary patch literal 203 zcmeAS@N?(olHy`uVBq!ia0vp^>_BY9!3HEJJUw_8NJ*BsMwA5Sr8n0M1DW`tbSwb=FK+^Rf3lPOJU(KVDPR|J0bAe<1Nr)22WQ%mvv4FO#pfqOKt!F literal 0 HcmV?d00001 diff --git a/res/drawable-mdpi/tab_selected_holo.9.png b/res/drawable-mdpi/tab_selected_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..e029e577a711e01450d8924bb7cd8bcb6867db82 GIT binary patch literal 144 zcmeAS@N?(olHy`uVBq!ia0vp^%s|Y|!3HFERhwS|Qj#UE5hcO-X(i=}MX3yqDfvmM z3ZA)%>8U}fi7AzZCsS>Jii|v6978H@CH?sS-=0~ZfivY;J=+AIS6Aj=Q{WS37HTN$ qQz(|;D3Fkp+<4kRVK;-q0S2o8fp2Rs`~3szX7F_Nb6Mw<&;$SgLM&YX literal 0 HcmV?d00001 diff --git a/res/drawable-mdpi/tab_selected_pressed_focused_holo.9.png b/res/drawable-mdpi/tab_selected_pressed_focused_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..285116e31e1c3fb26567af209b73718f07bc1355 GIT binary patch literal 454 zcmV;%0XhDOP)DF0XHC5fCg&1oFoM^V6d>XlD+HCBt>?{(e6rmdU}?_B0{m4Sq~g{wt4!r zOWN(uURJA*E8X9o5`pq1%=xiasQb6`jUKk!*Ufr;;jZ^fbg&jJ#D&#`!qIK=b6In= z4s{w7)41lI%r07#2$`jVkT}Ec$L&ljwAe}zSti7@ggO;j6%rHwP=!Q#LdChy6oR*c z@mo=c%?Ogk{+e}+hZtjm#F&LMNtVI#OlD|XWTvJq05qMU)SFOJNG9*oVf%flkP~v9 z=Y+3jgm<=-`V42?!wN%1FiVM3j0wDEHMGV=kqm5;4Rvd0k?m~ w8U}fi7AzZCsS>JiaI@A978H@^#nQcH7M}hZY%G%JHuabG5!aqaP2Bixj6GbE&Os5bkw9sMq-sUhLgvwDil6_u$Ij+-sD=}ZmKxYhgcu#~pn0rP!P zlW+2eN-A94>Tv7U%K#(ixsEr27ML73#$j6gN!I7~MEh2azKZipvd`~)x3!+5XZ7?s c9n*oXua>h?X*ygK2XqvJr>mdKI;Vst06dpdnE(I) literal 0 HcmV?d00001 diff --git a/res/drawable-mdpi/tab_unselected_focused_holo.9.png b/res/drawable-mdpi/tab_unselected_focused_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..032a9921c54ebd6d8bb71aea1552758efb1efd19 GIT binary patch literal 196 zcmeAS@N?(olHy`uVBq!ia0vp^>_BY9!3HEJJUw_8NJ*BsMwA5Sr?ic(Aw2{Hn)z4*}Q$iB};WR^U literal 0 HcmV?d00001 diff --git a/res/drawable-mdpi/tab_unselected_pressed_focused_holo.9.png b/res/drawable-mdpi/tab_unselected_pressed_focused_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..3845135847312f61d9874eb4e4e9c703dcc168d6 GIT binary patch literal 459 zcmV;+0W|)JP)>s>b==;?%5h#oym!sb@v)nwLuGD#ddt4nJoq6c_90P317A`GSu=PO9R)W#5 zDoaABnMTGa0uGz~EeLH68Wa=l)Td^P5+Sox5E5soyX1+}R%o%6Ok|l5&k`DTj?>9t zrmYnc83`4B*cEsysCPvJ%vNa@o7Zgfu@GZSP|Fg6NwNUTGnHA}qB1pY383j2O1-J@ zZma!t*zvto$O*a5bHX<>!aG|^edb_0!U{u0FiVM3J|^%rn{`X!mWcowRGV*^%Lll& zO`wIX7002ovPDHLkV1hC_ Bz{LOn literal 0 HcmV?d00001 diff --git a/res/drawable-mdpi/tab_unselected_pressed_holo.9.png b/res/drawable-mdpi/tab_unselected_pressed_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..23fd8c9b351c7dc4ca7d61bdf8b0fa0b3357afc0 GIT binary patch literal 223 zcmeAS@N?(olHy`uVBq!ia0vp^%s_0!!3HE}@+EEuQj#UE5hcO-X(i=}MX3yqDfvmM z3ZA)%>8U}fi7AzZCsS>JiW)s#978H@^#nQcH7M}h?kex!cUt|2fc?W{-#r$B;+r&$ zCmhJwwN<*&rR9^B`%azPhW7=3CfsE?TiI|eAXVmsigepfZQY<^*$T$v9;+|bZ{5Ls z@x~N43;ta!61B<)ywtP1E|{=7D7Ecj;BU-)@wqN;rGn!(u4Nx%>`hbb@2ehQSYT@5 Uszopr0E4hlYXATM literal 0 HcmV?d00001 diff --git a/res/drawable/tab_widget_indicator_selector.xml b/res/drawable/tab_widget_indicator_selector.xml new file mode 100644 index 000000000..ff92b4048 --- /dev/null +++ b/res/drawable/tab_widget_indicator_selector.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/res/layout-xlarge-land/all_apps_tabbed.xml b/res/layout-xlarge-land/all_apps_tabbed.xml index 8a0e8b843..eb506d16f 100644 --- a/res/layout-xlarge-land/all_apps_tabbed.xml +++ b/res/layout-xlarge-land/all_apps_tabbed.xml @@ -50,7 +50,7 @@ launcher:cellCountY="5" launcher:pageLayoutWidthGap="36dp" launcher:pageLayoutHeightGap="6dp" - launcher:pageLayoutPaddingTop="15dp" + launcher:pageLayoutPaddingTop="20dp" launcher:pageLayoutPaddingBottom="15dp" launcher:pageLayoutPaddingLeft="40dp" launcher:pageLayoutPaddingRight="40dp"> diff --git a/res/layout-xlarge-land/launcher.xml b/res/layout-xlarge-land/launcher.xml index f93506e26..0fc954b18 100644 --- a/res/layout-xlarge-land/launcher.xml +++ b/res/layout-xlarge-land/launcher.xml @@ -157,7 +157,7 @@ + + + diff --git a/src/com/android/launcher2/AllAppsTabbed.java b/src/com/android/launcher2/AllAppsTabbed.java index 0e3246154..4feb9984c 100644 --- a/src/com/android/launcher2/AllAppsTabbed.java +++ b/src/com/android/launcher2/AllAppsTabbed.java @@ -16,7 +16,7 @@ package com.android.launcher2; -import com.android.launcher.R; +import java.util.ArrayList; import android.animation.Animator; import android.animation.ObjectAnimator; @@ -25,11 +25,14 @@ import android.content.Context; import android.content.res.Resources; import android.util.AttributeSet; import android.util.Log; +import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.widget.TabHost; +import android.widget.TabWidget; +import android.widget.TextView; -import java.util.ArrayList; +import com.android.launcher.R; /** * Implements a tabbed version of AllApps2D. @@ -43,10 +46,12 @@ public class AllAppsTabbed extends TabHost implements AllAppsView { private AllAppsPagedView mAllApps; private Context mContext; + private final LayoutInflater mInflater; public AllAppsTabbed(Context context, AttributeSet attrs) { super(context, attrs); mContext = context; + mInflater = LayoutInflater.from(context); } @Override @@ -68,11 +73,15 @@ public class AllAppsTabbed extends TabHost implements AllAppsView { } }; - String label = mContext.getString(R.string.all_apps_tab_all); - addTab(newTabSpec(TAG_ALL).setIndicator(label).setContent(contentFactory)); + TextView tabView; + TabWidget tabWidget = (TabWidget) findViewById(com.android.internal.R.id.tabs); + tabView = (TextView) mInflater.inflate(R.layout.tab_widget_indicator, tabWidget, false); + tabView.setText(mContext.getString(R.string.all_apps_tab_all)); + addTab(newTabSpec(TAG_ALL).setIndicator(tabView).setContent(contentFactory)); - label = mContext.getString(R.string.all_apps_tab_downloaded); - addTab(newTabSpec(TAG_DOWNLOADED).setIndicator(label).setContent(contentFactory)); + tabView = (TextView) mInflater.inflate(R.layout.tab_widget_indicator, tabWidget, false); + tabView.setText(mContext.getString(R.string.all_apps_tab_downloaded)); + addTab(newTabSpec(TAG_DOWNLOADED).setIndicator(tabView).setContent(contentFactory)); setOnTabChangedListener(new OnTabChangeListener() { public void onTabChanged(String tabId) { diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 1a486d705..033ccc3d4 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -99,6 +99,7 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.PopupWindow; import android.widget.TabHost; +import android.widget.TabWidget; import android.widget.TextView; import android.widget.Toast; import android.widget.TabHost.OnTabChangeListener; @@ -306,18 +307,27 @@ public final class Launcher extends Activity } }; - String widgetsLabel = getString(R.string.widgets_tab_label); + + TextView tabView; + TabWidget tabWidget = (TabWidget) + mHomeCustomizationDrawer.findViewById(com.android.internal.R.id.tabs); + + tabView = (TextView) mInflater.inflate(R.layout.tab_widget_indicator, tabWidget, false); + tabView.setText(getString(R.string.widgets_tab_label)); mHomeCustomizationDrawer.addTab(mHomeCustomizationDrawer.newTabSpec(WIDGETS_TAG) - .setIndicator(widgetsLabel).setContent(contentFactory)); - String applicationsLabel = getString(R.string.applications_tab_label); + .setIndicator(tabView).setContent(contentFactory)); + tabView = (TextView) mInflater.inflate(R.layout.tab_widget_indicator, tabWidget, false); + tabView.setText(getString(R.string.applications_tab_label)); mHomeCustomizationDrawer.addTab(mHomeCustomizationDrawer.newTabSpec(APPLICATIONS_TAG) - .setIndicator(applicationsLabel).setContent(contentFactory)); - String wallpapersLabel = getString(R.string.wallpapers_tab_label); + .setIndicator(tabView).setContent(contentFactory)); + tabView = (TextView) mInflater.inflate(R.layout.tab_widget_indicator, tabWidget, false); + tabView.setText(getString(R.string.wallpapers_tab_label)); mHomeCustomizationDrawer.addTab(mHomeCustomizationDrawer.newTabSpec(WALLPAPERS_TAG) - .setIndicator(wallpapersLabel).setContent(contentFactory)); - String shortcutsLabel = getString(R.string.shortcuts_tab_label); + .setIndicator(tabView).setContent(contentFactory)); + tabView = (TextView) mInflater.inflate(R.layout.tab_widget_indicator, tabWidget, false); + tabView.setText(getString(R.string.shortcuts_tab_label)); mHomeCustomizationDrawer.addTab(mHomeCustomizationDrawer.newTabSpec(SHORTCUTS_TAG) - .setIndicator(shortcutsLabel).setContent(contentFactory)); + .setIndicator(tabView).setContent(contentFactory)); mHomeCustomizationDrawer.setOnTabChangedListener(new OnTabChangeListener() { public void onTabChanged(String tabId) { // animate the changing of the tab content by fading pages in and out -- 2.11.0