예제 #1
0
 private void enableInput(boolean flag) {
   btnSave.setEnabled(flag);
   et_username.setEnabled(flag);
   et_email.setEnabled(flag);
   et_address.setEnabled(flag);
   et_password.setEnabled(flag);
 }
예제 #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_edit_profile);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    et_username = (TextView) findViewById(R.id.editUsername);

    et_email = (EditText) findViewById(R.id.editEmail);
    et_address = (EditText) findViewById(R.id.editAddress);
    et_password = (EditText) findViewById(R.id.editPassword);
    ib_avatar = (CircleImageView) findViewById(R.id.avatarEditProfile);
    ib_avatar.setImageDrawable(null);
    ib_avatar.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            showSelectImageDialog();
          }
        });
    client = new AsyncHttpClient();
    //        final ProgressGenerator progressGenerator = new ProgressGenerator(this);
    btnSave = (ActionProcessButton) findViewById(R.id.btnSave);
    btnSave.setMode(ActionProcessButton.Mode.ENDLESS);
    btnSave.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (checkingMissingInfo()) {
              Variables.refreshFlag = true;
              btnSave.setProgress(50);
              enableInput(false);
              if (avatarBitmap != null) {
                uploadImage(avatarBitmap);
              } else {
                saveChanges(originAvatarUrl);
              }
            }
          }
        });
    imageUploadClient = new AsyncHttpClient();
    imageUploadClient.addHeader("Authorization", "Client-ID 9806c7ef5d11150"); // TODO

    loadInfo();
    resetSaveButton();
    settingShowcase();
  }
예제 #3
0
 private void handleCrop(int resultCode, Intent result) {
   if (resultCode == RESULT_OK) {
     ib_avatar.setImageURI(Crop.getOutput(result));
     try {
       avatarBitmap =
           MediaStore.Images.Media.getBitmap(this.getContentResolver(), Crop.getOutput(result));
     } catch (IOException e) {
       e.printStackTrace();
     }
     btnSave.setProgress(0);
   } else if (resultCode == Crop.RESULT_ERROR) {
     Toast.makeText(this, Crop.getError(result).getMessage(), Toast.LENGTH_SHORT).show();
   }
 }