use of android.widget.MultiAutoCompleteTextView in project KISS by Neamar.
the class AppResult method launchEditTagsDialog.
private void launchEditTagsDialog(final Context context, final AppPojo app) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(context.getResources().getString(R.string.tags_add_title));
// Create the tag dialog
final View v = LayoutInflater.from(context).inflate(R.layout.tags_dialog, null);
final MultiAutoCompleteTextView tagInput = (MultiAutoCompleteTextView) v.findViewById(R.id.tag_input);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(context, android.R.layout.simple_dropdown_item_1line, KissApplication.getDataHandler(context).getTagsHandler().getAllTagsAsArray());
tagInput.setTokenizer(new SpaceTokenizer());
tagInput.setText(appPojo.tags);
tagInput.setAdapter(adapter);
builder.setView(v);
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
KissApplication.getDataHandler(context).getTagsHandler().setTags(app.id, tagInput.getText().toString());
// Refresh tags for given app
app.setTags(tagInput.getText().toString());
// Show toast message
String msg = context.getResources().getString(R.string.tags_confirmation_added);
Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
}
});
builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
builder.show();
}
use of android.widget.MultiAutoCompleteTextView in project Android-skin-support by ximsfei.
the class FirstFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_first, null);
view.findViewById(R.id.image_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getActivity(), "Image Button", Toast.LENGTH_SHORT).show();
}
});
view.findViewById(R.id.checked_text_view).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
CheckedTextView checkedTextView = (CheckedTextView) v;
checkedTextView.toggle();
// checkedMap.put(position, checkedTextView.isChecked());
}
});
MultiAutoCompleteTextView autoCompleteTextView = (MultiAutoCompleteTextView) view.findViewById(R.id.auto);
String[] arr = { "aa", "aab", "aac" };
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, arr);
autoCompleteTextView.setAdapter(arrayAdapter);
autoCompleteTextView.setThreshold(1);
autoCompleteTextView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
return view;
}
Aggregations