use of org.edx.mobile.user.DeleteAccountImageTask in project edx-app-android by edx.
the class EditUserProfileFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
viewHolder = new ViewHolder(view);
viewHolder.profileImageProgress.setVisibility(View.GONE);
viewHolder.username.setText(username);
viewHolder.username.setContentDescription(ResourceUtil.getFormattedString(getResources(), R.string.profile_username_description, "username", username));
final IconDrawable icon = new IconDrawable(getActivity(), FontAwesomeIcons.fa_camera).colorRes(getActivity(), R.color.disableable_button_text).sizeRes(getActivity(), R.dimen.fa_x_small).tint(// IconDrawable is tinted by default, but we don't want it to be tinted here
null);
TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(viewHolder.changePhoto, icon, null, null, null);
viewHolder.changePhoto.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final PopupMenu popup = new PopupMenu(getActivity(), v);
popup.getMenuInflater().inflate(R.menu.change_photo, popup.getMenu());
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
switch(item.getItemId()) {
case R.id.take_photo:
{
startActivityForResult(helper.createCaptureIntent(getActivity()), CAPTURE_PHOTO_REQUEST);
break;
}
case R.id.choose_photo:
{
final Intent galleryIntent = new Intent().setType("image/*").setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(galleryIntent, CHOOSE_PHOTO_REQUEST);
break;
}
case R.id.remove_photo:
{
final Task task = new DeleteAccountImageTask(getActivity(), username);
task.setProgressDialog(viewHolder.profileImageProgress);
executePhotoTask(task);
break;
}
}
return true;
}
});
popup.show();
}
});
setData(account, formDescription);
}
Aggregations