public void onCreate(Bundle savedState) {
    super.onCreate(savedState);
    Button mBtnSaveAndQuit = (Button) findViewById(R.id.btnSaveAndQuit);
    mStreetAddress = (EditText) findViewById(R.id.edStreet);
    mCity = (EditText) findViewById(R.id.edCity);
    mZip = (EditText) findViewById(R.id.edZip);
    mState = (Spinner) findViewById(R.id.statePicker);
    mCountry = (Spinner) findViewById(R.id.countryPicker);
    mAddressLabel = (Spinner) findViewById(R.id.addressLabelPicker);
    mStreetAddress.setInputType(InputType.TYPE_CLASS_TEXT);
    mCity.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
    mZip.setInputType(InputType.TYPE_CLASS_TEXT);
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
    mBtnSaveAndQuit.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            try {
              saveAndQuit();
            } catch (IllegalArgumentException e) {
              DialogUtils.showNeutralButtonDialog(AddressActivity.this, "Error", e.getMessage());
            } catch (InvalidAttributeValueException e) {
              DialogUtils.showNeutralButtonDialog(AddressActivity.this, "Error", e.getMessage());
            } catch (MIDaaSException e) {
              DialogUtils.showNeutralButtonDialog(
                  AddressActivity.this, "Error", e.getError().getErrorMessage());
            }
          }
        });
  }
  public void findViews() {
    intent = getIntent();
    params = intent.getExtras();
    IdPessoa = params.getInt("Gestor");
    servidor = new Servidor();
    servidor.setPessoaId(params.getInt("Gestor"));

    // Prazo inscrições.
    editTextInicioInscricoes = (EditText) findViewById(R.id.editTextInicioInscricoes);
    editTextInicioInscricoes.setInputType(InputType.TYPE_NULL);
    editTextFimInscricoes = (EditText) findViewById(R.id.editTextFimInscricoes);
    editTextInicioInscricoes.setInputType(InputType.TYPE_NULL);

    // Prazo relatório parcial e final
    editTextPrazoRelatorioParcial = (EditText) findViewById(R.id.editTextPrazoRelatorioParcial);
    editTextPrazoRelatorioParcial.setInputType(InputType.TYPE_NULL);
    editTextPrazoRelatorioFinal = (EditText) findViewById(R.id.editTextPrazoRelatorioFinal);
    editTextPrazoRelatorioFinal.setInputType(InputType.TYPE_NULL);

    editTextNumeroEdital = (EditText) findViewById(R.id.editTextNumeroEdital);
    editTextAno = (EditText) findViewById(R.id.editTextAno);
    editTextNumeroVagas = (EditText) findViewById(R.id.editTextNumeroVagas);
    editTextBolsaOrientador = (EditText) findViewById(R.id.editTextBolsaOrientador);
    editTextBolsaDiscente = (EditText) findViewById(R.id.editTextBolsaDiscente);
    spinnerProgramaInstitucional = (Spinner) findViewById(R.id.spinnerProgramaInstitucional);
    spinnerTipoEdital = (Spinner) findViewById(R.id.spinnerTipoEdital);
    buttonCadastrarEdital = (Button) findViewById(R.id.buttonCadastrarEdital);

    actionBar = getActionBar();
    actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.background_menu));
    builderLogout = new AlertDialog.Builder(this);
    sessionManager = new SessionManager(this);
  }
  public void changeusername() {
    AlertDialog.Builder alert = new AlertDialog.Builder(this);
    alert.setTitle("Edit Name");
    LinearLayout linearLayout = new LinearLayout(this);
    linearLayout.setOrientation(1);
    LinearLayout.LayoutParams layoutParams =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    layoutParams.setMargins(10, 0, 10, 0);
    final EditText fname = new EditText(this);
    final EditText sname = new EditText(this);
    fname.setHint("first");
    sname.setHint("last");
    fname.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PERSON_NAME);
    sname.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PERSON_NAME);
    linearLayout.addView(fname, layoutParams);
    linearLayout.addView(sname, layoutParams);
    alert.setView(linearLayout);

    alert.setPositiveButton(
        "OK",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {}
        });

    alert.setNegativeButton(
        "Cancel",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {}
        });

    alert.show();
  }
