@Override
 public void onReceive(Context context, Intent intent) {
   String action = intent.getAction();
   if (TextUtils.equals(action, Constants.ACTION_UPLOAD_SUCCESS)) {
     Bundle bundle = mViewLayer.obtainBundle();
     bundle.putBoolean(Constants.ACTION_SHOW_DIALOG, true);
     if (mViewLayer.isVisible()) {
       mViewLayer.hideProgressDialog();
     } else {
       mIsHideProgressDialog = true;
     }
     mViewLayer.startActivity(LoginActivity.class, bundle);
     mViewLayer.showToast(mViewLayer.getString(R.string.upload_success));
   } else if (TextUtils.equals(action, Constants.ACTION_UPLOAD_FAILURE)) {
     if (mViewLayer.isVisible()) {
       mViewLayer.hideProgressDialog();
     } else {
       mIsHideProgressDialog = true;
     }
     String errorMessage = intent.getStringExtra(Constants.UPLOAD_ERROR_MESSAGE);
     int errorCode = intent.getIntExtra(Constants.UPLOAD_ERROR_CODE, -1);
     TLog.d("上传失败" + errorCode + errorMessage);
     mViewLayer.showToast(mViewLayer.getString(R.string.upload_failure));
   } else {
     long totalSize = intent.getLongExtra(Constants.UPLOAD_TOTAL_SIZE, -1);
     long currentSize = intent.getLongExtra(Constants.UPLOAD_CURRENT_SIZE, -1);
     long speed = intent.getLongExtra(Constants.NETWORK_SPEED, -1);
     String netSpeed = Formatter.formatFileSize(mViewLayer, speed);
     int percent = (int) (Math.round(currentSize * 100) * 1.0f / totalSize);
     if (mViewLayer.isVisible()) {
       mViewLayer.uploadProgressBar(percent);
     }
   }
 }
 @Subscribe(threadMode = ThreadMode.MainThread)
 public void onReceive(UploadInfo info) {
   if (TextUtils.equals(info.action, Constants.ACTION_UPLOAD_SUCCESS)) {
     Bundle bundle = mViewLayer.obtainBundle();
     bundle.putBoolean(Constants.ACTION_SHOW_DIALOG, true);
     getHandler()
         .post(
             new Runnable() {
               @Override
               public void run() {
                 if (mViewLayer.isVisible()) {
                   mViewLayer.hideProgressDialog();
                 } else {
                   mIsHideProgressDialog = true;
                 }
               }
             });
     mViewLayer.startActivity(LoginActivity.class, bundle);
     mViewLayer.showToast(mViewLayer.getString(R.string.upload_success));
   } else if (TextUtils.equals(info.action, Constants.ACTION_UPLOAD_FAILURE)) {
     if (mViewLayer.isVisible()) {
       mViewLayer.hideProgressDialog();
     } else {
       mIsHideProgressDialog = true;
     }
     String errorMessage = info.errorMessage;
     int errorCode = info.errorCode;
     TLog.d("上传失败" + errorCode + errorMessage);
     mViewLayer.showToast(mViewLayer.getString(R.string.upload_failure));
   } else {
     long totalSize = info.totalSize;
     long currentSize = info.currentSize;
     long speed = info.speed;
     String netSpeed = Formatter.formatFileSize(mViewLayer, speed);
     int percent = (int) (Math.round(currentSize * 100) * 1.0f / totalSize);
     if (mViewLayer.isVisible()) {
       mViewLayer.uploadProgressBar(percent);
     }
   }
 }