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);
}
});
}
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;
}
Aggregations