diff options
author | Jeffrey Sharkey <> | 2009-03-31 18:25:03 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-31 18:25:03 -0700 |
commit | 7bd74a410b138830effb66c688d1d17d0066339c (patch) | |
tree | e97f7993d18fe0f8421f2b568e4e5f6e76f7edc8 /src/com/android/launcher/Search.java | |
parent | 3fca10b8cd35276879e8e7361b2b9ee72377ab94 (diff) | |
download | android_packages_apps_Trebuchet-7bd74a410b138830effb66c688d1d17d0066339c.tar.gz android_packages_apps_Trebuchet-7bd74a410b138830effb66c688d1d17d0066339c.tar.bz2 android_packages_apps_Trebuchet-7bd74a410b138830effb66c688d1d17d0066339c.zip |
AI 143908: am: CL 143907 Make search widget drop-down wider.
Original author: jsharkey
Merged from: //branches/cupcake/...
Automated import of CL 143908
Diffstat (limited to 'src/com/android/launcher/Search.java')
-rw-r--r-- | src/com/android/launcher/Search.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/com/android/launcher/Search.java b/src/com/android/launcher/Search.java index 97dcd980b..71ab7ef44 100644 --- a/src/com/android/launcher/Search.java +++ b/src/com/android/launcher/Search.java @@ -329,6 +329,33 @@ public class Search extends LinearLayout implements OnClickListener, OnKeyListen } /** + * 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 */ private void configureSearchableInfo() { |