@Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (resultCode == Activity.RESULT_OK) {
     if (requestCode == ADD_ATTACHMENT) {
       if (AwfulUtils.isMarshmallow()) {
         int permissionCheck =
             ContextCompat.checkSelfPermission(
                 getActivity(), Manifest.permission.READ_EXTERNAL_STORAGE);
         if (permissionCheck != PackageManager.PERMISSION_GRANTED) {
           this.attachmentData = data;
           requestPermissions(
               new String[] {Manifest.permission.READ_EXTERNAL_STORAGE},
               Constants.AWFUL_PERMISSION_READ_EXTERNAL_STORAGE);
         } else {
           addAttachment(data);
         }
       } else {
         addAttachment(data);
       }
     }
   }
 }
 @Override
 public void onRequestPermissionsResult(
     int requestCode, String[] permissions, int[] grantResults) {
   switch (requestCode) {
     case Constants.AWFUL_PERMISSION_READ_EXTERNAL_STORAGE:
       {
         // If request is cancelled, the result arrays are empty.
         if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
           addAttachment();
         } else {
           Toast.makeText(getActivity(), R.string.no_file_permission_attachment, Toast.LENGTH_LONG)
               .show();
         }
         break;
       }
     default:
       super.onRequestPermissionsResult(requestCode, permissions, grantResults);
   }
 }
 protected void addAttachment() {
   addAttachment(attachmentData);
   attachmentData = null;
 }