Source:
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(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: { if (((EditUserProfileActivity) getActivity()).checkForPermissions()) { startActivityForResult(helper.createCaptureIntent(getActivity()), CAPTURE_PHOTO_REQUEST); } else { ((EditUserProfileActivity) getActivity()).requestPermissions(); } break; } case R.id.choose_photo: { final Intent galleryIntent = new Intent() .setType("image/*") .setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(galleryIntent, CHOOSE_PHOTO_REQUEST); } 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); }

Target:
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(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: { if (PermissionsUtil.checkPermissions(Manifest.permission.CAMERA, getActivity())) { onPermissionGranted(CAMERA_PERMISSION_REQUEST); } else { PermissionsUtil.requestPermissions(CAMERA_PERMISSION_REQUEST, new String[]{Manifest.permission.CAMERA}, EditUserProfileFragment.this); } break; } case R.id.choose_photo: { if (PermissionsUtil.checkPermissions(Manifest.permission.READ_EXTERNAL_STORAGE, getActivity())) { onPermissionGranted(READ_STORAGE_PERMISSION_REQUEST); } else { PermissionsUtil.requestPermissions(READ_STORAGE_PERMISSION_REQUEST, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, EditUserProfileFragment.this); } 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); }