use of fr.neamar.kiss.utils.SpaceTokenizer 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();
}
Aggregations