Ejemplo n.º 1
0
  private void checkScanFinish() {

    mAdapter.notifyDataSetChanged();

    if (mIsProcessScanFinish && mIsSysCacheScanFinish && mIsOverallScanFinish) {
      mIsScanning = false;

      JunkGroup cacheGroup = mJunkGroups.get(JunkGroup.GROUP_CACHE);
      ArrayList<JunkInfo> children = cacheGroup.mChildren;
      cacheGroup.mChildren = new ArrayList<>();
      for (JunkInfo info : children) {
        cacheGroup.mChildren.add(info);
        if (info.mChildren != null) {
          cacheGroup.mChildren.addAll(info.mChildren);
        }
      }
      children = null;

      long size = getTotalSize();
      String totalSize = CleanUtil.formatShortFileSize(this, size);
      mHeaderView.mSize.setText(totalSize);
      mHeaderView.mProgress.setText("共发现:" + totalSize);
      mHeaderView.mProgress.setGravity(Gravity.CENTER);

      mCleanButton.setEnabled(true);
    }
  }
Ejemplo n.º 2
0
  private void checkCleanFinish() {
    if (mIsProcessCleanFinish && mIsSysCacheCleanFinish && mIsOverallCleanFinish) {
      mHeaderView.mProgress.setText("清理完成");
      mHeaderView.mSize.setText(CleanUtil.formatShortFileSize(this, 0L));

      for (JunkGroup group : mJunkGroups.values()) {
        group.mSize = 0L;
        group.mChildren = null;
      }

      mAdapter.notifyDataSetChanged();
    }
  }
Ejemplo n.º 3
0
  private void resetState() {
    mIsScanning = false;

    mIsSysCacheScanFinish = false;
    mIsSysCacheCleanFinish = false;

    mIsProcessScanFinish = false;
    mIsProcessCleanFinish = false;

    mJunkGroups = new HashMap<>();

    mCleanButton.setEnabled(false);

    JunkGroup cacheGroup = new JunkGroup();
    cacheGroup.mName = getString(R.string.cache_clean);
    cacheGroup.mChildren = new ArrayList<>();
    mJunkGroups.put(JunkGroup.GROUP_CACHE, cacheGroup);

    JunkGroup processGroup = new JunkGroup();
    processGroup.mName = getString(R.string.process_clean);
    processGroup.mChildren = new ArrayList<>();
    mJunkGroups.put(JunkGroup.GROUP_PROCESS, processGroup);

    JunkGroup apkGroup = new JunkGroup();
    apkGroup.mName = getString(R.string.apk_clean);
    apkGroup.mChildren = new ArrayList<>();
    mJunkGroups.put(JunkGroup.GROUP_APK, apkGroup);

    JunkGroup tmpGroup = new JunkGroup();
    tmpGroup.mName = getString(R.string.tmp_clean);
    tmpGroup.mChildren = new ArrayList<>();
    mJunkGroups.put(JunkGroup.GROUP_TMP, tmpGroup);

    JunkGroup logGroup = new JunkGroup();
    logGroup.mName = getString(R.string.log_clean);
    logGroup.mChildren = new ArrayList<>();
    mJunkGroups.put(JunkGroup.GROUP_LOG, logGroup);
  }