Package android.app

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


      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

  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

      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

TOP

Related Classes of android.app.AlertDialog

Copyright © 2018 www.massapicom. 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.