Search in sources :

Example 51 with Dialog

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);
    }
}
Also used : Dialog(android.app.Dialog) AlertDialog(android.support.v7.app.AlertDialog)

Example 52 with Dialog

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);
    }
}
Also used : Dialog(android.app.Dialog) AlertDialog(android.support.v7.app.AlertDialog)

Example 53 with Dialog

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;
}
Also used : Context(android.content.Context) SocketAddress(java.net.SocketAddress) AndroidSchedulers(rx.android.schedulers.AndroidSchedulers) Dialog(android.app.Dialog) Editable(android.text.Editable) TypedArray(android.content.res.TypedArray) Observable(rx.Observable) UserPreferences(de.danoeh.antennapod.core.preferences.UserPreferences) MDButton(com.afollestad.materialdialogs.internal.MDButton) Patterns(android.util.Patterns) Proxy(java.net.Proxy) Schedulers(rx.schedulers.Schedulers) View(android.view.View) Response(okhttp3.Response) AdapterView(android.widget.AdapterView) AntennapodHttpClient(de.danoeh.antennapod.core.service.download.AntennapodHttpClient) Request(okhttp3.Request) Subscriber(rx.Subscriber) R(de.danoeh.antennapod.R) ContextCompat(android.support.v4.content.ContextCompat) TextUtils(android.text.TextUtils) DialogAction(com.afollestad.materialdialogs.DialogAction) IOException(java.io.IOException) Credentials(okhttp3.Credentials) InetSocketAddress(java.net.InetSocketAddress) ProxyConfig(de.danoeh.antennapod.core.service.download.ProxyConfig) Spinner(android.widget.Spinner) TimeUnit(java.util.concurrent.TimeUnit) ArrayAdapter(android.widget.ArrayAdapter) TextView(android.widget.TextView) OkHttpClient(okhttp3.OkHttpClient) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) Subscription(rx.Subscription) EditText(android.widget.EditText) TextWatcher(android.text.TextWatcher) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) ProxyConfig(de.danoeh.antennapod.core.service.download.ProxyConfig) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) AdapterView(android.widget.AdapterView) ArrayAdapter(android.widget.ArrayAdapter)

Example 54 with 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;
}
Also used : DialogInterface(android.content.DialogInterface) ColorPickerDialog(com.android.colorpicker.ColorPickerDialog) Dialog(android.app.Dialog)

Example 55 with 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;
}
Also used : EditText(android.widget.EditText) ScrollView(android.widget.ScrollView) Dialog(android.app.Dialog) ScrollView(android.widget.ScrollView) View(android.view.View)

Aggregations

Dialog (android.app.Dialog)792 View (android.view.View)317 AlertDialog (android.app.AlertDialog)256 TextView (android.widget.TextView)219 DialogInterface (android.content.DialogInterface)200 Intent (android.content.Intent)97 Bundle (android.os.Bundle)94 Context (android.content.Context)93 AlertDialog (android.support.v7.app.AlertDialog)93 ListView (android.widget.ListView)87 EditText (android.widget.EditText)84 Button (android.widget.Button)80 AdapterView (android.widget.AdapterView)79 NonNull (android.support.annotation.NonNull)77 LayoutInflater (android.view.LayoutInflater)75 ImageView (android.widget.ImageView)70 ArrayList (java.util.ArrayList)64 LinearLayout (android.widget.LinearLayout)54 WindowManager (android.view.WindowManager)52 ProgressDialog (android.app.ProgressDialog)51