Package android.widget

Examples of android.widget.TextView


      layouter = LayoutInflater.from(Test.this);
    }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      View view = layouter.inflate(layoutId, null);
      TextView title = (TextView) view.findViewById(R.id.title);
      TextView params = (TextView) view.findViewById(R.id.params);
      String string = getItem(position);
      String[] arr = string.split(";");
      title.setText(arr[0]);
      if (arr.length == 2) {
        params.setText(arr[1]);
      } else {
        params.setVisibility(View.GONE);
      }
      return view;
    }
View Full Code Here


    Button close = new Button(this);
    close.setText("Close");
    close.setOnClickListener(this);
    close.setGravity(Gravity.CENTER);
   
    TextView text = new TextView(this);
    text.setText("http://code.google.com/p/jfireeagle/wiki/Android");
    text.setAutoLinkMask(Linkify.ALL);
    text.setTextSize( (text.getTextSize() - 2.0f));
    text.setGravity(Gravity.CENTER);
   
    layout.addView(text);
    layout.addView(close);
   
    setContentView(scroll);
View Full Code Here

        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);
             
              SecurityUtils.CipherInfo info =  SecurityUtils.createCiphers(
                  password, saltAndRounds.salt, saltAndRounds.rounds);
View Full Code Here

  private void setCipherStrengthLabel(Dialog dialog, int rounds) {
    String template =
      getText(R.string.cipher_strength_label).toString();
    String msg = MessageFormat.format(template, rounds);
    TextView text = (TextView) dialog.findViewById(
        R.id.cipher_strength_label);
    text.setText(msg);
  }
View Full Code Here

      case DIALOG_CHANGE_PASSWORD: {
        SeekBar bar = (SeekBar) dialog.findViewById(R.id.cipher_strength);
        int rounds = SecurityUtils.getRounds();
        bar.setProgress(rounds - PROGRESS_ROUNDS_OFFSET);
        setCipherStrengthLabel(dialog, rounds);
        TextView password1 = (TextView) dialog.findViewById(
            R.id.password);
        password1.setText("");
        TextView password2 = (TextView) dialog.findViewById(
            R.id.password_validation);
        password2.setText("");
        password1.requestFocus();
        break;
      }
      case DIALOG_ENTER_RESTORE_PASSWORD: {
        TextView password1 = (TextView) dialog.findViewById(R.id.password);
        password1.setText("");
        break;
      }
    }
  }
View Full Code Here

    // (Its also possible that the user started the app but never got passed
    // entering his password)  In this case, we will show a special first time
    // message with instructions about entering a password, followed by a
    // validation pass to get him to enter the password again.
    isFirstRun = isFirstRun();
    TextView instructions = (TextView)findViewById(R.id.login_instructions);
    TextView strength = (TextView)findViewById(R.id.password_strength);
    if (isFirstRun) {
      instructions.setText(R.string.login_instruction_1);
      strength.setVisibility(TextView.VISIBLE);
    } else {
      instructions.setText("");
      strength.setVisibility(TextView.GONE);
    }

    // Clear the password.  The user always needs to type it again when this
    // activity is started.
    TextView password = (TextView) findViewById(R.id.login_password);
    password.setText("");
    password.setHint(R.string.login_enter_password);
    Log.d(LOG_TAG, "LoginActivity.onResume done");
  }
View Full Code Here

    // from the edit view.  So the clearing of the edit text is done in the
    // various code paths below, after setting the hint as needed.
    String passwordString = passwordView.getText().toString();

    if (isFirstRun) {
      TextView instructions = (TextView)findViewById(R.id.login_instructions);
      TextView strength = (TextView)findViewById(R.id.password_strength);

      if (!isValidatingPassword) {
        // This is the first run, and the user has created his password for the
        // first time.  We need to get him to validate it, so show the second
        // set of instructions, remember the password, clear the password field,
        // and wait for him to enter it again.
        instructions.setText(R.string.login_instruction_2);
        passwordView.setHint(R.string.login_validate_password);
        passwordView.setText("");
        strength.setVisibility(TextView.GONE);

        this.passwordString = passwordString;
        isValidatingPassword = true;
        return;
      } else {
        // This is the first run, and the user is validating his password.
        // If they are the same, continue to the next activity.  If not,
        // display an error message and go back to creating a brand new
        // password.
        if (!passwordString.equals(this.passwordString)) {
          instructions.setText(R.string.login_instruction_1);
          strength.setVisibility(TextView.VISIBLE);
          passwordView.setHint(R.string.login_enter_password);
          passwordView.setText("");
          showToast(R.string.invalid_password, Toast.LENGTH_SHORT);

          this.passwordString = null;
View Full Code Here

   */
  private void updatePasswordStrengthView(String password) {
    // First, check to see if the view is visible at all before we proceed. We
    // rely on the LoginActivity flow to hide or show the password view
    // depending on what state it is in.
    TextView strengthView = (TextView)findViewById(R.id.password_strength);
    if (TextView.VISIBLE != strengthView.getVisibility())
      return;

    // Update UI appropriately based on the strength calculated.
    PasswordStrength str = PasswordStrength.calculateStrength(password);
    strengthView.setText(MessageFormat.format(
        getText(R.string.password_strength_caption).toString(),
        str.getText(this)));
    strengthView.setTextColor(str.getColor());
  }
View Full Code Here

    }

    // Now setup the view based on the current secret.
    Secret secret = secrets.get(position);

    TextView text1 = (TextView) convertView.findViewById(android.R.id.text1);
    TextView text2 = (TextView) convertView.findViewById(android.R.id.text2);

    text1.setText(secret.getDescription());
    text2.setText(getFriendlyId(secret));

    return convertView;
  }
View Full Code Here

      super(context);

      compactText = c.getDisplayName();
      expandedText = c.toString();

      textView = new TextView(context);
      textView.setText(compactText);
      textView.setTextSize(18);

      this.addView(textView);
    }
View Full Code Here

TOP

Related Classes of android.widget.TextView

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.