Merge "Close suggestions cursor when SearchView is detached." into ics-mr1
This commit is contained in:
committed by
Android (Google) Code Review
commit
d69c203cd4
@ -151,6 +151,14 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
|
||||
}
|
||||
};
|
||||
|
||||
private Runnable mReleaseCursorRunnable = new Runnable() {
|
||||
public void run() {
|
||||
if (mSuggestionsAdapter != null && mSuggestionsAdapter instanceof SuggestionsAdapter) {
|
||||
mSuggestionsAdapter.changeCursor(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// For voice searching
|
||||
private final Intent mVoiceWebSearchIntent;
|
||||
private final Intent mVoiceAppSearchIntent;
|
||||
@ -759,6 +767,7 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
removeCallbacks(mUpdateDrawableStateRunnable);
|
||||
post(mReleaseCursorRunnable);
|
||||
super.onDetachedFromWindow();
|
||||
}
|
||||
|
||||
@ -1028,7 +1037,9 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
|
||||
}
|
||||
}
|
||||
mQueryTextView.setInputType(inputType);
|
||||
|
||||
if (mSuggestionsAdapter != null) {
|
||||
mSuggestionsAdapter.changeCursor(null);
|
||||
}
|
||||
// attach the suggestions adapter, if suggestions are available
|
||||
// The existence of a suggestions authority is the proxy for "suggestions available here"
|
||||
if (mSearchable.getSuggestAuthority() != null) {
|
||||
@ -1177,7 +1188,6 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
|
||||
public void onActionViewCollapsed() {
|
||||
clearFocus();
|
||||
updateViewsVisibility(true);
|
||||
mQueryTextView.setText("");
|
||||
mQueryTextView.setImeOptions(mCollapsedImeOptions);
|
||||
mExpandedInActionView = false;
|
||||
}
|
||||
@ -1192,6 +1202,7 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
|
||||
mExpandedInActionView = true;
|
||||
mCollapsedImeOptions = mQueryTextView.getImeOptions();
|
||||
mQueryTextView.setImeOptions(mCollapsedImeOptions | EditorInfo.IME_FLAG_NO_FULLSCREEN);
|
||||
mQueryTextView.setText("");
|
||||
setIconified(false);
|
||||
}
|
||||
|
||||
|
@ -29,9 +29,7 @@ import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.StateListDrawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.Spannable;
|
||||
@ -39,7 +37,6 @@ import android.text.SpannableString;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.TextAppearanceSpan;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -113,7 +110,6 @@ class SuggestionsAdapter extends ResourceCursorAdapter implements OnClickListene
|
||||
|
||||
mOutsideDrawablesCache = outsideDrawablesCache;
|
||||
|
||||
|
||||
// mStartSpinnerRunnable = new Runnable() {
|
||||
// public void run() {
|
||||
// // mSearchView.setWorking(true); // TODO:
|
||||
@ -185,6 +181,10 @@ class SuggestionsAdapter extends ResourceCursorAdapter implements OnClickListene
|
||||
* the results.
|
||||
*/
|
||||
Cursor cursor = null;
|
||||
if (mSearchView.getVisibility() != View.VISIBLE
|
||||
|| mSearchView.getWindowVisibility() != View.VISIBLE) {
|
||||
return null;
|
||||
}
|
||||
//mSearchView.getWindow().getDecorView().post(mStartSpinnerRunnable); // TODO:
|
||||
try {
|
||||
cursor = mSearchManager.getSuggestions(mSearchable, query, QUERY_LIMIT);
|
||||
|
@ -93,7 +93,7 @@
|
||||
android:singleLine="true"
|
||||
android:ellipsize="end"
|
||||
android:background="@null"
|
||||
android:inputType="text|textAutoComplete"
|
||||
android:inputType="text|textAutoComplete|textNoSuggestions"
|
||||
android:imeOptions="actionSearch"
|
||||
android:dropDownHeight="wrap_content"
|
||||
android:dropDownAnchor="@id/search_edit_frame"
|
||||
|
Reference in New Issue
Block a user