Example #4
0
  @Override
  public void onClick(View view) {
    switch (view.getId()) {
      case R.id.clickmeButton:
        String check = InputText.getText().toString();
        if (check.contentEquals("left")) {
          ashusText.setGravity(Gravity.LEFT);
          ashusText.setText("left");

        } else if (check.contentEquals("center")) {
          ashusText.setGravity(Gravity.CENTER);
          ashusText.setText("center");

        } else if (check.contentEquals("right")) {
          ashusText.setGravity(Gravity.RIGHT);
          ashusText.setText("right");

        } else if (check.contentEquals("blue")) {
          ashusText.setBackgroundColor(Color.BLUE);
        } else if (check.contains("ASHU")) {
          Random crazy = new Random();
          ashusText.setText("ASHU!!!!");
          ashusText.setTextSize(crazy.nextInt(75)); // //75 Random chocies for Text.////
          ashusText.setTextColor(
              Color.rgb(crazy.nextInt(265), crazy.nextInt(265), crazy.nextInt(265)));

          switch (crazy.nextInt(3)) // ///There 3 cases only////
          {
            case 0:
              ashusText.setGravity(Gravity.LEFT);
              break;
            case 1:
              ashusText.setGravity(Gravity.CENTER);

              break;
            case 2:
              ashusText.setGravity(Gravity.RIGHT);

              break;
          }

        } else {
          ashusText.setText("Invalid");
          ashusText.setGravity(Gravity.CENTER);
          ashusText.setTextColor(Color.RED);
        }
        break;

      case R.id.toggleButton:
        if (toggleButton.isChecked()) {
          InputText.setInputType(
              InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);

        } else {
          InputText.setInputType(InputType.TYPE_CLASS_TEXT);
        }

        break;
    }
  }
