auto import from //depot/cupcake/@132589
This commit is contained in:
@@ -57,6 +57,8 @@ import android.widget.TextView;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.AdapterView.OnItemSelectedListener;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Search extends LinearLayout implements OnClickListener, OnKeyListener,
|
||||
OnLongClickListener, TextWatcher, OnItemClickListener, OnItemSelectedListener {
|
||||
|
||||
@@ -79,7 +81,6 @@ public class Search extends LinearLayout implements OnClickListener, OnKeyListen
|
||||
private Intent mVoiceSearchIntent;
|
||||
|
||||
private Rect mTempRect = new Rect();
|
||||
private boolean mRestoreFocus = false;
|
||||
|
||||
/**
|
||||
* Used to inflate the Workspace from XML.
|
||||
@@ -169,26 +170,7 @@ public class Search extends LinearLayout implements OnClickListener, OnKeyListen
|
||||
|
||||
getContext().startActivity(launcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasWindowFocus) {
|
||||
if (!hasWindowFocus && hasFocus()) {
|
||||
mRestoreFocus = true;
|
||||
}
|
||||
|
||||
super.onWindowFocusChanged(hasWindowFocus);
|
||||
|
||||
if (hasWindowFocus && mRestoreFocus) {
|
||||
if (isInTouchMode()) {
|
||||
final AutoCompleteTextView searchText = mSearchText;
|
||||
searchText.setSelectAllOnFocus(false);
|
||||
searchText.requestFocusFromTouch();
|
||||
searchText.setSelectAllOnFocus(true);
|
||||
}
|
||||
mRestoreFocus = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implements TextWatcher (for EditText)
|
||||
*/
|
||||
@@ -388,18 +370,6 @@ public class Search extends LinearLayout implements OnClickListener, OnKeyListen
|
||||
mSearchText.setAdapter(mSuggestionsAdapter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove internal cursor references when detaching from window which
|
||||
* prevents {@link Context} leaks.
|
||||
*/
|
||||
@Override
|
||||
public void onDetachedFromWindow() {
|
||||
if (mSuggestionsAdapter != null) {
|
||||
mSuggestionsAdapter.changeCursor(null);
|
||||
mSuggestionsAdapter = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements OnItemClickListener
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user