Search in sources :

Example 6 with AutoCompleteTextView

use of android.widget.AutoCompleteTextView in project Rocket.Chat.Android by RocketChat.

the class AddDirectMessageDialogFragment method setupView.

private void setupView(Optional<RocketChatAbsoluteUrl> rocketChatAbsoluteUrlOptional) {
    compositeDisposable.clear();
    if (!rocketChatAbsoluteUrlOptional.isPresent()) {
        return;
    }
    AutoCompleteTextView autoCompleteTextView = (AutoCompleteTextView) getDialog().findViewById(R.id.editor_username);
    RealmAutoCompleteAdapter<RealmUser> adapter = realmHelper.createAutoCompleteAdapter(getContext(), (realm, text) -> realm.where(RealmUser.class).contains(RealmUser.USERNAME, text, Case.INSENSITIVE).findAllSorted(RealmUser.USERNAME), context -> new SuggestUserAdapter(context, rocketChatAbsoluteUrlOptional.get()));
    autoCompleteTextView.setAdapter(adapter);
}
Also used : RealmUser(chat.rocket.persistence.realm.models.ddp.RealmUser) SuggestUserAdapter(chat.rocket.android.layouthelper.sidebar.dialog.SuggestUserAdapter) AutoCompleteTextView(android.widget.AutoCompleteTextView)

Example 7 with AutoCompleteTextView

use of android.widget.AutoCompleteTextView in project RxBinding by JakeWharton.

the class RxAutoCompleteTextViewTestActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    LinearLayout layout = new LinearLayout(this);
    setContentView(layout);
    autoCompleteTextView = new AutoCompleteTextView(this);
    autoCompleteTextView.setLayoutParams(new LayoutParams(MATCH_PARENT, WRAP_CONTENT));
    autoCompleteTextView.setId(R.id.auto_complete);
    layout.addView(autoCompleteTextView);
}
Also used : LayoutParams(android.view.ViewGroup.LayoutParams) LinearLayout(android.widget.LinearLayout) AutoCompleteTextView(android.widget.AutoCompleteTextView)

Example 8 with AutoCompleteTextView

use of android.widget.AutoCompleteTextView in project android_frameworks_base by DirtyUnicorns.

the class AutoCompleteTextViewActivityLandscape method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.auto_complete_list);
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, COUNTRIES);
    AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.edit);
    textView.setAdapter(adapter);
}
Also used : ArrayAdapter(android.widget.ArrayAdapter) AutoCompleteTextView(android.widget.AutoCompleteTextView)

Example 9 with AutoCompleteTextView

use of android.widget.AutoCompleteTextView in project android_frameworks_base by DirtyUnicorns.

the class AutoCompleteTextViewActivityPortrait method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.auto_complete_list);
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, COUNTRIES);
    AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.edit);
    textView.setAdapter(adapter);
}
Also used : ArrayAdapter(android.widget.ArrayAdapter) AutoCompleteTextView(android.widget.AutoCompleteTextView)

Example 10 with AutoCompleteTextView

use of android.widget.AutoCompleteTextView in project Lightning-Browser by anthonycr.

the class LightningDialogBuilder method showEditBookmarkDialog.

private void showEditBookmarkDialog(@NonNull final Activity activity, @NonNull final UIController uiController, @NonNull final HistoryItem item) {
    final AlertDialog.Builder editBookmarkDialog = new AlertDialog.Builder(activity);
    editBookmarkDialog.setTitle(R.string.title_edit_bookmark);
    final View dialogLayout = View.inflate(activity, R.layout.dialog_edit_bookmark, null);
    final EditText getTitle = (EditText) dialogLayout.findViewById(R.id.bookmark_title);
    getTitle.setText(item.getTitle());
    final EditText getUrl = (EditText) dialogLayout.findViewById(R.id.bookmark_url);
    getUrl.setText(item.getUrl());
    final AutoCompleteTextView getFolder = (AutoCompleteTextView) dialogLayout.findViewById(R.id.bookmark_folder);
    getFolder.setHint(R.string.folder);
    getFolder.setText(item.getFolder());
    mBookmarkManager.getFolderNames().subscribeOn(Schedulers.io()).observeOn(Schedulers.main()).subscribe(new SingleOnSubscribe<List<String>>() {

        @Override
        public void onItem(@Nullable List<String> folders) {
            Preconditions.checkNonNull(folders);
            final ArrayAdapter<String> suggestionsAdapter = new ArrayAdapter<>(activity, android.R.layout.simple_dropdown_item_1line, folders);
            getFolder.setThreshold(1);
            getFolder.setAdapter(suggestionsAdapter);
            editBookmarkDialog.setView(dialogLayout);
            editBookmarkDialog.setPositiveButton(activity.getString(R.string.action_ok), new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    HistoryItem editedItem = new HistoryItem();
                    editedItem.setTitle(getTitle.getText().toString());
                    editedItem.setUrl(getUrl.getText().toString());
                    editedItem.setUrl(getUrl.getText().toString());
                    editedItem.setFolder(getFolder.getText().toString());
                    mBookmarkManager.editBookmark(item, editedItem).subscribeOn(Schedulers.io()).observeOn(Schedulers.main()).subscribe(new CompletableOnSubscribe() {

                        @Override
                        public void onComplete() {
                            uiController.handleBookmarksChange();
                        }
                    });
                }
            });
            Dialog dialog = editBookmarkDialog.show();
            BrowserDialog.setDialogSize(activity, dialog);
        }
    });
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) EditText(android.widget.EditText) DialogInterface(android.content.DialogInterface) HistoryItem(acr.browser.lightning.database.HistoryItem) View(android.view.View) AutoCompleteTextView(android.widget.AutoCompleteTextView) Dialog(android.app.Dialog) AlertDialog(android.support.v7.app.AlertDialog) List(java.util.List) CompletableOnSubscribe(com.anthonycr.bonsai.CompletableOnSubscribe) ArrayAdapter(android.widget.ArrayAdapter) AutoCompleteTextView(android.widget.AutoCompleteTextView)

Aggregations

AutoCompleteTextView (android.widget.AutoCompleteTextView)106 View (android.view.View)62 TextView (android.widget.TextView)44 ArrayAdapter (android.widget.ArrayAdapter)38 Button (android.widget.Button)27 EditText (android.widget.EditText)21 OnClickListener (android.view.View.OnClickListener)20 KeyEvent (android.view.KeyEvent)19 AdapterView (android.widget.AdapterView)17 Intent (android.content.Intent)16 ImageView (android.widget.ImageView)14 Editable (android.text.Editable)10 TextWatcher (android.text.TextWatcher)10 ArrayList (java.util.ArrayList)9 Dialog (android.app.Dialog)8 ListView (android.widget.ListView)8 Spinner (android.widget.Spinner)8 DialogInterface (android.content.DialogInterface)7 InputMethodManager (android.view.inputmethod.InputMethodManager)7 SuppressLint (android.annotation.SuppressLint)6