Skip to content

Commit 7068e6c

Browse files
committed
see 08/30 log
1 parent c54c4f8 commit 7068e6c

File tree

14 files changed

+68
-78
lines changed

14 files changed

+68
-78
lines changed

README-CN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ getEntries : 获取压缩文件中的文件对象
618618

619619
Gradle:
620620
``` groovy
621-
compile 'com.blankj:utilcode:1.8.4'
621+
compile 'com.blankj:utilcode:1.8.5'
622622
```
623623

624624

@@ -641,7 +641,7 @@ Utils.init(context);
641641

642642
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
643643

644-
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.8.4-brightgreen.svg
644+
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.8.5-brightgreen.svg
645645
[auc]: https://github.com/Blankj/AndroidUtilCode
646646

647647
[apisvg]: https://img.shields.io/badge/API-14+-brightgreen.svg

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ getEntries
618618

619619
Gradle:
620620
``` groovy
621-
compile 'com.blankj:utilcode:1.8.4'
621+
compile 'com.blankj:utilcode:1.8.5'
622622
```
623623

624624

@@ -641,7 +641,7 @@ Utils.init(context);
641641

642642
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
643643

644-
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.8.4-brightgreen.svg
644+
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.8.5-brightgreen.svg
645645
[auc]: https://github.com/Blankj/AndroidUtilCode
646646

647647
[apisvg]: https://img.shields.io/badge/API-14+-brightgreen.svg

app/src/main/java/com/blankj/androidutilcode/core/snackbar/SnackbarActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*/
2727
public class SnackbarActivity extends BaseBackActivity {
2828

29-
private View snackBarRootView;
29+
View snackBarRootView;
3030

3131
public static void start(Context context) {
3232
Intent starter = new Intent(context, SnackbarActivity.class);

app/src/main/java/com/blankj/androidutilcode/core/toast/ToastActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ protected void onDestroy() {
120120
}
121121

122122
private void resetToast() {
123-
ToastUtils.setMessageColor(0x12000000);
123+
ToastUtils.setMessageColor(0xFFFFFFFF);
124124
ToastUtils.setBgResource(-1);
125125
ToastUtils.setView(null);
126126
ToastUtils.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, getResources().getDimensionPixelSize(R.dimen.offset_64));

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ ext {
2929
minSdkVersion = 14
3030
targetSdkVersion = 25
3131

32-
versionCode = 100800400
33-
versionName = '1.8.4'
32+
versionCode = 100800500
33+
versionName = '1.8.5'
3434

3535
// App dependencies
3636
supportVersion = '25.3.1'

settings.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
include ':app', ':utilcode', ':subutil'
1+
include ':app',
2+
':utilcode',
3+
':subutil'

update_log.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
* 17/08/30 修复ToastUtils弱引用带来的问题,修复CacheUtils异步问题,发布版本1.8.5
12
* 17/08/28 修复ToastUtils内存泄露,新增toast可根据系统字体显示不同字体,发布版本1.8.4
23
* 17/08/20 新增监听Activity生命周期,退出App,发布版本1.8.3
34
* 17/08/11 LogUtils的Builder改为Config,发布版本1.8.2

utilcode/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ android {
3737
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
3838
}
3939
release {
40-
minifyEnabled true
40+
minifyEnabled false
4141
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
4242
}
4343
}
@@ -63,4 +63,4 @@ dependencies {
6363
testCompile "com.google.truth:truth:0.31"
6464
}
6565
//apply from: "https://raw.githubusercontent.com/xiaopansky/android-library-publish-to-jcenter/master/bintrayUpload.gradle"
66-
//gradlew bintrayUpload
66+
//gradle bintrayUpload

utilcode/src/main/java/com/blankj/utilcode/util/CacheUtils.java

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,7 @@ public Object getSerializable(@NonNull final String key, final Object defaultVal
550550
/**
551551
* 获取缓存大小
552552
* <p>单位:字节</p>
553+
* <p>调用了Thread.join(),需异步调用,否则可能主线程会卡顿</p>
553554
*
554555
* @return 缓存大小
555556
*/
@@ -559,6 +560,7 @@ public long getCacheSize() {
559560

560561
/**
561562
* 获取缓存个数
563+
* <p>调用了Thread.join(),需异步调用,否则可能主线程会卡顿</p>
562564
*
563565
* @return 缓存个数
564566
*/
@@ -591,19 +593,16 @@ private class CacheManager {
591593
private final long sizeLimit;
592594
private final int countLimit;
593595
private final Map<File, Long> lastUsageDates = Collections.synchronizedMap(new HashMap<File, Long>());
594-
private final File cacheDir;
596+
private final File cacheDir;
597+
private final Thread mThread;
595598

596599
private CacheManager(final File cacheDir, final long sizeLimit, final int countLimit) {
597600
this.cacheDir = cacheDir;
598601
this.sizeLimit = sizeLimit;
599602
this.countLimit = countLimit;
600603
cacheSize = new AtomicLong();
601604
cacheCount = new AtomicInteger();
602-
calculateCacheSizeAndCacheCount();
603-
}
604-
605-
private void calculateCacheSizeAndCacheCount() {
606-
new Thread(new Runnable() {
605+
mThread = new Thread(new Runnable() {
607606
@Override
608607
public void run() {
609608
int size = 0;
@@ -619,14 +618,25 @@ public void run() {
619618
cacheCount.getAndAdd(count);
620619
}
621620
}
622-
}).start();
621+
});
622+
mThread.start();
623623
}
624624

625625
private long getCacheSize() {
626+
try {
627+
mThread.join();
628+
} catch (InterruptedException e) {
629+
e.printStackTrace();
630+
}
626631
return cacheSize.get();
627632
}
628633

629634
private int getCacheCount() {
635+
try {
636+
mThread.join();
637+
} catch (InterruptedException e) {
638+
e.printStackTrace();
639+
}
630640
return cacheCount.get();
631641
}
632642

utilcode/src/main/java/com/blankj/utilcode/util/SnackbarUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*/
2929
public final class SnackbarUtils {
3030

31-
private static final int DEFAULT_COLOR = 0x12000000;
31+
private static final int DEFAULT_COLOR = 0xFEFFFFFF;
3232

3333
public static final int LENGTH_INDEFINITE = -2;
3434

0 commit comments

Comments
 (0)