示例#1
0
  public UpdateCommentTask(Context context, String text, String statusId, LocalAccount account) {
    this.context = context;
    this.text = text;
    this.statusId = statusId;

    this.microBlog = GlobalVars.getMicroBlog(account);
  }
 public StatusSubscribeTask(StatusSubscribeActivity context, StatusSubscribeListAdapter adapter) {
   this.context = context;
   this.adapter = adapter;
   this.account = adapter.getAccount();
   this.paging = adapter.getPaging();
   microBlog = GlobalVars.getMicroBlog(account);
 }
示例#3
0
  @Override
  protected User doInBackground(Void... params) {
    if (image == null) {
      return null;
    }

    Weibo microBlog = GlobalVars.getMicroBlog(accountId);
    if (microBlog == null) {
      return null;
    }

    User user = null;
    try {

      if (image != null) {
        String fileExtension = FileUtil.getFileExtensionFromName(image.getName());
        int size = ImageQuality.Low.getSize();
        ImageQuality quality = sheJiaoMao.getImageUploadQuality();
        if (quality == ImageQuality.High || GlobalVars.NET_TYPE == NetType.WIFI) {
          size = ImageQuality.High.getSize();
        } else if (quality == ImageQuality.Middle || quality == ImageQuality.Low) {
          size = quality.getSize();
          if (Logger.isDebug()) Log.d(TAG, "prefix size: " + size);
          // 对低速网络进行压缩
          if (GlobalVars.NET_TYPE == NetType.MOBILE_GPRS
              || GlobalVars.NET_TYPE == NetType.MOBILE_EDGE) {
            size = ImageQuality.Low.getSize();
          }
        }
        String destName =
            ImageCache.getTempFolder()
                + File.separator
                + System.currentTimeMillis()
                + "."
                + fileExtension;
        File dest = new File(destName);
        boolean isSuccess = ImageUtil.scaleImageFile(image, dest, size);
        if (isSuccess) {
          image = dest;
        }
        user = microBlog.updateProfileImage(image);
      }
    } catch (LibException e) {
      if (Logger.isDebug()) Log.e(TAG, "Task", e);
      resultMsg = ResourceBook.getResultCodeValue(e.getErrorCode(), context);
    }

    return user;
  }
示例#4
0
  public ResetUnreadCountTask(Context context, LocalAccount account, UnreadType type) {
    this.context = context;
    this.type = type;

    microBlog = GlobalVars.getMicroBlog(account);
  }
示例#5
0
 public HotStatusesTask(HotStatusesActivity context, HotStatusesListAdapter adapter, int type) {
   this.context = context;
   this.adapter = adapter;
   this.type = type;
   microBlog = GlobalVars.getMicroBlog(adapter.getAccount());
 }