61 lines
1.8 KiB
Java
61 lines
1.8 KiB
Java
package com.ubt.jimu.utils;
|
|
|
|
import android.content.Context;
|
|
import java.io.File;
|
|
import java.math.BigDecimal;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class GlideUtils {
|
|
public static String a(Context context) {
|
|
try {
|
|
LogUtils.c(context.getExternalCacheDir() + "/image_manager_disk_cache");
|
|
LogUtils.c("context.getExternalCacheDir():" + context.getExternalCacheDir().getAbsolutePath());
|
|
return a(a(new File(r2)));
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
return "0";
|
|
}
|
|
}
|
|
|
|
private static long a(File file) throws Exception {
|
|
long length;
|
|
long j = 0;
|
|
try {
|
|
if (file.exists()) {
|
|
LogUtils.c(file.getAbsolutePath());
|
|
}
|
|
for (File file2 : file.listFiles()) {
|
|
if (file2.isDirectory()) {
|
|
length = a(file2);
|
|
} else {
|
|
length = file2.length();
|
|
}
|
|
j += length;
|
|
}
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
return j;
|
|
}
|
|
|
|
private static String a(double d) {
|
|
double d2 = d / 1024.0d;
|
|
if (d2 < 1.0d) {
|
|
return d + "KB";
|
|
}
|
|
double d3 = d2 / 1024.0d;
|
|
if (d3 < 1.0d) {
|
|
return new BigDecimal(Double.toString(d2)).setScale(2, 4).toPlainString() + "KB";
|
|
}
|
|
double d4 = d3 / 1024.0d;
|
|
if (d4 < 1.0d) {
|
|
return new BigDecimal(Double.toString(d3)).setScale(2, 4).toPlainString() + "MB";
|
|
}
|
|
double d5 = d4 / 1024.0d;
|
|
if (d5 < 1.0d) {
|
|
return new BigDecimal(Double.toString(d4)).setScale(2, 4).toPlainString() + "GB";
|
|
}
|
|
return BigDecimal.valueOf(d5).setScale(2, 4).toPlainString() + "TB";
|
|
}
|
|
}
|