@Override
 protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
   super.onActivityResult(requestCode, resultCode, intent);
   if (resultCode == RESULT_CANCELED) {
     return;
   } else if (resultCode == RESULT_OK) {
     switch (requestCode) {
       case CODE_GALLERY_REQUEST:
         Uri galleryUri = intent.getData();
         cropRawPhoto(galleryUri);
         break;
       case CODE_CAMERA_REQUEST:
         cropRawPhoto(mHeadIconUri);
         break;
       case CODE_RESULT_REQUEST:
         if (mHeadIconUri != null) {
           Bitmap photo = null;
           try {
             photo = Media.getBitmap(getContentResolver(), mHeadIconUri);
           } catch (FileNotFoundException e) {
             e.printStackTrace();
           } catch (IOException e) {
             e.printStackTrace();
           }
           if (photo != null) {
             // 同时将图片上传到七牛服务器
             uploadImgFile(photo);
           }
         }
         break;
       default:
         break;
     }
   }
 }