Example usage for android.app AlertDialog.Builder setIcon

List of usage examples for android.app AlertDialog.Builder setIcon

Introduction

In this page you can find the example usage for android.app AlertDialog.Builder setIcon.

Prototype

public void setIcon(Drawable icon) 

Source Link

Usage

From source file:dentex.youtube.downloader.DashboardActivity.java

public void delete(final DashboardListItem currentItem) {
    AlertDialog.Builder del = new AlertDialog.Builder(boxThemeContextWrapper);
    //del.setTitle(getString(R.string.attention));
    del.setTitle(currentItem.getFilename());
    del.setMessage(getString(R.string.delete_video_confirm));
    del.setIcon(android.R.drawable.ic_dialog_alert);
    del.setPositiveButton("OK", new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int which) {
            final File fileToDel = new File(currentItem.getPath(), currentItem.getFilename());
            new AsyncDelete().execute(fileToDel);
        }/*from w w  w.j a  va2  s  .c om*/
    });

    del.setNegativeButton(R.string.dialogs_negative, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            // cancel
        }
    });

    secureShowDialog(del);
}

From source file:dentex.youtube.downloader.DashboardActivity.java

public void removeFromDashboard(final DashboardListItem currentItem) {
    AlertDialog.Builder rem = new AlertDialog.Builder(boxThemeContextWrapper);
    //rem.setTitle(getString(R.string.attention));
    rem.setTitle(currentItem.getFilename());
    rem.setMessage(getString(R.string.remove_video_confirm));
    rem.setIcon(android.R.drawable.ic_dialog_alert);
    rem.setPositiveButton("OK", new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int which) {
            Json.removeEntryFromJsonFile(DashboardActivity.this, currentItem.getId());
            refreshlist(DashboardActivity.this);

            YTD.videoinfo.edit().remove(currentItem.getId() + "_link").apply();
            //YTD.videoinfo.edit().remove(currentItem.getId() + "_position").apply();
        }//from w w  w.  ja v a2 s.  co m
    });

    rem.setNegativeButton(R.string.dialogs_negative, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            // cancel
        }
    });

    secureShowDialog(rem);
}

From source file:com.ranglerz.tlc.tlc.com.ranglerz.tlc.tlc.Insurance.TlcInsurance.java

private void showDialogForGettingUserDataFromSignUp() {

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setIcon(R.drawable.ic_action_paste);
    builder.setTitle("Auto Fill Data");
    builder.setMessage("Do you want to Load Your Information From Sign Up");

    builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {

        @Override//from ww w  .  j  a  v  a 2s  . com
        public void onClick(DialogInterface dialog, int which) {

            new autofill().execute();

            // Load Data From Session or Shared Preferences
            // OR Load Data from Back Panel

        }
    });

    builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {

            // Use Fill the form by it self
            dialog.dismiss();

        }
    });

    builder.show();

}

