Search in sources :

Example 1 with AppCompatAutoCompleteTextView

use of android.support.v7.widget.AppCompatAutoCompleteTextView in project 91Pop by DanteAndroid.

the class SettingActivity method showAddressSettingDialog.

private void showAddressSettingDialog(final QMUICommonListItemView qmuiCommonListItemView, final String key) {
    View view = getLayoutInflater().inflate(R.layout.dialog_setting_address, qmuiCommonListItemView, false);
    final AlertDialog alertDialog = new AlertDialog.Builder(this, R.style.MyDialogTheme).setTitle(getAddressSettingTitle(key)).setView(view).setCancelable(false).show();
    AppCompatButton okAppCompatButton = view.findViewById(R.id.bt_dialog_address_setting_ok);
    AppCompatButton backAppCompatButton = view.findViewById(R.id.bt_dialog_address_setting_back);
    AppCompatButton testAppCompatButton = view.findViewById(R.id.bt_dialog_address_setting_test);
    final AppCompatAutoCompleteTextView autoCompleteTextView = view.findViewById(R.id.atv_dialog_address_setting_address);
    autoCompleteTextView.setText(testBaseUrl);
    if (!TextUtils.isEmpty(testBaseUrl)) {
        autoCompleteTextView.setSelection(testBaseUrl.length());
    }
    final String[] address = { "http://", "https://", "http://www.", "https://www." };
    ArrayAdapter<String> adapter = new ArrayAdapter<>(this, R.layout.item_auto_complete_textview, address);
    autoCompleteTextView.setAdapter(adapter);
    okAppCompatButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            String address = autoCompleteTextView.getText().toString().trim();
            if (!checkAddress(address)) {
                return;
            }
            testBaseUrl = address;
            alertDialog.dismiss();
            if (isTestSuccess) {
                saveToSpAndUpdateQMUICommonListItemView(key, qmuiCommonListItemView, address);
            } else {
                showConfirmDialog(qmuiCommonListItemView, address, key);
            }
        }
    });
    backAppCompatButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            resetOrUpdateAddress(key, addressHelper);
            alertDialog.dismiss();
        }
    });
    testAppCompatButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            String address = autoCompleteTextView.getText().toString().trim();
            if (!checkAddress(address)) {
                return;
            }
            testBaseUrl = address;
            alertDialog.dismiss();
            beginTestAddress(address, qmuiCommonListItemView, key);
        }
    });
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) AppCompatAutoCompleteTextView(android.support.v7.widget.AppCompatAutoCompleteTextView) QMUIGroupListView(com.qmuiteam.qmui.widget.grouplist.QMUIGroupListView) BindView(butterknife.BindView) QMUICommonListItemView(com.qmuiteam.qmui.widget.grouplist.QMUICommonListItemView) View(android.view.View) AppCompatAutoCompleteTextView(android.support.v7.widget.AppCompatAutoCompleteTextView) ArrayAdapter(android.widget.ArrayAdapter) AppCompatButton(android.support.v7.widget.AppCompatButton)

Example 2 with AppCompatAutoCompleteTextView

use of android.support.v7.widget.AppCompatAutoCompleteTextView in project EssayJoke by qiyei2015.

the class SkinAppCompatViewInflater method createView.