Example #5
0
  /** OnClickListener methods */
  @Override
  public void onClick(View view) {
    if (editText == null) {
      editText = new EditText(Utils.mainActivity);
      editText.setGravity(Gravity.CENTER);
      editText.setImeOptions(EditorInfo.IME_ACTION_DONE);
    }

    if (inputType != null) {
      if (inputType.toLowerCase().equals("numeric"))
        editText.setInputType(InputType.TYPE_CLASS_NUMBER);
      else
        editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    } else if (lastLive instanceof Integer) editText.setInputType(InputType.TYPE_CLASS_NUMBER);
    else editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);

    textView.setVisibility(View.GONE);
    if (editText.getParent() != null) {
      ((LinearLayout) editText.getParent()).findViewById(tv_id).setVisibility(View.VISIBLE);
      ((LinearLayout) editText.getParent()).removeView(editText);
    }

    elementFrame.addView(editText);
    editText.setOnEditorActionListener(this);
    editText.setText(lastEdit.toString());
    editText.requestFocus();
    editText.setSelection(0, editText.getText().length());
    Utils.imm.showSoftInput(editText, InputMethodManager.SHOW_FORCED);
  }
 public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
   if (spTipo.getSelectedItem().equals("Celular")) {
     etContato.setInputType(InputType.TYPE_CLASS_PHONE);
   } else if (spTipo.getSelectedItem().equals("E-mail")) {
     etContato.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
   }
 }
 @Override
 public Dialog onCreateDialog(Bundle savedInstanceState) {
   AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity());
   LayoutInflater inflater = getActivity().getLayoutInflater();
   View view = inflater.inflate(R.layout.dialog_add_availability, null);
   mStartDaySpinner = (Spinner) view.findViewById(R.id.start_day_of_week_spinner);
   ArrayAdapter<CharSequence> startAdapter =
       ArrayAdapter.createFromResource(
           getActivity(), R.array.days_of_week, android.R.layout.simple_spinner_item);
   startAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
   mStartDaySpinner.setAdapter(startAdapter);
   mEndDaySpinner = (Spinner) view.findViewById(R.id.end_day_of_week_spinner);
   ArrayAdapter<CharSequence> endAdapter =
       ArrayAdapter.createFromResource(
           getActivity(), R.array.days_of_week, android.R.layout.simple_spinner_item);
   endAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
   mEndDaySpinner.setAdapter(endAdapter);
   mStartTimeEdit = (EditText) view.findViewById(R.id.edit_start_time);
   mStartTimeEdit.setInputType(InputType.TYPE_NULL);
   mStartTimeEdit.setOnFocusChangeListener(mTimeFocusListener);
   mStartTimeEdit.setOnClickListener(mTimeClickListener);
   mEndTimeEdit = (EditText) view.findViewById(R.id.edit_end_time);
   mEndTimeEdit.setInputType(InputType.TYPE_NULL);
   mEndTimeEdit.setOnFocusChangeListener(mTimeFocusListener);
   mEndTimeEdit.setOnClickListener(mTimeClickListener);
   builder.setView(view);
   builder.setPositiveButton(
       R.string.dialog_add,
       new DialogInterface.OnClickListener() {
         @Override
         public void onClick(DialogInterface dialogInterface, int i) {
           if (mStartHour == null || mEndHour == null) {
             Toast.makeText(getActivity(), "Times not set!", Toast.LENGTH_SHORT).show();
             return;
           }
           Availability avail = new Availability();
           avail.startHour = mStartHour;
           avail.startMinute = mStartMinute;
           avail.endHour = mEndHour;
           avail.endMinute = mEndMinute;
           avail.startDay = mStartDaySpinner.getSelectedItemPosition();
           avail.endDay = mEndDaySpinner.getSelectedItemPosition();
           if (mListener != null) {
             mListener.onAvailabilityAdded(avail);
           }
         }
       });
   builder.setNegativeButton(
       R.string.dialog_cancel,
       new DialogInterface.OnClickListener() {
         @Override
         public void onClick(DialogInterface dialogInterface, int i) {
           AddAvailabilityDialog.this.getDialog().cancel();
         }
       });
   builder.setTitle(R.string.add_availability);
   return builder.create();
 }
  @Override
  protected void initViews(Bundle savedInstanceState) {
    setContentView(R.layout.activity_add_memo);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
      setTranslucentStatus(true);
    }
    mTintManager = new SystemBarTintManager(this);
    mTintManager.setStatusBarTintEnabled(true);
    mTintManager.setNavigationBarTintEnabled(true);
    mTintManager.setStatusBarTintResource(R.color.colorPrimary);

    selectDate = (EditText) findViewById(R.id.add_memo_date_picker_edit_text);
    selectDate.setInputType(InputType.TYPE_NULL);
    selectTime = (EditText) findViewById(R.id.add_memo_time_picker_edit_text);
    selectTime.setInputType(InputType.TYPE_NULL);
    memoEditText = (EditText) findViewById(R.id.add_memo_memo_edit_text);
    addButton = (Button) findViewById(R.id.add_memo_ok_button);
    refreshButton = (Button) findViewById(R.id.add_memo_refresh_button);
    listView = (ListView) findViewById(R.id.add_memo_list_view);
    repeat = (Spinner) findViewById(R.id.add_memo_repeat_spinner);

    selectDate.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            showSelectDateDialog(event);
            return false;
          }
        });

    selectTime.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            showSelectTimeDialog(event);
            return false;
          }
        });

    addButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            save();
          }
        });

    refreshButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            refresh();
          }
        });
  }
 private void initializeIme() {
   if (TextSecurePreferences.isEnterImeKeyEnabled(this)) {
     composeText.setInputType(
         composeText.getInputType() & (~InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE));
   } else {
     composeText.setInputType(
         composeText.getInputType() | (InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE));
   }
 }
 public static void disableSuggestions(EditText edit) {
   if (isLevel5) {
     edit.setInputType(
         edit.getInputType()
             | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
             | InputType.TYPE_TEXT_VARIATION_FILTER);
   } else {
     edit.setInputType(edit.getInputType() | InputType.TYPE_TEXT_VARIATION_FILTER);
   }
 }
  private void build_scroll_view(RaceDetails rd) {
    // Erase the content of the scroll view
    LinearLayout pilot_list = (LinearLayout) findViewById(R.id.pilot_list);
    pilot_list.removeAllViews();

    for (int index = 0; index < main_application.nb_of_pilots; index++) {
      if (rd.isTherePilot(index)) {
        LinearLayout new_horiz_layout = new LinearLayout(this);
        new_horiz_layout.setLayoutParams(
            new LinearLayout.LayoutParams(
                LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, 1.0f));
        new_horiz_layout.setOrientation(LinearLayout.HORIZONTAL);

        EditText new_text_view = new EditText(this);
        new_text_view.setText(main_application.getPilotName(index));
        new_text_view.setLayoutParams(
            new LinearLayout.LayoutParams(
                LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, 1.0f));
        new_text_view.setInputType(
            InputType.TYPE_NULL); // The text cannot be edited with the soft keypad
        new_text_view.setFocusable(false); // The text cannot be edited
        new_horiz_layout.addView(new_text_view);

        ImageView new_image_view = new ImageView(this);
        new_image_view.setImageResource(R.drawable.kart);
        new_horiz_layout.addView(new_image_view);

        EditText new_text_view_car_id = new EditText(this);
        if (rd.pilot_to_car_mapping.matching.indexOfKey(index) >= 0) {
          new_text_view_car_id.setText(
              Integer.toString(rd.pilot_to_car_mapping.matching.get(index)));
        } else {
          // This pilot wasn't in the maximum matching, he therefore is assigned to a car number he
          // already got
          // Signal that by writing the car number red.
          new_text_view_car_id.setText(
              Integer.toString(rd.pilot_to_car_mapping.unmatched.get(index)));
          new_text_view_car_id.setTextColor(getResources().getColor(R.color.dark_red));
        }
        new_text_view_car_id.setLayoutParams(
            new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
        new_text_view_car_id.setInputType(
            InputType.TYPE_NULL); // The text cannot be edited with the soft keypad
        new_text_view_car_id.setFocusable(false); // The text cannot be edited
        new_text_view_car_id.setEms(3);
        new_text_view_car_id.setGravity(Gravity.RIGHT);
        new_horiz_layout.addView(new_text_view_car_id);

        pilot_list.addView(new_horiz_layout);
      }
    }

    // Redraw the scroll view
    pilot_list.invalidate();
  }
  @Override
  public void initData() { // 必须调用
    super.initData();

    intent = getIntent();
    packageName = intent.getStringExtra(INTENT_PACKAGE_NAME);

    intentType = intent.getIntExtra(INTENT_TYPE, 0);
    if (StringUtil.isNotEmpty(intent.getStringExtra(INTENT_KEY), true)) {
      tvEditTextInfoTitle.setText(StringUtil.getCurrentString());
    }
    etEditTextInfo.setSingleLine(intentType != TYPE_NOTE);

    switch (intentType) {
      case TYPE_NICK:
        MaxLen = 20;
        break;
      case TYPE_PHONE:
        etEditTextInfo.setInputType(InputType.TYPE_CLASS_PHONE);
        MaxLen = 11;
        break;
      case TYPE_EMAIL:
        etEditTextInfo.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
        MaxLen = 60;
        break;
      case TYPE_WEBSITE:
        etEditTextInfo.setInputType(InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT);
        MaxLen = 60;
        break;
      case TYPE_MAILADDRESS:
        MaxLen = 60;
        break;
      case TYPE_PROFESSION:
        tvEditTextInfoRemind.setText("所属行业");
        MaxLen = 15;
      case TYPE_NOTE:
        MaxLen = 100;
        break;
      default:
        MaxLen = 30;
        break;
    }
    etEditTextInfo.setMaxEms(MaxLen);
    tvEditTextInfoRemind.setText("限" + MaxLen / 2 + "个字(或" + MaxLen + "个字符)");

    if (intentType == TYPE_MAILADDRESS || intentType == TYPE_USUALADDRESS) {
      tvEditTextInfoPlace.setVisibility(View.VISIBLE);
      CommonUtil.toActivity(
          context,
          PlacePickerWindow.createIntent(context, packageName, 2),
          REQUEST_TO_PLACE_PICKER,
          false);
    }
  }
 public void setChangeButton() {
   if (canSee) {
     etPassWord.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
     changeButton.setImageDrawable(
         ContextCompat.getDrawable(getBaseContext(), R.drawable.ic_password_visibility));
   } else {
     etPassWord.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD | InputType.TYPE_CLASS_TEXT);
     changeButton.setImageDrawable(
         ContextCompat.getDrawable(getBaseContext(), R.drawable.ic_password_visibility_off));
   }
 }