From source file:biz.bokhorst.xprivacy.ActivityMain.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final int userId = Util.getUserId(Process.myUid());

    // Check privacy service client
    if (!PrivacyService.checkClient())
        return;/*from ww  w  .  j a v  a2s  .c o  m*/

    // Import license file
    if (Intent.ACTION_VIEW.equals(getIntent().getAction()))
        if (Util.importProLicense(new File(getIntent().getData().getPath())) != null)
            Toast.makeText(this, getString(R.string.menu_pro), Toast.LENGTH_LONG).show();

    // Set layout
    setContentView(R.layout.mainlist);
    setSupportActionBar((Toolbar) findViewById(R.id.widgetToolbar));
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

    // Set sub title
    if (Util.hasProLicense(this) != null)
        getSupportActionBar().setSubtitle(R.string.menu_pro);

    // Annotate
    Meta.annotate(this.getResources());

    // Get localized restriction name
    List<String> listRestrictionName = new ArrayList<String>(
            PrivacyManager.getRestrictions(this).navigableKeySet());
    listRestrictionName.add(0, getString(R.string.menu_all));

    // Build spinner adapter
    SpinnerAdapter spAdapter = new SpinnerAdapter(this, android.R.layout.simple_spinner_item);
    spAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spAdapter.addAll(listRestrictionName);

    // Handle info
    ImageView imgInfo = (ImageView) findViewById(R.id.imgInfo);
    imgInfo.setOnClickListener(new View.OnClickListener() {
        @SuppressLint("SetJavaScriptEnabled")
        @Override
        public void onClick(View view) {
            int position = spRestriction.getSelectedItemPosition();
            if (position != AdapterView.INVALID_POSITION) {
                String query = (position == 0 ? "restrictions"
                        : (String) PrivacyManager.getRestrictions(ActivityMain.this).values().toArray()[position
                                - 1]);

                WebView webview = new WebView(ActivityMain.this);
                webview.getSettings().setUserAgentString("Mozilla/5.0");
                // needed for hashtag
                webview.getSettings().setJavaScriptEnabled(true);
                webview.loadUrl("https://github.com/M66B/XPrivacy#" + query);

                AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(ActivityMain.this);
                alertDialogBuilder.setTitle((String) spRestriction.getSelectedItem());
                alertDialogBuilder.setIcon(getThemed(R.attr.icon_launcher));
                alertDialogBuilder.setView(webview);
                alertDialogBuilder.setCancelable(true);
                AlertDialog alertDialog = alertDialogBuilder.create();
                alertDialog.show();
            }
        }
    });

    // Setup category spinner
    spRestriction = (Spinner) findViewById(R.id.spRestriction);
    spRestriction.setAdapter(spAdapter);
    spRestriction.setOnItemSelectedListener(this);
    int pos = getSelectedCategory(userId);
    spRestriction.setSelection(pos);

    // Setup sort
    mSortMode = Integer.parseInt(PrivacyManager.getSetting(userId, PrivacyManager.cSettingSortMode, "0"));
    mSortInvert = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingSortInverted, false);

    // Start task to get app list
    AppListTask appListTask = new AppListTask();
    appListTask.executeOnExecutor(mExecutor, (Object) null);

    // Check environment
    Requirements.check(this);

    // Licensing
    checkLicense();

    // Listen for package add/remove
    IntentFilter iff = new IntentFilter();
    iff.addAction(Intent.ACTION_PACKAGE_ADDED);
    iff.addAction(Intent.ACTION_PACKAGE_REMOVED);
    iff.addDataScheme("package");
    registerReceiver(mPackageChangeReceiver, iff);
    mPackageChangeReceiverRegistered = true;

    boolean showChangelog = true;

    // First run
    if (PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFirstRun, true)) {
        showChangelog = false;
        optionAbout();
    }

    // Tutorial
    if (!PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingTutorialMain, false)) {
        showChangelog = false;
        ((ScrollView) findViewById(R.id.svTutorialHeader)).setVisibility(View.VISIBLE);
        ((ScrollView) findViewById(R.id.svTutorialDetails)).setVisibility(View.VISIBLE);
    }
    View.OnClickListener listener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ViewParent parent = view.getParent();
            while (!parent.getClass().equals(ScrollView.class))
                parent = parent.getParent();
            ((View) parent).setVisibility(View.GONE);
            PrivacyManager.setSetting(userId, PrivacyManager.cSettingTutorialMain, Boolean.TRUE.toString());
        }
    };
    ((Button) findViewById(R.id.btnTutorialHeader)).setOnClickListener(listener);
    ((Button) findViewById(R.id.btnTutorialDetails)).setOnClickListener(listener);

    // Legacy
    if (!PrivacyManager.cVersion3) {
        long now = new Date().getTime();
        String legacy = PrivacyManager.getSetting(userId, PrivacyManager.cSettingLegacy, null);
        if (legacy == null || now > Long.parseLong(legacy) + 7 * 24 * 60 * 60 * 1000L) {
            showChangelog = false;
            PrivacyManager.setSetting(userId, PrivacyManager.cSettingLegacy, Long.toString(now));

            AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
            alertDialogBuilder.setTitle(R.string.app_name);
            alertDialogBuilder.setIcon(getThemed(R.attr.icon_launcher));
            alertDialogBuilder.setMessage(R.string.title_update_legacy);
            alertDialogBuilder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    Util.viewUri(ActivityMain.this,
                            Uri.parse("https://github.com/M66B/XPrivacy/blob/master/CHANGELOG.md#xprivacy3"));
                }
            });
            alertDialogBuilder.setNegativeButton(android.R.string.cancel,
                    new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            // Do nothing
                        }
                    });

            // Show dialog
            AlertDialog alertDialog = alertDialogBuilder.create();
            alertDialog.show();
        }
    }

    // Show changelog
    if (showChangelog) {
        String sVersion = PrivacyManager.getSetting(userId, PrivacyManager.cSettingChangelog, null);
        Version changelogVersion = new Version(sVersion == null ? "0.0" : sVersion);
        Version currentVersion = new Version(Util.getSelfVersionName(this));
        if (sVersion == null || changelogVersion.compareTo(currentVersion) < 0)
            optionChangelog();
    }
}

From source file:com.zuluindia.watchpresenter.MainActivity.java

