From fd990534c42ea0be37f81df16e48d278a7c4d6e7 Mon Sep 17 00:00:00 2001 From: Jeffrey Sharkey <> Date: Tue, 31 Mar 2009 18:25:33 -0700 Subject: [PATCH] AI 143909: am: CL 143908 am: CL 143907 Make search widget drop-down wider. Original author: jsharkey Merged from: //branches/cupcake/... Original author: android-build Merged from: //branches/donutburger/... Automated import of CL 143909 --- .../spinner_dropdown_background_down.9.png | Bin 0 -> 456 bytes .../spinner_dropdown_background_up.9.png | Bin 0 -> 415 bytes res/drawable/spinner_dropdown_background.xml | 22 ++++++++++++++ .../spinner_dropdown_background_down.9.png | Bin 0 -> 446 bytes .../spinner_dropdown_background_up.9.png | Bin 0 -> 421 bytes res/layout/widget_search.xml | 2 ++ res/values/dimens.xml | 19 ++++++++++++ src/com/android/launcher/Search.java | 27 ++++++++++++++++++ 8 files changed, 70 insertions(+) create mode 100644 res/drawable-land/spinner_dropdown_background_down.9.png create mode 100644 res/drawable-land/spinner_dropdown_background_up.9.png create mode 100644 res/drawable/spinner_dropdown_background.xml create mode 100644 res/drawable/spinner_dropdown_background_down.9.png create mode 100644 res/drawable/spinner_dropdown_background_up.9.png create mode 100644 res/values/dimens.xml diff --git a/res/drawable-land/spinner_dropdown_background_down.9.png b/res/drawable-land/spinner_dropdown_background_down.9.png new file mode 100644 index 0000000000000000000000000000000000000000..bb64b7817f7bca08f90eea86bc46c166c0c22f81 GIT binary patch literal 456 zcmeAS@N?(olHy`uVBq!ia0vp^DnP8k!3HF!9g27iq!^2X+?^QKos)S9l&t&u8CePIV#%XdV9S3C+b}8u4sx`{Qbo$X~!7Oi>(}45?;EG)0QpM zjrDA6df)DzFyrC>io*x~Gu2Pus4CRyvZ!7$b^mh*ySaYyjH_0CO1fvl%kcTR7PB%xbHSvDMae`&YKLFDEc?!cgS|?;bXTsMo2JRLVEsJR{w3t?J}^fBmOMPb4QW z=toYw>lRq@lzG|fUF}Dc3h!@wD|~@5Tl`$o1EC#kMGunf^Z6I#KRA3Y`TPOv4MoeO z9hmd^?v>@PFv)B%{g7(AHT8zns(V{iwSAD{TRj+4l(kYjyW7y-BE_==Y)fr$gGkCiCxvXlg0}5APoldNPgg>;?A|m-wpWeNJ3TfAOOG<(;d(UR_tRv^uw*o_fz?sq^F9 zw$Fzd9Uss~+CIX&-^Nv$E9*f;LATkq{U#GtX%Eb8^zzx#fPo#1YIAgACdq`ttS&(OMEe^-1# zBBzG~lhA|)7L^5(4ts4D#yi|oZS<>qvU?r#g4}5J)9tmB7cd4*TPl3P-@J|~YZhC> zB8@o>Z9vggs~ApvzQdVuL)~+d3J}$re{H`1|N1}uXLiBrM!pKZz|dpxboFyt=akR{ E0K5sJ%K!iX literal 0 HcmV?d00001 diff --git a/res/drawable/spinner_dropdown_background.xml b/res/drawable/spinner_dropdown_background.xml new file mode 100644 index 0000000000..9c37286a2e --- /dev/null +++ b/res/drawable/spinner_dropdown_background.xml @@ -0,0 +1,22 @@ + + + + + + + + diff --git a/res/drawable/spinner_dropdown_background_down.9.png b/res/drawable/spinner_dropdown_background_down.9.png new file mode 100644 index 0000000000000000000000000000000000000000..9cb555685b1cba8a9508f4cd2a55b02db4ce538e GIT binary patch literal 446 zcmeAS@N?(olHy`uVBq!ia0vp^DnP8q!3HE9X7Bz7q!^2X+?^QKos)S9lZ@FZ`x`&|XZv!KXUN{(I=^?_z7mfX7Z|d6pytLbvG%Ky=cL)&a`$p(tQD{M9~G9@X2U4- zV5LUaYmF|wniD*S3$B0v`?hFj4Fg-k+qTUT7VLVBLKe5@ZdZRGT(SB04doA9Yhqro zT{zG^d3)^atXU=pq<(CedCMw?`Ra?!s@swe9&wURNKM@$YLb<{md|aenpjcLI-dP3 gzoL4-ecI2EX5{InaM67NFmM?>UHx3vIVCg!0IICCR{#J2 literal 0 HcmV?d00001 diff --git a/res/drawable/spinner_dropdown_background_up.9.png b/res/drawable/spinner_dropdown_background_up.9.png new file mode 100644 index 0000000000000000000000000000000000000000..5c93f78ffde3ff3a472f57c19e4467022e702955 GIT binary patch literal 421 zcmeAS@N?(olHy`uVBq!ia0vp^DnM+(!3HF!ibPcaDaPU;cPEB*=VV?2Ic!PZ?k)`f zL2$v|<&%LToCO|{#S9GG!XV7ZFl&wkP>{XE)7O>#CJQ4Y6GOYMUO3PcRZkbkkch)? zZ*0tJ4iIU0c>jpdlWBZsFSwt$#8)NnbK+9^ix=H5?_Blu>bjDp)w%VwXx@@b3qP8* zem=~2@W9V?5*&@6ugv~gdhbP5X0Q3K`g3i}CD*=~onT(qaNx`-r?afD8pLkQwq)3w zZ@0l@LUaOejP!#!3z$Ffy=e%4AZ*d+nEiln2V>2%w;X$BzP9~f$hLNoMis~54}qFn z4?32{+NVc;o3iX>x8a5j@fmBsUK3?=(A;`4D*x^GtJ@vo1X#W^cuullJX+Xu)3Rpq zZ&vYX4J;}OjGP`0OtToToEHAY_#{^7#gq1$>!l1^a$l$X+>kG1;&5tH3Dd8457ZYd z%Vf~#I>ecA!<=)~Dy{~b^K%>8YA309LeZD{S--TG{a^hz-seQHdN0@9#lSFR@O1Ta JS?83{1OTzquZsWx literal 0 HcmV?d00001 diff --git a/res/layout/widget_search.xml b/res/layout/widget_search.xml index f87d30f162..1db8488a9d 100644 --- a/res/layout/widget_search.xml +++ b/res/layout/widget_search.xml @@ -42,6 +42,8 @@ android:inputType="textAutoComplete" android:imeOptions="actionSearch" android:lines="1" + android:dropDownWidth="fill_parent" + android:popupBackground="@drawable/spinner_dropdown_background" /> + + + + 19dip + diff --git a/src/com/android/launcher/Search.java b/src/com/android/launcher/Search.java index 97dcd980be..71ab7ef448 100644 --- a/src/com/android/launcher/Search.java +++ b/src/com/android/launcher/Search.java @@ -328,6 +328,33 @@ public class Search extends LinearLayout implements OnClickListener, OnKeyListen configureVoiceSearchButton(); } + /** + * Cache of popup padding value after read from {@link Resources}. + */ + private static float mPaddingInset = -1; + + /** + * When our size is changed, pass down adjusted width and offset values to + * correctly center the {@link AutoCompleteTextView} popup and include our + * padding. + */ + @Override + protected void onLayout(boolean changed, int left, int top, int right, int bottom) { + super.onLayout(changed, left, top, right, bottom); + if (changed) { + if (mPaddingInset == -1) { + mPaddingInset = getResources().getDimension(R.dimen.search_widget_inset); + } + + // Fill entire width of widget, minus padding inset + float paddedWidth = getWidth() - (mPaddingInset * 2); + float paddedOffset = -(mSearchText.getLeft() - mPaddingInset); + + mSearchText.setDropDownWidth((int) paddedWidth); + mSearchText.setDropDownHorizontalOffset((int) paddedOffset); + } + } + /** * Read the searchable info from the search manager */