am 89bc8636: Merge "Add an OnDismissListener to AutoCompleteTextView" into jb-mr1-dev
* commit '89bc8636c5aeedd2421ffa4f903e783d4a2a993c': Add an OnDismissListener to AutoCompleteTextView
This commit is contained in:
@@ -27677,6 +27677,7 @@ package android.widget {
|
|||||||
method public void setDropDownVerticalOffset(int);
|
method public void setDropDownVerticalOffset(int);
|
||||||
method public void setDropDownWidth(int);
|
method public void setDropDownWidth(int);
|
||||||
method public void setListSelection(int);
|
method public void setListSelection(int);
|
||||||
|
method public void setOnDismissListener(android.widget.AutoCompleteTextView.OnDismissListener);
|
||||||
method public void setOnItemClickListener(android.widget.AdapterView.OnItemClickListener);
|
method public void setOnItemClickListener(android.widget.AdapterView.OnItemClickListener);
|
||||||
method public void setOnItemSelectedListener(android.widget.AdapterView.OnItemSelectedListener);
|
method public void setOnItemSelectedListener(android.widget.AdapterView.OnItemSelectedListener);
|
||||||
method public void setText(java.lang.CharSequence, boolean);
|
method public void setText(java.lang.CharSequence, boolean);
|
||||||
@@ -27685,6 +27686,10 @@ package android.widget {
|
|||||||
method public void showDropDown();
|
method public void showDropDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static abstract interface AutoCompleteTextView.OnDismissListener {
|
||||||
|
method public abstract void onDismiss();
|
||||||
|
}
|
||||||
|
|
||||||
public static abstract interface AutoCompleteTextView.Validator {
|
public static abstract interface AutoCompleteTextView.Validator {
|
||||||
method public abstract java.lang.CharSequence fixText(java.lang.CharSequence);
|
method public abstract java.lang.CharSequence fixText(java.lang.CharSequence);
|
||||||
method public abstract boolean isValid(java.lang.CharSequence);
|
method public abstract boolean isValid(java.lang.CharSequence);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package android.widget;
|
package android.widget;
|
||||||
|
|
||||||
|
import android.app.SearchManager.OnDismissListener;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.database.DataSetObserver;
|
import android.database.DataSetObserver;
|
||||||
@@ -578,6 +579,23 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe
|
|||||||
return mItemSelectedListener;
|
return mItemSelectedListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a listener that will be invoked whenever the AutoCompleteTextView's
|
||||||
|
* list of completions is dismissed.
|
||||||
|
* @param dismissListener Listener to invoke when completions are dismissed
|
||||||
|
*/
|
||||||
|
public void setOnDismissListener(final OnDismissListener dismissListener) {
|
||||||
|
PopupWindow.OnDismissListener wrappedListener = null;
|
||||||
|
if (dismissListener != null) {
|
||||||
|
wrappedListener = new PopupWindow.OnDismissListener() {
|
||||||
|
@Override public void onDismiss() {
|
||||||
|
dismissListener.onDismiss();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
mPopup.setOnDismissListener(wrappedListener);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Returns a filterable list adapter used for auto completion.</p>
|
* <p>Returns a filterable list adapter used for auto completion.</p>
|
||||||
*
|
*
|
||||||
@@ -1206,6 +1224,19 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe
|
|||||||
CharSequence fixText(CharSequence invalidText);
|
CharSequence fixText(CharSequence invalidText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listener to respond to the AutoCompleteTextView's completion list being dismissed.
|
||||||
|
* @see AutoCompleteTextView#setOnDismissListener(OnDismissListener)
|
||||||
|
*/
|
||||||
|
public interface OnDismissListener {
|
||||||
|
/**
|
||||||
|
* This method will be invoked whenever the AutoCompleteTextView's list
|
||||||
|
* of completion options has been dismissed and is no longer available
|
||||||
|
* for user interaction.
|
||||||
|
*/
|
||||||
|
void onDismiss();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows us a private hook into the on click event without preventing users from setting
|
* Allows us a private hook into the on click event without preventing users from setting
|
||||||
* their own click listener.
|
* their own click listener.
|
||||||
|
|||||||
Reference in New Issue
Block a user