use of android.widget.AutoCompleteTextView in project HistoryEditText by zenlibs.
the class SimpleHistoryActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
InputStream inputStream = getResources().openRawResource(R.raw.countries);
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
String line;
while ((line = reader.readLine()) != null) {
mCountries.add(line);
}
reader.close();
} catch (IOException e) {
}
setContentView(R.layout.activity_simple);
mHistoryEditText = (HistoryEditText) findViewById(R.id.historyEditText);
mHistoryEditText.setAdapter(createAdapter());
mHistoryEditText2 = (HistoryEditText) findViewById(R.id.historyEditText2);
mHistoryEditText2.setAdapter(createAdapter());
autoCompleteTextView = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView);
autoCompleteTextView.setAdapter(createAdapter());
autoCompleteTextView.setThreshold(1);
autoCompleteTextView.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
autoCompleteTextView.showDropDown();
} else {
autoCompleteTextView.dismissDropDown();
}
}
});
}
use of android.widget.AutoCompleteTextView in project weiciyuan by qii.
the class AbstractWriteActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.abstractwriteactivity_layout);
ActionBar actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(false);
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setDisplayShowCustomEnabled(true);
int avatarWidth = getResources().getDimensionPixelSize(R.dimen.timeline_avatar_width);
int avatarHeight = getResources().getDimensionPixelSize(R.dimen.timeline_avatar_height);
Bitmap bitmap = ImageUtility.getWriteWeiboRoundedCornerPic(getCurrentAccountBean().getInfo().getAvatar_large(), avatarWidth, avatarHeight, FileLocationMethod.avatar_large);
if (bitmap == null) {
bitmap = ImageUtility.getWriteWeiboRoundedCornerPic(getCurrentAccountBean().getInfo().getProfile_image_url(), avatarWidth, avatarHeight, FileLocationMethod.avatar_small);
}
if (bitmap != null) {
actionBar.setIcon(new BitmapDrawable(getResources(), bitmap));
}
token = getIntent().getStringExtra("token");
View title = getLayoutInflater().inflate(R.layout.writeweiboactivity_title_layout, null);
actionBar.setCustomView(title, new ActionBar.LayoutParams(Gravity.RIGHT));
et = ((AutoCompleteTextView) findViewById(R.id.status_new_content));
et.addTextChangedListener(new TextNumLimitWatcher((TextView) findViewById(R.id.menu_send), et, this));
AutoCompleteAdapter adapter = new AutoCompleteAdapter(this, et, (ProgressBar) title.findViewById(R.id.have_suggest_progressbar));
et.setAdapter(adapter);
findViewById(R.id.menu_topic).setOnClickListener(this);
findViewById(R.id.menu_at).setOnClickListener(this);
findViewById(R.id.menu_emoticon).setOnClickListener(this);
findViewById(R.id.menu_send).setOnClickListener(this);
CheatSheet.setup(AbstractWriteActivity.this, findViewById(R.id.menu_at), R.string.at_other);
CheatSheet.setup(AbstractWriteActivity.this, findViewById(R.id.menu_emoticon), R.string.add_emoticon);
CheatSheet.setup(AbstractWriteActivity.this, findViewById(R.id.menu_topic), R.string.add_topic);
CheatSheet.setup(AbstractWriteActivity.this, findViewById(R.id.menu_send), R.string.send);
smiley = (SmileyPicker) findViewById(R.id.smiley_picker);
smiley.setEditText(AbstractWriteActivity.this, ((LinearLayout) findViewById(R.id.root_layout)), et);
container = (RelativeLayout) findViewById(R.id.container);
et.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
hideSmileyPicker(true);
}
});
}
use of android.widget.AutoCompleteTextView in project weiciyuan by qii.
the class DMSelectUserActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dmselectuseractivity_layout);
getActionBar().setTitle(R.string.select_dm_receiver);
getActionBar().setDisplayShowHomeEnabled(false);
getActionBar().setDisplayShowTitleEnabled(true);
getActionBar().setDisplayHomeAsUpEnabled(true);
View title = getLayoutInflater().inflate(R.layout.dmselectuseractivity_title_layout, null);
suggestProgressBar = (ProgressBar) title.findViewById(R.id.have_suggest_progressbar);
getActionBar().setCustomView(title, new ActionBar.LayoutParams(Gravity.RIGHT));
getActionBar().setDisplayShowCustomEnabled(true);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction().replace(R.id.list_content, SelectFriendsListFragment.newInstance(GlobalContext.getInstance().getAccountBean().getInfo())).commit();
}
AutoCompleteTextView search = (AutoCompleteTextView) findViewById(R.id.search);
AutoCompleteAdapter adapter = new AutoCompleteAdapter(this, android.R.layout.simple_dropdown_item_1line);
search.setAdapter(adapter);
search.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent = new Intent();
intent.putExtra("user", data.get(position));
setResult(0, intent);
finish();
}
});
}
use of android.widget.AutoCompleteTextView in project musicbrainz-android by jdamcd.
the class SearchFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View layout = inflater.inflate(R.layout.fragment_dash_search, container);
searchTypeSpinner = (Spinner) layout.findViewById(R.id.search_spin);
searchField = (AutoCompleteTextView) layout.findViewById(R.id.query_input);
searchField.setOnEditorActionListener(this);
layout.findViewById(R.id.search_btn).setOnClickListener(this);
return layout;
}
use of android.widget.AutoCompleteTextView in project coursera-android by aporter.
the class AutoCompleteActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
String[] mCountries = getResources().getStringArray(R.array.country_names);
// Get a reference to the AutoCompleteTextView
final AutoCompleteTextView textView = findViewById(R.id.autocomplete_country);
// Create an ArrayAdapter containing country names
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, R.layout.list_item, mCountries);
// Set the adapter for the AutoCompleteTextView
textView.setAdapter(adapter);
// Display a Toast Message when the user clicks on an item in the AutoCompleteTextView
textView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View view, int arg2, long arg3) {
Toast.makeText(getApplicationContext(), getString(R.string.winner_is_string, arg0.getAdapter().getItem(arg2)), Toast.LENGTH_LONG).show();
textView.setText("");
}
});
}
Aggregations