public void showSuggestUpdateDialog(final VersionMessage message) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this)
            .setTitle(getResources().getString(R.string.aMessageFromTheDeveloper))
            .setMessage(message.getMessage());
    final String action = message.getAction();
    if (Constants.VersionMessageActions.ACTION_RECOMMEND_UPGRADE.equals(action)
            || Constants.VersionMessageActions.ACTION_FORCE_UPGRADE.equals(action)) {
        builder.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(message.getUrl()));
                startActivity(myIntent);
                finish();/*from  w  w  w  .  j  a  va2 s.c om*/
            }
        });
    }
    if (Constants.VersionMessageActions.ACTION_BLOCK.equals(action)) {
        builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                finish();
            }
        });
    }
    if (Constants.VersionMessageActions.ACTION_SHOW_MESSAGE.equals(action)) {
        builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                //nothing to do here
            }
        });
    }
    if (Constants.VersionMessageActions.ACTION_RECOMMEND_UPGRADE.equals(action)) {
        builder.setNegativeButton(com.zuluindia.watchpresenter.R.string.later,
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        //nothing to do here
                    }
                });
    }
    if (Constants.VersionMessageActions.ACTION_FORCE_UPGRADE.equals(action)) {
        builder.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                finish();
            }
        });
    }
    builder.setIcon(android.R.drawable.ic_dialog_alert);
    builder.show();
}

From source file:com.smc.tw.waltz.MainActivity.java

private void showStartAllowJoinDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.WaltzDialog);

    builder.setIcon(R.drawable.sensor_other);
    builder.setTitle(R.string.sensor_allow_join);
    builder.setMessage(R.string.sensor_start_allow_join);
    builder.setCancelable(false);//w ww  .  j a v a 2 s.  c  om
    builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialogInterface, int id) {
        }
    });

    builder.create().show();
}

From source file:com.smc.tw.waltz.MainActivity.java

private void showAccessCodeNotMatchDialog() {
    if (DEBUG)//from w  w  w  .  j av a 2 s  . c om
        Log.d(TAG, "showAccessCodeNotMatchDialog");

    AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.WaltzDialog);

    builder.setIcon(R.drawable.ic_launcher);
    builder.setTitle(R.string.app_name);
    builder.setMessage(R.string.dialog_access_code_not_match);
    builder.setCancelable(false);
    builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialogInterface, int id) {
        }
    });

    builder.create().show();
}

From source file:com.smc.tw.waltz.MainActivity.java

private void showAccessCodeLengthWrongDialog() {
    if (DEBUG)// ww w  .ja  va  2s .co m
        Log.d(TAG, "showAccessCodeLengthWrongDialog");

    AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.WaltzDialog);

    builder.setIcon(R.drawable.ic_launcher);
    builder.setTitle(R.string.app_name);
    builder.setMessage(R.string.dialog_access_code_length_wrong);
    builder.setCancelable(false);
    builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialogInterface, int id) {
            showInputAccessCodeDialog(mCurrentDeviceIndex);
        }
    });

    builder.create().show();
}

From source file:com.smc.tw.waltz.MainActivity.java

private void showQuitDialog() {
    if (DEBUG)//from   w w  w .j  a  va 2  s.c o  m
        Log.d(TAG, "showQuitDialog");

    AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.WaltzDialog);

    builder.setIcon(R.drawable.ic_launcher);
    builder.setTitle(R.string.app_name);
    builder.setMessage(R.string.sure_to_quit);
    builder.setCancelable(false);
    builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialogInterface, int id) {
            finish();
        }
    });

    builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialogInterface, int id) {
        }
    });

    builder.create().show();
}

From source file:com.smc.tw.waltz.MainActivity.java

private void showRestoreDeviceDialog(WaltzDevice device) {
    if (DEBUG)/*from w  w  w .java2  s  . c  o  m*/
        Log.d(TAG, "showRestoreDeviceDialog d:" + device);

    if (device == null)
        return;

    AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.WaltzDialog);

    builder.setIcon(R.drawable.ic_launcher);
    builder.setTitle(R.string.app_name);
    builder.setMessage(getString(R.string.sure_to_restore) + " (" + device.getName() + ") ?");
    builder.setCancelable(false);
    builder.setPositiveButton(R.string.restore_default, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialogInterface, int id) {
            device.restoreSystemDefault();
        }
    });

    builder.setNeutralButton(R.string.restore_network, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialogInterface, int id) {
            device.restoreSystemKeepNetwork();
        }
    });

    builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialogInterface, int id) {
        }
    });

    builder.create().show();
}