Search in sources :

Example 1 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)

Example 2 with MultiAutoCompleteTextView

use of android.widget.MultiAutoCompleteTextView in project Shaarlier by dimtion.

the class AddActivity method handleDialog.

// 
// Method made to handle the dialog box
// 
private void handleDialog(final String sharedUrl, String givenTitle, String defaultDescription, String defaultTags) {
    AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(this, R.style.AppTheme));
    LayoutInflater inflater = AddActivity.this.getLayoutInflater();
    final View dialogView = inflater.inflate(R.layout.share_dialog, null);
    ((CheckBox) dialogView.findViewById(R.id.private_share)).setChecked(privateShare);
    this.a_dialogView = dialogView;
    // Init accountSpinner
    initAccountSpinner();
    // Load title or description:
    if ((autoDescription || autoTitle) && NetworkManager.isUrl(sharedUrl)) {
        loadAutoTitleAndDescription(sharedUrl, givenTitle, defaultDescription);
    }
    // Init url  :
    ((EditText) dialogView.findViewById(R.id.url)).setText(sharedUrl);
    // Init tags :
    MultiAutoCompleteTextView textView = (MultiAutoCompleteTextView) dialogView.findViewById(R.id.tags);
    ((EditText) dialogView.findViewById(R.id.tags)).setText(defaultTags);
    new AutoCompleteWrapper(textView, this);
    // Init the tweet button if necessary:
    CheckBox tweetCheckBox = ((CheckBox) dialogView.findViewById(R.id.tweet));
    if (!this.tweet) {
        tweetCheckBox.setVisibility(View.GONE);
        tweetCheckBox.setChecked(false);
    } else {
        tweetCheckBox.setVisibility(View.VISIBLE);
        tweetCheckBox.setChecked(true);
    }
    // Open the dialog :
    builder.setView(dialogView).setTitle(R.string.share).setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int which) {
            // Retrieve user data
            String url = ((EditText) dialogView.findViewById(R.id.url)).getText().toString();
            String title = ((EditText) dialogView.findViewById(R.id.title)).getText().toString();
            String description = ((EditText) dialogView.findViewById(R.id.description)).getText().toString();
            String tags = ((EditText) dialogView.findViewById(R.id.tags)).getText().toString();
            privateShare = ((CheckBox) dialogView.findViewById(R.id.private_share)).isChecked();
            tweet = ((CheckBox) dialogView.findViewById(R.id.tweet)).isChecked();
            chosenAccount = (ShaarliAccount) ((Spinner) dialogView.findViewById(R.id.chooseAccount)).getSelectedItem();
            // Finally send everything
            handleSendPost(url, title, description, tags, privateShare, chosenAccount, tweet);
        }
    }).setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int which) {
            finish();
        }
    }).setOnCancelListener(new DialogInterface.OnCancelListener() {

        @Override
        public void onCancel(DialogInterface dialog) {
            finish();
        }
    }).show();
}
Also used : AlertDialog(android.app.AlertDialog) EditText(android.widget.EditText) DialogInterface(android.content.DialogInterface) Spinner(android.widget.Spinner) MultiAutoCompleteTextView(android.widget.MultiAutoCompleteTextView) View(android.view.View) ContextThemeWrapper(android.view.ContextThemeWrapper) CheckBox(android.widget.CheckBox) MultiAutoCompleteTextView(android.widget.MultiAutoCompleteTextView) LayoutInflater(android.view.LayoutInflater)

Example 3 with MultiAutoCompleteTextView

use of android.widget.MultiAutoCompleteTextView in project android-delicious by lexs.

the class AddBookmarkActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_add_bookmark);
    setTitle(R.string.activity_add_bookmark_title);
    // Enable up button
    getActionBar().setHomeButtonEnabled(true);
    errorDrawable = DeliciousApplication.getErrorDrawable();
    titleFetcher = new TitleFetcher(this);
    receiver = new DetachableResultReceiver(new Handler());
    urlView = (EditText) findViewById(R.id.url);
    titleView = (EditText) findViewById(R.id.title);
    notesView = (EditText) findViewById(R.id.notes);
    tagsView = (MultiAutoCompleteTextView) findViewById(R.id.tags);
    privateView = (CheckBox) findViewById(R.id.mark_private);
    // TODO: Implement tag suggestion
    /*ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
                android.R.layout.simple_spinner_dropdown_item, TAGS);
        tagsView.setAdapter(adapter);
        tagsView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());*/
    // Enable user to press enter when done
    tagsView.setOnEditorActionListener(new OnEditorActionListener() {

        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                saveBookmark();
                return true;
            } else {
                return false;
            }
        }
    });
    Intent intent = getIntent();
    if (Intent.ACTION_SEND.equals(intent.getAction())) {
        String url = intent.getStringExtra(Intent.EXTRA_TEXT);
        String title = intent.getStringExtra(Intent.EXTRA_SUBJECT);
        urlView.setText(url);
        titleView.setText(title);
        // Check were focus should go
        if (TextUtils.isEmpty(url)) {
            urlView.requestFocus();
        } else if (TextUtils.isEmpty(title)) {
            titleView.requestFocus();
        } else {
            // Focus tags because it can't be prefilled
            tagsView.requestFocus();
        }
    }
    // Fetch title if necessary
    titleFetcher.maybeFetchTitle();
}
Also used : KeyEvent(android.view.KeyEvent) Handler(android.os.Handler) OnEditorActionListener(android.widget.TextView.OnEditorActionListener) MultiAutoCompleteTextView(android.widget.MultiAutoCompleteTextView) TextView(android.widget.TextView) Intent(android.content.Intent) DetachableResultReceiver(se.alexanderblom.delicious.util.DetachableResultReceiver) TitleFetcher(se.alexanderblom.delicious.helpers.TitleFetcher)

Example 4 with MultiAutoCompleteTextView

use of android.widget.MultiAutoCompleteTextView in project android-demos by novoda.

the class AutoMultipleContacts method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.multipleselect);
    Cursor peopleCursor = getContentResolver().query(Contacts.People.CONTENT_URI, PEOPLE_PROJECTION, null, null, Contacts.People.DEFAULT_SORT_ORDER);
    ContactListAdapter contactadapter = new ContactListAdapter(this, peopleCursor);
    MultiAutoCompleteTextView textView = (MultiAutoCompleteTextView) findViewById(R.id.contacts);
    textView.setAdapter(contactadapter);
    textView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
}
Also used : MultiAutoCompleteTextView(android.widget.MultiAutoCompleteTextView) Cursor(android.database.Cursor)

Example 5 with MultiAutoCompleteTextView

use of android.widget.MultiAutoCompleteTextView in project android-demos by novoda.

the class SMS method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.sms);
    btnSendSMS = (Button) findViewById(R.id.btnSendSMS);
    txtPhoneNo = (EditText) findViewById(R.id.txtPhoneNo);
    txtMessage = (EditText) findViewById(R.id.txtMessage);
    btnSendSMS.setOnClickListener(getNewSendSmsListener());
    Cursor peopleCursor = getContentResolver().query(Contacts.People.CONTENT_URI, PEOPLE_PROJECTION, null, null, Contacts.People.DEFAULT_SORT_ORDER);
    ContactListAdapter contactadapter = new ContactListAdapter(this, peopleCursor);
    MultiAutoCompleteTextView textView = (MultiAutoCompleteTextView) findViewById(R.id.txtPhoneNo);
    textView.setAdapter(contactadapter);
    textView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
}
Also used : MultiAutoCompleteTextView(android.widget.MultiAutoCompleteTextView) Cursor(android.database.Cursor)

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