예제 #1
0
    @Override
    public void run() {
      if (!SettingUtility.getEnableAutoRefresh()) {
        return;
      }

      if (!Utility.isTaskStopped(dbTask)) {
        return;
      }

      if (!allowRefresh()) {
        return;
      }

      if (!Utility.isWifi(getActivity())) {
        return;
      }

      if (isListViewFling()
          || !isVisible()
          || ((MainTimeLineActivity) getActivity()).getSlidingMenu().isMenuShowing()) {
        return;
      }

      Bundle bundle = new Bundle();
      bundle.putBoolean(BundleArgsConstants.SCROLL_TO_TOP, false);
      bundle.putBoolean(BundleArgsConstants.AUTO_REFRESH, true);
      getLoaderManager().restartLoader(NEW_MSG_LOADER_ID, bundle, msgAsyncTaskLoaderCallback);
    }
예제 #2
0
 private void startDownloadingOtherPicturesOnWifiNetworkEnvironment() {
   if (backgroundWifiDownloadPicThread == null
       && Utility.isWifi(getActivity())
       && SettingUtility.getEnableBigPic()
       && SettingUtility.isWifiAutoDownloadPic()) {
     final int position = getListView().getFirstVisiblePosition();
     int listVewOrientation = ((VelocityListView) getListView()).getTowardsOrientation();
     WifiAutoDownloadPictureRunnable runnable =
         new WifiAutoDownloadPictureRunnable(getList(), position, listVewOrientation);
     backgroundWifiDownloadPicThread = new Thread(runnable);
     backgroundWifiDownloadPicThread.start();
     AppLogger.i(
         "WifiAutoDownloadPictureRunnable startDownloadingOtherPicturesOnWifiNetworkEnvironment");
   }
 }
예제 #3
0
  @Override
  public void run() {

    Thread.currentThread().setPriority(Thread.MIN_PRIORITY);

    AppLogger.d("clear cache task start");

    if (Utility.isWifi(GlobalContext.getInstance())) {

      List<String> pathList = FileManager.getCachePath();

      for (String path : pathList) {
        if (!TextUtils.isEmpty(path)) handleDir(new File(path));
      }

      AppLogger.d("clear cache task stop");
    } else {
      AppLogger.d("this device dont have wifi network, clear cache task stop");
    }
  }
예제 #4
0
  @Override
  protected String doInBackground(Void... arg) {
    if (isCancelled()) {
      return null;
    }

    if (Utility.isWifi(GlobalContext.getInstance())) {
      boolean result =
          TaskCache.waitForPictureDownload(
              msg.getOriginal_pic(), downloadListener, oriPath, FileLocationMethod.picture_large);
      return result ? oriPath : null;
    } else {
      boolean result =
          TaskCache.waitForPictureDownload(
              msg.getBmiddle_pic(),
              downloadListener,
              middlePath,
              FileLocationMethod.picture_bmiddle);
      return result ? middlePath : null;
    }
  }