Example #14
0
 private void toggle_eye() {
   if (img_eye.getDrawable().getLevel() == 0) {
     img_eye.setImageLevel(1);
     edt_password.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
     edt_password.setSelection(edt_password.length());
   } else {
     img_eye.setImageLevel(0);
     edt_password.setInputType(129);
     edt_password.setSelection(edt_password.length());
   }
 }
        @Override
        public void onClick(View v) {
          mPasswordVisible = !mPasswordVisible;

          if (mPasswordVisible) {
            mPasswordView.setInputType(
                InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
          } else {
            mPasswordView.setInputType(
                InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
          }
        }
Example #16
0
  public DateTimeInput(EditText parent, Mode mode) {
    mParent = parent;
    mMode = mode;

    if (mode == Mode.DATE) {
      mParent.setInputType(InputType.TYPE_CLASS_DATETIME | InputType.TYPE_DATETIME_VARIATION_DATE);
      mFormat = android.text.format.DateFormat.getDateFormat(mParent.getContext());
    } else {
      mParent.setInputType(InputType.TYPE_CLASS_DATETIME | InputType.TYPE_DATETIME_VARIATION_TIME);
      mFormat = android.text.format.DateFormat.getTimeFormat(mParent.getContext());
    }
  }
 @Override
 public void onClick(View view) {
   ImageView imageView = (ImageView) view;
   mTextVisible = !mTextVisible;
   if (mTextVisible) {
     imageView.setImageResource(R.drawable.ic_visibility_off_black_24dp);
     mField.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
   } else {
     imageView.setImageResource(R.drawable.ic_visibility_black_24dp);
     mField.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
   }
 }
  @Override
  protected View onCreateDialogView() {
    LinearLayout layout = new LinearLayout(getContext());
    LinearLayout.LayoutParams params;

    layout.setOrientation(LinearLayout.VERTICAL);
    layout.setPadding(20, 20, 20, 20);
    layout.setBackgroundColor(Color.BLACK);

    TextView textUsername = new TextView(getContext());
    textUsername.setText("Admin");
    textUsername.setTextColor(0xFFFFFFFF);
    textUsername.setPadding(0, 8, 0, 3);

    TextView theOldPassword = new TextView(getContext());
    theOldPassword.setText("Old password:"******"New password:"******"Confirm new password");
    theCPassword.setTextColor(0xFFFFFFFF);

    cPassword = new EditText(getContext());
    cPassword.setSingleLine(true);
    cPassword.setInputType(131072); // TYPE_TEXT_FLAG_MULTI_LINE
    cPassword.setSelectAllOnFocus(true);

    layout.addView(textUsername);
    layout.addView(theOldPassword);
    layout.addView(oldPassword);
    layout.addView(thePassword);
    layout.addView(password);
    layout.addView(theCPassword);
    layout.addView(cPassword);

    return layout;
  }
Example #19
0
  void changePassword() {
    AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
    LinearLayout ll = new LinearLayout(this);
    ll.setOrientation(LinearLayout.VERTICAL);

    final EditText editText_old = new EditText(this);
    final EditText editText_new1 = new EditText(this);
    final EditText editText_new2 = new EditText(this);
    alertDialog.setTitle("Enter New Password");
    alertDialog.setView(ll);
    editText_old.setHint("< Old Password >");
    editText_old.setSingleLine();
    editText_new1.setHint("< New Password >");
    editText_new2.setHint("< Confirm Password >");
    editText_new1.setSingleLine();
    editText_new2.setSingleLine();
    editText_old.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
    editText_new1.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
    editText_new2.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
    ll.addView(editText_old);
    ll.addView(editText_new1);
    ll.addView(editText_new2);

    alertDialog.setNegativeButton("No Change", null);
    final Activity activity = this;
    alertDialog.setPositiveButton(
        "Change",
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            if (!editText_new1.getText().toString().equals(editText_new2.getText().toString()))
              Toast.makeText(activity, "Password Didn't Match Try Again!", Toast.LENGTH_SHORT)
                  .show();
            else
              AppToServer.changeMyDetails(
                  activity,
                  null,
                  editText_old.getText().toString(),
                  editText_new1.getText().toString(),
                  new Callable<Void>() {
                    @Override
                    public Void call() throws Exception {
                      Toast.makeText(activity, "Password Changed", Toast.LENGTH_SHORT).show();
                      return null;
                    }
                  });
          }
        });
    alertDialog.show();
  }
 @Override
 public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) {
   passwordView.setInputType(
       InputType.TYPE_CLASS_TEXT
           | (isChecked
               ? InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
               : InputType.TYPE_TEXT_VARIATION_PASSWORD));
   if (passwordRepeatView instanceof EditText)
     passwordRepeatView.setInputType(
         InputType.TYPE_CLASS_TEXT
             | (isChecked
                 ? InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
                 : InputType.TYPE_TEXT_VARIATION_PASSWORD));
 }
