Search in sources :

Example 66 with Dialog

use of android.app.Dialog in project Lightning-Browser by anthonycr.

the class GeneralSettingsFragment method searchDialog.

private void searchDialog() {
    AlertDialog.Builder picker = new AlertDialog.Builder(mActivity);
    picker.setTitle(getResources().getString(R.string.title_search_engine));
    CharSequence[] chars = { getResources().getString(R.string.custom_url), "Google", "Ask", "Bing", "Yahoo", "StartPage", "StartPage (Mobile)", "DuckDuckGo (Privacy)", "DuckDuckGo Lite (Privacy)", "Baidu (Chinese)", "Yandex (Russian)" };
    int n = mPreferenceManager.getSearchChoice();
    picker.setSingleChoiceItems(chars, n, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            mPreferenceManager.setSearchChoice(which);
            setSearchEngineSummary(which);
        }
    });
    picker.setPositiveButton(R.string.action_ok, null);
    Dialog dialog = picker.show();
    BrowserDialog.setDialogSize(mActivity, dialog);
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface) Dialog(android.app.Dialog) BrowserDialog(acr.browser.lightning.dialog.BrowserDialog) AlertDialog(android.support.v7.app.AlertDialog)

Example 67 with Dialog

use of android.app.Dialog in project Lightning-Browser by anthonycr.

the class GeneralSettingsFragment method downPicker.

private void downPicker() {
    View dialogView = LayoutInflater.from(mActivity).inflate(R.layout.dialog_edit_text, null);
    final EditText getDownload = (EditText) dialogView.findViewById(R.id.dialog_edit_text);
    final int errorColor = ContextCompat.getColor(mActivity, R.color.error_red);
    final int regularColor = ThemeUtils.getTextColor(mActivity);
    getDownload.setTextColor(regularColor);
    getDownload.addTextChangedListener(new DownloadLocationTextWatcher(getDownload, errorColor, regularColor));
    getDownload.setText(mPreferenceManager.getDownloadDirectory());
    AlertDialog.Builder downLocationPicker = new AlertDialog.Builder(mActivity).setTitle(R.string.title_download_location).setView(dialogView).setPositiveButton(R.string.action_ok, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            String text = getDownload.getText().toString();
            text = DownloadHandler.addNecessarySlashes(text);
            mPreferenceManager.setDownloadDirectory(text);
            downloadloc.setSummary(text);
        }
    });
    Dialog dialog = downLocationPicker.show();
    BrowserDialog.setDialogSize(mActivity, dialog);
}
Also used : EditText(android.widget.EditText) AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface) Dialog(android.app.Dialog) BrowserDialog(acr.browser.lightning.dialog.BrowserDialog) AlertDialog(android.support.v7.app.AlertDialog) View(android.view.View)

Example 68 with Dialog

use of android.app.Dialog in project Lightning-Browser by anthonycr.

the class PrivacySettingsFragment method clearHistoryDialog.

private void clearHistoryDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
    builder.setTitle(getResources().getString(R.string.title_clear_history));
    Dialog dialog = builder.setMessage(getResources().getString(R.string.dialog_history)).setPositiveButton(getResources().getString(R.string.action_yes), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface arg0, int arg1) {
            clearHistory().subscribeOn(Schedulers.io()).observeOn(Schedulers.main()).subscribe(new CompletableOnSubscribe() {

                @Override
                public void onComplete() {
                    Utils.showSnackbar(getActivity(), R.string.message_clear_history);
                }
            });
        }
    }).setNegativeButton(getResources().getString(R.string.action_no), null).show();
    BrowserDialog.setDialogSize(mActivity, dialog);
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface) Dialog(android.app.Dialog) BrowserDialog(acr.browser.lightning.dialog.BrowserDialog) AlertDialog(android.support.v7.app.AlertDialog) CompletableOnSubscribe(com.anthonycr.bonsai.CompletableOnSubscribe)

Example 69 with Dialog

use of android.app.Dialog in project Lightning-Browser by anthonycr.

the class GeneralSettingsFragment method downloadLocDialog.

private void downloadLocDialog() {
    AlertDialog.Builder picker = new AlertDialog.Builder(mActivity);
    picker.setTitle(getResources().getString(R.string.title_download_location));
    mDownloadLocation = mPreferenceManager.getDownloadDirectory();
    int n;
    if (mDownloadLocation.contains(Environment.DIRECTORY_DOWNLOADS)) {
        n = 0;
    } else {
        n = 1;
    }
    picker.setSingleChoiceItems(R.array.download_folder, n, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            switch(which) {
                case 0:
                    mPreferenceManager.setDownloadDirectory(DownloadHandler.DEFAULT_DOWNLOAD_PATH);
                    downloadloc.setSummary(DownloadHandler.DEFAULT_DOWNLOAD_PATH);
                    break;
                case 1:
                    downPicker();
                    break;
            }
        }
    });
    picker.setPositiveButton(getResources().getString(R.string.action_ok), null);
    Dialog dialog = picker.show();
    BrowserDialog.setDialogSize(mActivity, dialog);
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface) Dialog(android.app.Dialog) BrowserDialog(acr.browser.lightning.dialog.BrowserDialog) AlertDialog(android.support.v7.app.AlertDialog)

Example 70 with Dialog

use of android.app.Dialog in project Lightning-Browser by anthonycr.

the class GeneralSettingsFragment method agentDialog.

private void agentDialog() {
    AlertDialog.Builder agentPicker = new AlertDialog.Builder(mActivity);
    agentPicker.setTitle(getResources().getString(R.string.title_user_agent));
    mAgentChoice = mPreferenceManager.getUserAgentChoice();
    agentPicker.setSingleChoiceItems(R.array.user_agent, mAgentChoice - 1, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            mPreferenceManager.setUserAgentChoice(which + 1);
            switch(which) {
                case 0:
                    useragent.setSummary(getResources().getString(R.string.agent_default));
                    break;
                case 1:
                    useragent.setSummary(getResources().getString(R.string.agent_desktop));
                    break;
                case 2:
                    useragent.setSummary(getResources().getString(R.string.agent_mobile));
                    break;
                case 3:
                    useragent.setSummary(getResources().getString(R.string.agent_custom));
                    agentPicker();
                    break;
            }
        }
    });
    agentPicker.setPositiveButton(getResources().getString(R.string.action_ok), null);
    Dialog dialog = agentPicker.show();
    BrowserDialog.setDialogSize(mActivity, dialog);
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface) Dialog(android.app.Dialog) BrowserDialog(acr.browser.lightning.dialog.BrowserDialog) AlertDialog(android.support.v7.app.AlertDialog)

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