Search in sources :

Example 6 with MultiAutoCompleteTextView

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();
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) ImageView(android.widget.ImageView) MultiAutoCompleteTextView(android.widget.MultiAutoCompleteTextView) View(android.view.View) TextView(android.widget.TextView) SpaceTokenizer(fr.neamar.kiss.utils.SpaceTokenizer) MultiAutoCompleteTextView(android.widget.MultiAutoCompleteTextView) ArrayAdapter(android.widget.ArrayAdapter)

Example 7 with MultiAutoCompleteTextView

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;
}
Also used : CheckedTextView(android.widget.CheckedTextView) MultiAutoCompleteTextView(android.widget.MultiAutoCompleteTextView) CheckedTextView(android.widget.CheckedTextView) View(android.view.View) MultiAutoCompleteTextView(android.widget.MultiAutoCompleteTextView) ArrayAdapter(android.widget.ArrayAdapter) Nullable(android.support.annotation.Nullable)

Aggregations

MultiAutoCompleteTextView (android.widget.MultiAutoCompleteTextView)7 View (android.view.View)4 ArrayAdapter (android.widget.ArrayAdapter)3 AlertDialog (android.app.AlertDialog)2 DialogInterface (android.content.DialogInterface)2 Cursor (android.database.Cursor)2 Nullable (android.support.annotation.Nullable)2 CheckedTextView (android.widget.CheckedTextView)2 TextView (android.widget.TextView)2 Intent (android.content.Intent)1 Handler (android.os.Handler)1 ContextThemeWrapper (android.view.ContextThemeWrapper)1 KeyEvent (android.view.KeyEvent)1 LayoutInflater (android.view.LayoutInflater)1 CheckBox (android.widget.CheckBox)1 EditText (android.widget.EditText)1 ImageView (android.widget.ImageView)1 Spinner (android.widget.Spinner)1 OnEditorActionListener (android.widget.TextView.OnEditorActionListener)1 SpaceTokenizer (fr.neamar.kiss.utils.SpaceTokenizer)1