Example #21
0
  public void initializeViews() {
    teamName = (EditText) findViewById(R.id.team_name);
    entryNum1 = (EditText) findViewById(R.id.EntryNum1);
    entryNum2 = (EditText) findViewById(R.id.EntryNum2);
    entryNum3 = (EditText) findViewById(R.id.EntryNum3);
    name1 = (EditText) findViewById(R.id.Name1);
    name2 = (EditText) findViewById(R.id.Name2);
    name3 = (EditText) findViewById(R.id.Name3);
    cacv = new CustomAutoCompleteView(RegisterActivity.this);
    cacvName = new CustomAutoCompleteView(RegisterActivity.this);

    enAdap =
        new ArrayAdapter<String>(
            RegisterActivity.this, android.R.layout.simple_dropdown_item_1line, enNums);
    nameAdap =
        new ArrayAdapter<String>(
            RegisterActivity.this, android.R.layout.simple_dropdown_item_1line, stdNames);
    cacv.setThreshold(1);
    cacv.setAdapter(enAdap);
    enAdap.notifyDataSetChanged();
    cacvName.setThreshold(1);
    cacvName.setAdapter(nameAdap);
    nameAdap.notifyDataSetChanged();

    teamName.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS);
    entryNum1.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS);
    entryNum2.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS);
    entryNum3.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS);
    // name1.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS);
    // name2.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS);
    // name3.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS);
    teamName.addTextChangedListener(new CustomTextWatcher(teamName, 0));
    entryNum1.addTextChangedListener(new CustomTextWatcher(entryNum1, 1, cacv, enAdap));

    entryNum2.addTextChangedListener(new CustomTextWatcher(entryNum2, 1, cacv, enAdap));
    entryNum3.addTextChangedListener(new CustomTextWatcher(entryNum3, 1, cacv, enAdap));
    name1.addTextChangedListener(new CustomTextWatcher(name1, 2, cacvName, nameAdap));
    name2.addTextChangedListener(new CustomTextWatcher(name2, 2, cacvName, nameAdap));
    name3.addTextChangedListener(new CustomTextWatcher(name3, 2, cacvName, nameAdap));
    submit = (Button) findViewById(R.id.submitNames);
    submit.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            onSubmitClick();
          }
        });
  }
