@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == 10086 && resultCode == RESULT_OK) { getPresenter().data.setIntro(data.getStringExtra("content")); intro.setText(data.getStringExtra("content")); } }
@Override public void setData(Account data) { super.setData(data); Picasso.with(this).load(data.getAvatar()).transform(new CircleTransform()).into(avatar); name.setText(data.getName()); if (data.getGender() == 0) male.setChecked(true); else female.setChecked(true); address.setText(data.getAddress()); sign.setText(data.getSign()); intro.setText(data.getIntro()); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_user_detail_modify); ButterKnife.bind(this); back.setOnClickListener(v -> finish()); done.setOnClickListener(v -> getPresenter().submit()); avatar.setOnClickListener(v -> showSelectorDialog()); sign.addTextChangedListener( new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) {} @Override public void onTextChanged(CharSequence s, int start, int before, int count) {} @Override public void afterTextChanged(Editable s) { getPresenter().data.setSign(s.toString()); } }); name.addTextChangedListener( new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) {} @Override public void onTextChanged(CharSequence s, int start, int before, int count) {} @Override public void afterTextChanged(Editable s) { getPresenter().data.setName(s.toString()); } }); genderSelect.setOnCheckedChangeListener( (group, checkedId) -> getPresenter().data.setGender(checkedId == R.id.male ? 0 : 1)); viewAddress.setOnClickListener( v -> showCityDialog(LocationModel.getInstance().getCurLocation().regionCode)); viewIntro.setOnClickListener( v -> { Intent i = new Intent(this, IntroEditActivity.class); i.putExtra("content", getPresenter().data.getIntro()); startActivityForResult(i, 10086); }); }