Merge change I78f113bc into eclair

* changes:
  Fix possible crash in AutoCompleteTextView.
This commit is contained in:
Android (Google) Code Review
2009-09-30 15:42:11 -04:00
4 changed files with 33 additions and 6 deletions

View File

@@ -3144,6 +3144,17 @@
visibility="public"
>
</field>
<field name="dropDownHorizontalOffset"
type="int"
transient="false"
volatile="false"
value="16843436"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="dropDownItemStyle"
type="int"
transient="false"
@@ -3177,6 +3188,17 @@
visibility="public"
>
</field>
<field name="dropDownVerticalOffset"
type="int"
transient="false"
volatile="false"
value="16843437"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="dropDownWidth"
type="int"
transient="false"

View File

@@ -40,7 +40,7 @@ import android.annotation.SdkConstant;
* to retrieve the folder's content.</p>
*
* <h3>Setting up the live folder activity</h3>
* <p>The following code sample shows how to write an activity that creates a live fodler:</p>
* <p>The following code sample shows how to write an activity that creates a live folder:</p>
* <pre>
* public static class MyLiveFolder extends Activity {
* public static final Uri CONTENT_URI = Uri.parse("content://my.app/live");

View File

@@ -82,6 +82,8 @@ import com.android.internal.R;
* @attr ref android.R.styleable#AutoCompleteTextView_dropDownAnchor
* @attr ref android.R.styleable#AutoCompleteTextView_dropDownWidth
* @attr ref android.R.styleable#AutoCompleteTextView_dropDownHeight
* @attr ref android.R.styleable#AutoCompleteTextView_dropDownVerticalOffset
* @attr ref android.R.styleable#AutoCompleteTextView_dropDownHorizontalOffset
*/
public class AutoCompleteTextView extends EditText implements Filter.FilterListener {
static final boolean DEBUG = false;
@@ -1153,7 +1155,7 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe
heightSpec = mDropDownHeight;
}
mPopup.setOutsideTouchable(mForceIgnoreOutsideTouch ? false : !mDropDownAlwaysVisible);
mPopup.setOutsideTouchable(!mForceIgnoreOutsideTouch && !mDropDownAlwaysVisible);
mPopup.update(getDropDownAnchorView(), mDropDownHorizontalOffset,
mDropDownVerticalOffset, widthSpec, heightSpec);
@@ -1183,8 +1185,8 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe
// use outside touchable to dismiss drop down when touching outside of it, so
// only set this if the dropdown is not always visible
mPopup.setOutsideTouchable(mForceIgnoreOutsideTouch ? false : !mDropDownAlwaysVisible);
mPopup.setTouchInterceptor(new PopupTouchIntercepter());
mPopup.setOutsideTouchable(!mForceIgnoreOutsideTouch && !mDropDownAlwaysVisible);
mPopup.setTouchInterceptor(new PopupTouchInterceptor());
mPopup.showAsDropDown(getDropDownAnchorView(),
mDropDownHorizontalOffset, mDropDownVerticalOffset);
mDropDownList.setSelection(ListView.INVALID_POSITION);
@@ -1408,9 +1410,10 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe
}
}
private class PopupTouchIntercepter implements OnTouchListener {
private class PopupTouchInterceptor implements OnTouchListener {
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
if (event.getAction() == MotionEvent.ACTION_DOWN &&
mPopup != null && mPopup.isShowing()) {
mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
showDropDown();
}

View File

@@ -1176,6 +1176,8 @@
<public type="attr" name="scrollbarDefaultDelayBeforeFade" />
<public type="attr" name="fadeScrollbars" />
<public type="attr" name="colorBackgroundCacheHint" />
<public type="attr" name="dropDownHorizontalOffset" />
<public type="attr" name="dropDownVerticalOffset" />
<public type="style" name="Theme.Wallpaper" />
<public type="style" name="Theme.Wallpaper.NoTitleBar" />