Example #22
0
  private void promptScoutName() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Enter your name");
    builder.setCancelable(false);

    // Set up the input
    final EditText input = new EditText(this);
    input.setInputType(InputType.TYPE_CLASS_TEXT);
    builder.setView(input);

    // Affirmative response
    builder.setPositiveButton(
        "OK",
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            scout = input.getText().toString().toUpperCase();
            if (scout.equals("")) promptScoutName();
            else {
              getPreferences(MODE_PRIVATE)
                  .edit()
                  .putString(getString(R.string.preference_scout), scout)
                  .apply();
              updateNameField();
            }
          }
        });
    builder.show();
  }
  @Override
  public void OnAlimentClick(Aliment choix) {

    // AlertDialog
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    String message =
        getResources().getString(R.string.enter_quantity_label) + choix.getTypeMesure();
    builder.setMessage(message);
    EditText input = new EditText(this);
    input.setInputType(InputType.TYPE_CLASS_NUMBER);
    builder.setView(input);
    builder.setPositiveButton(
        "OK",
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            quantity = Integer.parseInt(input.getText().toString());

            DetailsRepas detailsRepas =
                (DetailsRepas) getFragmentManager().findFragmentById(R.id.DetailsRepas);
            detailsRepas.AjouterAliment(choix, quantity);
          }
        });
    builder.show();
  }
  public void onClick(View view) {
    final Context context = view.getContext();

    AlertDialog.Builder dialog = new AlertDialog.Builder(context);
    final EditText input = new EditText(context);
    input.setText(String.valueOf(degrees));
    input.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
    input.setSelectAllOnFocus(true);
    dialog.setView(input);
    dialog.setOnCancelListener((OnCancelListener) context);
    dialog.setPositiveButton(
        context.getString(R.string.ok),
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            try {
              degrees = Double.parseDouble(input.getText().toString());
            } catch (NumberFormatException exception) {
              Toast.makeText(context, R.string.error_no_number_entered, Toast.LENGTH_SHORT).show();
            }
            dialog.cancel();
          }
        });
    dialog.setNeutralButton(
        context.getString(R.string.cancel_button),
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
          }
        });

    AlertDialog finishedDialog = dialog.create();
    finishedDialog.setOnShowListener(Utils.getBrickDialogOnClickListener(context, input));

    finishedDialog.show();
  }
