AI 143907: Make search widget drop-down wider.
BUG=1749373 Automated import of CL 143907
This commit is contained in:
parent
cde7470888
commit
1796c48dd7
Binary file not shown.
After Width: | Height: | Size: 456 B |
Binary file not shown.
After Width: | Height: | Size: 415 B |
|
@ -0,0 +1,22 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2008 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_above_anchor="true"
|
||||||
|
android:drawable="@drawable/spinner_dropdown_background_up" />
|
||||||
|
<item android:drawable="@drawable/spinner_dropdown_background_down" />
|
||||||
|
</selector>
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 446 B |
Binary file not shown.
After Width: | Height: | Size: 421 B |
|
@ -42,6 +42,8 @@
|
||||||
android:inputType="textAutoComplete"
|
android:inputType="textAutoComplete"
|
||||||
android:imeOptions="actionSearch"
|
android:imeOptions="actionSearch"
|
||||||
android:lines="1"
|
android:lines="1"
|
||||||
|
android:dropDownWidth="fill_parent"
|
||||||
|
android:popupBackground="@drawable/spinner_dropdown_background"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ImageButton android:id="@+id/search_go_btn"
|
<ImageButton android:id="@+id/search_go_btn"
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2009 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<dimen name="search_widget_inset">19dip</dimen>
|
||||||
|
</resources>
|
|
@ -328,6 +328,33 @@ public class Search extends LinearLayout implements OnClickListener, OnKeyListen
|
||||||
configureVoiceSearchButton();
|
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
|
* Read the searchable info from the search manager
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue