fix strange miui 13 bug
This commit is contained in:
@@ -25,6 +25,7 @@ import b.h.g.m.FileUtils;
|
||||
public class CacheUtils {
|
||||
private static CacheUtils sInstance = new CacheUtils();
|
||||
public long size = 0;
|
||||
public static boolean needToDelete = false;
|
||||
|
||||
public static CacheUtils getInstance() {
|
||||
if (sInstance == null)
|
||||
@@ -55,7 +56,7 @@ public class CacheUtils {
|
||||
public void autoCleaningCache() {
|
||||
size = IOUtils.getDirSize(getGlobalContext().getCacheDir());
|
||||
|
||||
if (size >= getSizeForDelete()) {
|
||||
if (size >= getSizeForDelete() && needToDelete) {
|
||||
if (dev()) sendToast(AndroidUtils.getString("cache_cleaned"));
|
||||
VKImageLoader.e();
|
||||
ImAudioMsgPlayerProvider.b().e(PlayerActionSources.a);
|
||||
|
||||
@@ -5,6 +5,7 @@ import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPreferences;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.CacheUtils.*;
|
||||
import static ru.vtosters.lite.utils.CacheUtils.getInstance;
|
||||
import static ru.vtosters.lite.utils.DeletedMessagesHandler.reloadMessagesList;
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.setupFilters;
|
||||
@@ -362,16 +363,22 @@ public class Preferences {
|
||||
public static long getSizeForDelete() {
|
||||
switch (getPrefsValue("clearcache")) {
|
||||
case "100mb":
|
||||
needToDelete = true;
|
||||
return 104857600L;
|
||||
case "500mb":
|
||||
needToDelete = true;
|
||||
return 524288000L;
|
||||
case "1gb":
|
||||
needToDelete = true;
|
||||
return 1073741824L;
|
||||
case "2gb":
|
||||
needToDelete = true;
|
||||
return 2147483648L;
|
||||
case "5gb":
|
||||
needToDelete = true;
|
||||
return 5368709120L;
|
||||
default:
|
||||
needToDelete = false;
|
||||
return MAX_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user