Example #25
0
  public void quantity() {
    AlertDialog.Builder alert = new AlertDialog.Builder(this);
    alert.setTitle("");
    alert.setMessage("Enter quantity: ");

    // Set an EditText view to get user input
    final EditText input = new EditText(this);
    input.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL);
    alert.setView(input);

    alert.setPositiveButton(
        "Ok",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {
            Editable value = input.getText();
            quantity = value.toString();
            // result.add(value.toString()); TODO
          }
        });
    alert.setNegativeButton(
        "Cancel",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {
            dialog.cancel();
          }
        });

    alert.show();
  }
Example #26
0
 @Override
 @NonNull
 protected LinearLayout makeCenterView() {
   LinearLayout rootLayout = new LinearLayout(activity);
   rootLayout.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
   rootLayout.setOrientation(LinearLayout.VERTICAL);
   blackColorView = new ColorPanelView(activity);
   //noinspection ResourceType
   blackColorView.setId(BLACK_ID);
   blackColorView.setLayoutParams(
       new LinearLayout.LayoutParams(MATCH_PARENT, ConvertUtils.toPx(activity, 30)));
   blackColorView.setPointerDrawable(
       CompatUtils.getDrawable(activity, R.drawable.color_picker_cursor_bottom));
   blackColorView.setLockPointerInBounds(false);
   blackColorView.setOnColorChangedListener(
       new ColorPanelView.OnColorChangedListener() {
         @Override
         public void onColorChanged(ColorPanelView view, int color) {
           updateCurrentColor(color);
         }
       });
   rootLayout.addView(blackColorView);
   multiColorView = new ColorPanelView(activity);
   //noinspection ResourceType
   multiColorView.setId(MULTI_ID);
   multiColorView.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, 0, 1.0f));
   multiColorView.setPointerDrawable(
       CompatUtils.getDrawable(activity, R.drawable.color_picker_cursor_top));
   multiColorView.setLockPointerInBounds(true);
   multiColorView.setOnColorChangedListener(
       new ColorPanelView.OnColorChangedListener() {
         @Override
         public void onColorChanged(ColorPanelView view, int color) {
           updateCurrentColor(color);
         }
       });
   rootLayout.addView(multiColorView);
   LinearLayout previewLayout = new LinearLayout(activity);
   previewLayout.setOrientation(LinearLayout.HORIZONTAL);
   previewLayout.setGravity(Gravity.CENTER);
   previewLayout.setLayoutParams(
       new LinearLayout.LayoutParams(MATCH_PARENT, ConvertUtils.toPx(activity, 30)));
   hexValView = new EditText(activity);
   hexValView.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
   hexValView.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
   hexValView.setImeOptions(EditorInfo.IME_ACTION_DONE);
   hexValView.setGravity(Gravity.CENTER);
   hexValView.setBackgroundColor(initColor);
   hexValView.setTextColor(Color.BLACK);
   hexValView.setShadowLayer(3, 0, 2, Color.WHITE); // 设置阴影,以便背景色为黑色系列时仍然看得见
   hexValView.setMinEms(6);
   hexValView.setMaxEms(8);
   hexValView.setPadding(0, 0, 0, 0);
   hexValView.setSingleLine(true);
   hexValView.setOnEditorActionListener(this);
   hexValDefaultColor = hexValView.getTextColors();
   previewLayout.addView(hexValView);
   rootLayout.addView(previewLayout);
   return rootLayout;
 }
  public void plusYear(View view) {

    AlertDialog.Builder b = new AlertDialog.Builder(this);
    b.setTitle(R.string.year_addyear);
    final EditText input = new EditText(this);
    input.setSingleLine(true);
    input.setInputType(InputType.TYPE_CLASS_NUMBER);
    input.setHint(R.string.year_name_hint);
    b.setView(input);
    b.setPositiveButton(
        android.R.string.ok,
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int whichButton) {
            if (input.getText().length() == 0) return;

            String year = Integer.toString(Math.abs(Integer.valueOf(input.getText().toString())));
            YearTable.add(year, db);

            populateList();
            aa.notifyDataSetChanged();
          }
        });
    b.setNegativeButton(android.R.string.cancel, null);
    b.create().show();
  }
  @SuppressLint("InflateParams")
  private void quickEdit(
      final String previousValue, final OnValueEdited callback, boolean password) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    View view = getLayoutInflater().inflate(R.layout.quickedit, null);
    final EditText editor = (EditText) view.findViewById(R.id.editor);
    OnClickListener mClickListener =
        new OnClickListener() {

          @Override
          public void onClick(DialogInterface dialog, int which) {
            String value = editor.getText().toString();
            if (!previousValue.equals(value) && value.trim().length() > 0) {
              callback.onValueEdited(value);
            }
          }
        };
    if (password) {
      editor.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
      editor.setHint(R.string.password);
      builder.setPositiveButton(R.string.accept, mClickListener);
    } else {
      builder.setPositiveButton(R.string.edit, mClickListener);
    }
    editor.requestFocus();
    editor.setText(previousValue);
    builder.setView(view);
    builder.setNegativeButton(R.string.cancel, null);
    builder.create().show();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO 自動生成されたメソッド・スタブ
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_list);

    // コンポーネントの関連付け
    layout = (RelativeLayout) this.findViewById(R.id.main_layout);
    listView = (ListView) this.findViewById(R.id.listView1);

    // リストビューのスクロールキャッシュ無効(色がおかしくなるので)
    listView.setScrollingCacheEnabled(false);

    // リスナーの設定
    listView.setOnItemClickListener(this);

    // アダプター作成
    adapter = new TaskArrayAdapter(this, setItem());

    // リストビューに項目データ(アダプタ)をセット
    listView.setAdapter(adapter);

    // 何もタスクが無いのなら新規作成のダイアログが開く
    int i = 0;
    editText = new EditText(this);
    editText.setInputType(InputType.TYPE_CLASS_TEXT);
    for (int j = 0; j < 10; j++) {
      i += adapter.getList().get(j).getTask().length();
      if (j == 9 && i == 0) {
        showYesDialog(
            ListActivity.this, "何かタスクを作ってみよう", "あなたがよく行う習慣を登録して時間を計りましょう", editText, this, 1);
        break;
      }
    }
  }
  public void addTea(View view) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);

    final EditText input = new EditText(this);
    input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_WORDS);

    builder
        .setView(input)
        .setMessage(R.string.enter_tea)
        .setPositiveButton(
            R.string.create_tea,
            new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialogInterface, int i) {
                String addedTea = input.getText().toString();
                teas.add(addedTea);
                updateTeas();
              }
            })
        .setNegativeButton(
            R.string.cancel_tea,
            new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialogInterface, int i) {}
            });

    builder.show();
  }