public final View createView(View parent, final String name, @NonNull Context context, @NonNull AttributeSet attrs, boolean inheritContext, boolean readAndroidTheme, boolean readAppTheme) {
    final Context originalContext = context;
    // by using the parent's context
    if (inheritContext && parent != null) {
        context = parent.getContext();
    }
    if (readAndroidTheme || readAppTheme) {
        // We then apply the theme on the context, if specified
        context = themifyContext(context, attrs, readAndroidTheme, readAppTheme);
    }
    View view = null;
    // We need to 'inject' our tint aware Views in place of the standard framework versions
    switch(name) {
        case "TextView":
            view = new AppCompatTextView(context, attrs);
            break;
        case "ImageView":
            view = new AppCompatImageView(context, attrs);
            break;
        case "Button":
            view = new AppCompatButton(context, attrs);
            break;
        case "EditText":
            view = new AppCompatEditText(context, attrs);
            break;
        case "Spinner":
            view = new AppCompatSpinner(context, attrs);
            break;
        case "ImageButton":
            view = new AppCompatImageButton(context, attrs);
            break;
        case "CheckBox":
            view = new AppCompatCheckBox(context, attrs);
            break;
        case "RadioButton":
            view = new AppCompatRadioButton(context, attrs);
            break;
        case "CheckedTextView":
            view = new AppCompatCheckedTextView(context, attrs);
            break;
        case "AutoCompleteTextView":
            view = new AppCompatAutoCompleteTextView(context, attrs);
            break;
        case "MultiAutoCompleteTextView":
            view = new AppCompatMultiAutoCompleteTextView(context, attrs);
            break;
        case "RatingBar":
            view = new AppCompatRatingBar(context, attrs);
            break;
        case "SeekBar":
            view = new AppCompatSeekBar(context, attrs);
            break;
    }
    if (view == null) {
        // If the original context does not equal our themed context, then we need to manually
        // inflate it using the name so that android:theme takes effect.
        view = createViewFromTag(context, name, attrs);
    }
    if (view != null) {
        // If we have created a view, check it's android:onClick
        checkOnClickListener(view, attrs);
    }
    return view;
}
Also used : Context(android.content.Context) AppCompatSeekBar(android.support.v7.widget.AppCompatSeekBar) AppCompatRadioButton(android.support.v7.widget.AppCompatRadioButton) AppCompatRatingBar(android.support.v7.widget.AppCompatRatingBar) AppCompatTextView(android.support.v7.widget.AppCompatTextView) AppCompatImageButton(android.support.v7.widget.AppCompatImageButton) AppCompatCheckedTextView(android.support.v7.widget.AppCompatCheckedTextView) AppCompatAutoCompleteTextView(android.support.v7.widget.AppCompatAutoCompleteTextView) View(android.view.View) AppCompatImageView(android.support.v7.widget.AppCompatImageView) AppCompatMultiAutoCompleteTextView(android.support.v7.widget.AppCompatMultiAutoCompleteTextView) AppCompatTextView(android.support.v7.widget.AppCompatTextView) AppCompatImageView(android.support.v7.widget.AppCompatImageView) AppCompatSpinner(android.support.v7.widget.AppCompatSpinner) AppCompatButton(android.support.v7.widget.AppCompatButton) AppCompatCheckBox(android.support.v7.widget.AppCompatCheckBox) AppCompatEditText(android.support.v7.widget.AppCompatEditText) AppCompatCheckedTextView(android.support.v7.widget.AppCompatCheckedTextView) AppCompatMultiAutoCompleteTextView(android.support.v7.widget.AppCompatMultiAutoCompleteTextView) AppCompatAutoCompleteTextView(android.support.v7.widget.AppCompatAutoCompleteTextView)

Aggregations

AppCompatAutoCompleteTextView (android.support.v7.widget.AppCompatAutoCompleteTextView)2 AppCompatButton (android.support.v7.widget.AppCompatButton)2 View (android.view.View)2 Context (android.content.Context)1 AlertDialog (android.support.v7.app.AlertDialog)1 AppCompatCheckBox (android.support.v7.widget.AppCompatCheckBox)1 AppCompatCheckedTextView (android.support.v7.widget.AppCompatCheckedTextView)1 AppCompatEditText (android.support.v7.widget.AppCompatEditText)1 AppCompatImageButton (android.support.v7.widget.AppCompatImageButton)1 AppCompatImageView (android.support.v7.widget.AppCompatImageView)1 AppCompatMultiAutoCompleteTextView (android.support.v7.widget.AppCompatMultiAutoCompleteTextView)1 AppCompatRadioButton (android.support.v7.widget.AppCompatRadioButton)1 AppCompatRatingBar (android.support.v7.widget.AppCompatRatingBar)1 AppCompatSeekBar (android.support.v7.widget.AppCompatSeekBar)1 AppCompatSpinner (android.support.v7.widget.AppCompatSpinner)1 AppCompatTextView (android.support.v7.widget.AppCompatTextView)1 ArrayAdapter (android.widget.ArrayAdapter)1 BindView (butterknife.BindView)1 QMUICommonListItemView (com.qmuiteam.qmui.widget.grouplist.QMUICommonListItemView)1 QMUIGroupListView (com.qmuiteam.qmui.widget.grouplist.QMUIGroupListView)1