use of android.app.Dialog in project AndroidDevelop by 7449.
the class EasyCityView method onStart.
@Override
public void onStart() {
super.onStart();
Dialog dialog = getDialog();
if (dialog != null && dialog.getWindow() != null) {
dialog.getWindow().setLayout(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
}
}
use of android.app.Dialog in project AndroidDevelop by 7449.
the class EasyPickerView method onStart.
@Override
public void onStart() {
super.onStart();
Dialog dialog = getDialog();
if (dialog != null && dialog.getWindow() != null) {
dialog.getWindow().setLayout(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
}
}
use of android.app.Dialog in project AntennaPod by AntennaPod.
the class ProxyDialog method createDialog.
public Dialog createDialog() {
dialog = new MaterialDialog.Builder(context).title(R.string.pref_proxy_title).customView(R.layout.proxy_settings, true).positiveText(R.string.proxy_test_label).negativeText(R.string.cancel_label).onPositive((dialog1, which) -> {
if (!testSuccessful) {
dialog.getActionButton(DialogAction.POSITIVE).setEnabled(false);
test();
return;
}
String type = (String) ((Spinner) dialog1.findViewById(R.id.spType)).getSelectedItem();
ProxyConfig proxy;
if (Proxy.Type.valueOf(type) == Proxy.Type.DIRECT) {
proxy = ProxyConfig.direct();
} else {
String host = etHost.getText().toString();
String port = etPort.getText().toString();
String username = etUsername.getText().toString();
if (TextUtils.isEmpty(username)) {
username = null;
}
String password = etPassword.getText().toString();
if (TextUtils.isEmpty(password)) {
password = null;
}
int portValue = 0;
if (!TextUtils.isEmpty(port)) {
portValue = Integer.valueOf(port);
}
proxy = ProxyConfig.http(host, portValue, username, password);
}
UserPreferences.setProxyConfig(proxy);
AntennapodHttpClient.reinit();
dialog.dismiss();
}).onNegative((dialog1, which) -> dialog1.dismiss()).autoDismiss(false).build();
View view = dialog.getCustomView();
spType = (Spinner) view.findViewById(R.id.spType);
String[] types = { Proxy.Type.DIRECT.name(), Proxy.Type.HTTP.name() };
ArrayAdapter<String> adapter = new ArrayAdapter<>(context, android.R.layout.simple_spinner_item, types);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spType.setAdapter(adapter);
ProxyConfig proxyConfig = UserPreferences.getProxyConfig();
spType.setSelection(adapter.getPosition(proxyConfig.type.name()));
etHost = (EditText) view.findViewById(R.id.etHost);
if (!TextUtils.isEmpty(proxyConfig.host)) {
etHost.setText(proxyConfig.host);
}
etHost.addTextChangedListener(requireTestOnChange);
etPort = (EditText) view.findViewById(R.id.etPort);
if (proxyConfig.port > 0) {
etPort.setText(String.valueOf(proxyConfig.port));
}
etPort.addTextChangedListener(requireTestOnChange);
etUsername = (EditText) view.findViewById(R.id.etUsername);
if (!TextUtils.isEmpty(proxyConfig.username)) {
etUsername.setText(proxyConfig.username);
}
etUsername.addTextChangedListener(requireTestOnChange);
etPassword = (EditText) view.findViewById(R.id.etPassword);
if (!TextUtils.isEmpty(proxyConfig.password)) {
etPassword.setText(proxyConfig.username);
}
etPassword.addTextChangedListener(requireTestOnChange);
if (proxyConfig.type == Proxy.Type.DIRECT) {
enableSettings(false);
setTestRequired(false);
}
spType.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
enableSettings(position > 0);
setTestRequired(position > 0);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
enableSettings(false);
}
});
txtvMessage = (TextView) view.findViewById(R.id.txtvMessage);
checkValidity();
return dialog;
}
use of android.app.Dialog in project Etar-Calendar by Etar-Group.
the class EventColorPickerDialog method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Dialog dialog = super.onCreateDialog(savedInstanceState);
mAlertDialog.setButton(DialogInterface.BUTTON_NEUTRAL, getActivity().getString(R.string.event_color_set_to_default), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
onColorSelected(mCalendarColor);
}
});
return dialog;
}
use of android.app.Dialog in project android_frameworks_base by DirtyUnicorns.
the class EditTextActivityDialog method createDialog.
protected Dialog createDialog(boolean scrollable) {
View layout;
EditText editText;
if (scrollable) {
layout = new ScrollView(EditTextActivityDialog.this);
((ScrollView) layout).setMinimumHeight(mLayout.getHeight());
((ScrollView) layout).addView((LinearLayout) View.inflate(EditTextActivityDialog.this, R.layout.dialog_edit_text_no_scroll, null));
} else {
layout = View.inflate(EditTextActivityDialog.this, R.layout.dialog_edit_text_no_scroll, null);
}
Dialog d = new Dialog(EditTextActivityDialog.this);
d.setTitle(getString(R.string.test_dialog));
d.setCancelable(true);
d.setContentView(layout);
return d;
}
Aggregations