/** 设置一个将被截图分享的View */
 public void setViewToShare(View viewToShare) {
   try {
     Bitmap bm = captureView(viewToShare, viewToShare.getWidth(), viewToShare.getHeight());
     reqMap.put("viewToShare", bm);
   } catch (Throwable e) {
     e.printStackTrace();
   }
 }
 private void hideSoftInput() {
   try {
     InputMethodManager imm =
         (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
     imm.hideSoftInputFromWindow(etContent.getWindowToken(), 0);
   } catch (Throwable t) {
     t.printStackTrace();
   }
 }
  public void onError(Platform platform, int action, Throwable t) {
    t.printStackTrace();

    Message msg = new Message();
    msg.what = MSG_ACTION_CCALLBACK;
    msg.arg1 = 2;
    msg.arg2 = action;
    msg.obj = t;
    UIHandler.sendMessage(msg, this);

    // 分享失败的统计
    ShareSDK.logDemoEvent(4, platform);
  }
 private void genBackground() {
   background = new ColorDrawable(DIM_COLOR);
   if (tmpBgView != null) {
     try {
       Bitmap bgBm = captureView(tmpBgView, tmpBgView.getWidth(), tmpBgView.getHeight());
       bgBm = blur(bgBm, 20, 8);
       BitmapDrawable blurBm = new BitmapDrawable(activity.getResources(), bgBm);
       background = new LayerDrawable(new Drawable[] {blurBm, background});
     } catch (Throwable e) {
       e.printStackTrace();
     }
   }
 }
  private void showThumb() {
    String imagePath = (String) reqData.get("imagePath");
    Bitmap viewToShare = (Bitmap) reqData.get("viewToShare");
    shareImage = false;
    if (!TextUtils.isEmpty(imagePath) && new File(imagePath).exists()) {
      try {
        shareImage = true;
        image = getBitmap(imagePath);
      } catch (Throwable t) {
        System.gc();
        try {
          image = getBitmap(imagePath, 2);
        } catch (Throwable t1) {
          t1.printStackTrace();
          shareImage = false;
        }
      }

      if (shareImage) {
        rlThumb.setVisibility(View.VISIBLE);
        ivPin.setVisibility(View.VISIBLE);
        ivImage.setImageBitmap(image);
      }
    } else if (viewToShare != null && !viewToShare.isRecycled()) {
      shareImage = true;
      image = viewToShare;

      if (shareImage) {
        rlThumb.setVisibility(View.VISIBLE);
        ivPin.setVisibility(View.VISIBLE);
        ivImage.setImageBitmap(image);
      }
    } else if (reqData.containsKey("imageUrl")) {
      new Thread() {
        public void run() {
          String imageUrl = String.valueOf(reqData.get("imageUrl"));
          try {
            shareImage = true;
            image = getBitmap(activity, imageUrl);
          } catch (Throwable t) {
            t.printStackTrace();
            shareImage = false;
            image = null;
          }

          if (shareImage) {
            UIHandler.sendEmptyMessage(
                1,
                new Callback() {
                  public boolean handleMessage(Message msg) {
                    rlThumb.setVisibility(View.VISIBLE);
                    ivPin.setVisibility(View.VISIBLE);
                    ivImage.setImageBitmap(image);
                    return false;
                  }
                });
          }
        }
      }.start();
    }
  }