Examples of AlertDialog


Examples of android.app.AlertDialog

          BackgroundService.restart(this);
         
        }
        else if ( !settings.getUserSpecificToken().isValid() )
        {
        final AlertDialog alert = new AlertDialog.Builder(this).create();
        alert.setMessage("To get started, you will need to login to Yahoo Fire Eagle");
        alert.setButton("Login", new DialogInterface.OnClickListener()
        {

          public void onClick(DialogInterface dialog, int whichButton)
          {
            alert.dismiss();
           
            final String url = client.getUserAuthorizationUrl();

            Log.i(this.getClass().getName(), url);
             
                Preferences.updateRequestToken(client.getRequestToken());
                Preferences.commit();
               
            openWebBrowser(url);
           
            MainActivity.this.finish();
           
          }
        });
        alert.show();
       
    }
       
             
        LinearLayout layout = new LinearLayout(this);
View Full Code Here

Examples of android.app.AlertDialog

      case DIALOG_CHANGE_PASSWORD: {
        DialogInterface.OnClickListener listener =
          new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogi, int which) {
              AlertDialog dialog = (AlertDialog) dialogi;
              TextView password1 = (TextView) dialog.findViewById(
                  R.id.password);
              TextView password2 = (TextView) dialog.findViewById(
                  R.id.password_validation);
              String password = password1.getText().toString();
              String p2 = password2.getText().toString();
              if (!password.equals(p2) || password.length() == 0) {
                showToast(R.string.invalid_password);
                return;
              }

              SeekBar bar = (SeekBar) dialog.findViewById(R.id.cipher_strength);
              byte[] salt = SecurityUtils.getSalt();
              int rounds = bar.getProgress() + PROGRESS_ROUNDS_OFFSET;

              SecurityUtils.CipherInfo info = SecurityUtils.createCiphers(
                  password, salt, rounds);
              if (null != info) {
                SecurityUtils.saveCiphers(info);
                showToast(R.string.password_changed);
              } else {
                showToast(R.string.error_reset_password);
              }
            }
          };

        LayoutInflater inflater = getLayoutInflater();
        View view = inflater.inflate(R.layout.change_password, getListView(),
                                     false);

        dialog = new AlertDialog.Builder(this)
            .setTitle(R.string.list_menu_change_password)
            .setIcon(android.R.drawable.ic_dialog_info)
            .setView(view)
            .setPositiveButton(R.string.list_menu_change_password, listener)
            .create();
        final Dialog dialogFinal = dialog;
       
        SeekBar bar = (SeekBar) view.findViewById(R.id.cipher_strength);
        bar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
          @Override
          public void onProgressChanged(SeekBar seekBar, int progress,
              boolean fromUser) {
            setCipherStrengthLabel(dialogFinal, progress +
                                   PROGRESS_ROUNDS_OFFSET);
          }
          @Override
          public void onStartTrackingTouch(SeekBar seekBar) {
          }
          @Override
          public void onStopTrackingTouch(SeekBar seekBar) {
          }});
        break;
      }
      case DIALOG_ENTER_RESTORE_PASSWORD: {
        DialogInterface.OnClickListener listener =
          new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogi, int which) {
              AlertDialog dialog = (AlertDialog) dialogi;
              TextView password1 = (TextView) dialog.findViewById(
                  R.id.password);

              String password = password1.getText().toString();
              FileUtils.SaltAndRounds saltAndRounds =
                  FileUtils.getSaltAndRounds(null, restorePoint);
View Full Code Here

Examples of android.app.AlertDialog

  protected void onPrepareDialog(int id, Dialog dialog) {
    super.onPrepareDialog(id, dialog);

    switch(id) {
      case DIALOG_DELETE_SECRET: {
        AlertDialog alert = (AlertDialog) dialog;
        Secret secret = secretsList.getSecret(cmenuPosition);
        String template = getText(R.string.edit_menu_delete_secret_message).
            toString();
        String msg = MessageFormat.format(template, secret.getDescription());
        alert.setMessage(msg);
        break;
      }
      case DIALOG_IMPORT_SUCCESS: {
        AlertDialog alert = (AlertDialog) dialog;
        String template =
            getText(R.string.edit_menu_import_secrets_message).toString();
        String msg = MessageFormat.format(template, importedFile.getName());
        alert.setMessage(msg);
        break;
      }
      case DIALOG_CHANGE_PASSWORD: {
        SeekBar bar = (SeekBar) dialog.findViewById(R.id.cipher_strength);
        int rounds = SecurityUtils.getRounds();
View Full Code Here

Examples of android.app.AlertDialog

      long id) {
    final String providerName = providers[position];
    final OAuth3LeggedScheme authScheme = getAuth(providerName);

    if (authScheme != null) {
      final AlertDialog alert = new AlertDialog.Builder(this).create();
      alert.setMessage("To get started, you will need to login to " + providerName);
      alert.setButton("Login", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
          alert.dismiss();

          String url = null;
          try {
            url = authScheme.getAuthorizationUrl(scheme + "://");
            persistRequestToken(authScheme.getRequestToken(), providerName);
          } catch (IOException e) {
            throw new RuntimeException("Error occured fetching request token: " + e.getMessage(), e);
          } catch (URISyntaxException e) {
            throw new RuntimeException("Error occured fetching request token", e);
          } catch (OAuthException e) {
            throw new RuntimeException("Error occured fetching request token", e);
          }

          Intent i = new Intent(Intent.ACTION_VIEW);
          i.setData(Uri.parse(url));
          startActivity(i);

          finish();
        }
      });
      alert.show();
    }
  }
View Full Code Here

Examples of com.lightcrafts.platform.AlertDialog

    /**
     * Show the user a dialog telling him/her to upgrade the installed Java
     * version, then quit.
     */
    private static void showUpgradeJavaDialogAndQuit() {
        final AlertDialog dialog = Platform.getPlatform().getAlertDialog();
        dialog.showAlert(
            null, LOCALE.get( "UpgradeJavaErrorMajor" ),
            LOCALE.get( "UpgradeJavaErrorMinor" ),
            AlertDialog.ERROR_ALERT, LOCALE.get( "QuitButton" )
        );
        System.exit( 0 );
View Full Code Here

Examples of com.lightcrafts.platform.AlertDialog

* dialogs to ask about overwrite and to report errors.
*/
class FileActions {

    static void deleteFiles(File[] files, Component parent) {
        AlertDialog alert = Platform.getPlatform().getAlertDialog();
        Frame frame = (Frame) SwingUtilities.getAncestorOfClass(
            Frame.class, parent
        );
        StringBuilder info = new StringBuilder();
        String message;
        if (files.length > 1) {
            message = LOCALE.get("DeleteQuestionPlural", Integer.toString(files.length));
        }
        else {
            message = LOCALE.get("DeleteQuestionSingular", files[0].getName());
        }
        String okButton = LOCALE.get("DeleteButton");
        String cancelButton = LOCALE.get("CancelButton");
        int option = alert.showAlert(
            frame, message, info.toString(),
            AlertDialog.WARNING_ALERT,
            okButton, cancelButton
        );
        if (option == 0) {
            Platform platform = Platform.getPlatform();
            for (File file : files) {
                String path = file.getAbsolutePath();
                boolean deleted;
                try {
                    ImageInfo.closeAll();
                    deleted = platform.moveFilesToTrash(new String[] { path });
                }
                catch (IOException e) {
                    deleted = false;
                }
                if (! deleted) {
                    String error =
                        LOCALE.get("DeleteFailed", file.getName());
                    option = alert.showAlert(
                        frame, error, "", AlertDialog.ERROR_ALERT,
                        LOCALE.get( "ContinueButton" ),
                        LOCALE.get( "CancelButton" )
                    );
                    if (option > 0) {
View Full Code Here

Examples of com.lightcrafts.platform.AlertDialog

        if ( "ESD".equals( licenseType ) )
            licenseChecker = new ESDLicenseCheckerModule();
        else if ( "TB".equals( licenseType ) )
            licenseChecker = new ExpirationLicenseCheckerModule();
        else {
            final AlertDialog dialog = Platform.getPlatform().getAlertDialog();
            dialog.showAlert(
                null, LOCALE.get( "NoLicenseTypeDefinedMajor" ),
                LOCALE.get( "NoLicenseTypeDefinedMinor" ),
                AlertDialog.ERROR_ALERT,
                LOCALE.get( "QuitButton" )
            );
View Full Code Here

Examples of com.lightcrafts.platform.AlertDialog

    /**
     * {@inheritDoc}
     */
    public boolean showDeactivateDialog() {
        final AlertDialog dialog = Platform.getPlatform().getAlertDialog();
        final int button = dialog.showAlert(
            null,
            LOCALE.get( "DeactivateQuestionMajor" ),
            LOCALE.get( "DeactivateQuestionMinor" ), AlertDialog.WARNING_ALERT,
            LOCALE.get( "CancelButton" ), LOCALE.get( "DeactivateButton" )
        );
View Full Code Here

Examples of com.lightcrafts.platform.AlertDialog

    /**
     * {@inheritDoc}
     */
    public void showErrorAlert( String errorMessage, boolean isFatal ) {
        final AlertDialog dialog = Platform.getPlatform().getAlertDialog();
        dialog.showAlert(
            null, errorMessage, null, AlertDialog.ERROR_ALERT,
            isFatal ? LOCALE.get( "QuitButton" ) : LOCALE.get( "OKButton" )
        );
    }
View Full Code Here

Examples of com.lightcrafts.platform.AlertDialog

                                       ESDLicenseDialogs dialogs ) {
        if ( lib.isKeyValid( key ) )
            return true;
        if ( key.startsWith( "0101605001" ) ||  // LZ 1.x
             key.startsWith( "LZRT" ) || key.startsWith( "LZ2" ) ) {
            final AlertDialog dialog = Platform.getPlatform().getAlertDialog();
            final int button = dialog.showAlert(
                null,
                LOCALE.get( "Pre3SNErrorMajor" ),
                LOCALE.get( "Pre3SNErrorMinor" ),
                AlertDialog.ERROR_ALERT,
                LOCALE.get( "BuyNowButton" ),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.