Beispiel #1
0
  public FileCache(Context context, Util util) {
    // Find the dir to save cached images
    if (android.os.Environment.getExternalStorageState()
        .equals(android.os.Environment.MEDIA_MOUNTED))
      cacheDir = new File(android.os.Environment.getExternalStorageDirectory(), "Obliquity");
    else cacheDir = context.getCacheDir();
    if (!cacheDir.exists()) cacheDir.mkdirs();

    mUtil = util;
    running = false;
    tempDirSize = 0;
    mContext = context;

    if ((mDirSize = mUtil.getLong(KEY, -99)) == -99)
      initDirSize(); // If Util has no dirSize calculated

    if (DEBUG) Log.d(TAG, "MAX CACHE SIZE : " + maxDirectorySize + " MB");

    setupDirectoryOverflow();

    if (DEBUG) Log.d(TAG, "FileCache mDirSize : " + mDirSize / 1024. / 1024. + "MB");
  }
Beispiel #2
0
 // Calculates dirSize in a thread.
 public void forceUpdateDirSizeThread() {
   initDirSize();
 }