Skip to content

Commit a5fc602

Browse files
authored
Merge pull request Blankj#805 from Blankj/1.23.0
1.23.0
2 parents 239f18b + b012e98 commit a5fc602

File tree

134 files changed

+7181
-3064
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+7181
-3064
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
* `19/01/17` [fix] Publish v1.23.0.
2+
* `19/01/16` [fix] BarUtils get Activity from view and delete the function of set status bar alpha.
3+
* `19/01/15` [add] ColorUtils.
4+
* `19/01/04` [add] CacheDiskStaticUtils, CacheDoubleStaticUtils, CacheMemoryStaticUtils.
5+
* `19/01/03` [add] SPStaticUtils.
16
* `19/01/02` [fix] LogUtils log object. Publish v1.22.10.
27
* `19/01/01` [add] GsonUtils.
38
* `18/12/29` [add] AntiShakeUtils and VibrateUtils. Publish v1.22.9.

README-CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
4343

44-
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.22.10-brightgreen.svg
44+
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.23.0-brightgreen.svg
4545
[auc]: https://github.com/Blankj/AndroidUtilCode
4646

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

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ If this project helps you a lot and you want to support the project's developmen
4141

4242
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
4343

44-
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.22.10-brightgreen.svg
44+
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.23.0-brightgreen.svg
4545
[auc]: https://github.com/Blankj/AndroidUtilCode
4646

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

bus-gradle-plugin/src/main/java/com/blankj/util/JsonUtils.groovy

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ import com.google.gson.GsonBuilder
1313
*/
1414
final class JsonUtils {
1515

16+
static final Gson GSON = new GsonBuilder().setPrettyPrinting().create()
17+
1618
static String getFormatJson(Object object) {
17-
Gson gson = new GsonBuilder().setPrettyPrinting().create()
18-
return gson.toJson(object)
19+
return GSON.toJson(object)
1920
}
2021
}

bus-gradle-plugin/src/main/java/com/blankj/util/ZipUtils.java

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -291,13 +291,23 @@ public static List<File> unzipFileByKeyword(final File zipFile,
291291
if (isSpace(keyword)) {
292292
while (entries.hasMoreElements()) {
293293
ZipEntry entry = ((ZipEntry) entries.nextElement());
294-
if (!unzipChildFile(destDir, files, zip, entry)) return files;
294+
String entryName = entry.getName();
295+
if (entryName.contains("../")) {
296+
System.err.println("entryName: " + entryName + " is dangerous!");
297+
continue;
298+
}
299+
if (!unzipChildFile(destDir, files, zip, entry, entryName)) return files;
295300
}
296301
} else {
297302
while (entries.hasMoreElements()) {
298303
ZipEntry entry = ((ZipEntry) entries.nextElement());
299-
if (entry.getName().contains(keyword)) {
300-
if (!unzipChildFile(destDir, files, zip, entry)) return files;
304+
String entryName = entry.getName();
305+
if (entryName.contains("../")) {
306+
System.out.println("entryName: " + entryName + " is dangerous!");
307+
continue;
308+
}
309+
if (entryName.contains(keyword)) {
310+
if (!unzipChildFile(destDir, files, zip, entry, entryName)) return files;
301311
}
302312
}
303313
}
@@ -310,8 +320,9 @@ public static List<File> unzipFileByKeyword(final File zipFile,
310320
private static boolean unzipChildFile(final File destDir,
311321
final List<File> files,
312322
final ZipFile zip,
313-
final ZipEntry entry) throws IOException {
314-
File file = new File(destDir, entry.getName());
323+
final ZipEntry entry,
324+
final String name) throws IOException {
325+
File file = new File(destDir, name);
315326
files.add(file);
316327
if (entry.isDirectory()) {
317328
return createOrExistsDir(file);
@@ -365,7 +376,13 @@ public static List<String> getFilesPath(final File zipFile)
365376
ZipFile zip = new ZipFile(zipFile);
366377
Enumeration<?> entries = zip.entries();
367378
while (entries.hasMoreElements()) {
368-
paths.add(((ZipEntry) entries.nextElement()).getName());
379+
String entryName = ((ZipEntry) entries.nextElement()).getName();
380+
if (entryName.contains("../")) {
381+
System.out.println("entryName: " + entryName + " is dangerous!");
382+
paths.add(entryName);
383+
} else {
384+
paths.add(entryName);
385+
}
369386
}
370387
zip.close();
371388
return paths;

config.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ ext {
55
compileSdkVersion = 27
66
minSdkVersion = 14
77
targetSdkVersion = 27
8-
versionCode = 1_022_010
9-
versionName = '1.22.10'// E.g. 1.9.72 => 1,009,072
8+
versionCode = 1_023_000
9+
versionName = '1.23.0'// E.g. 1.9.72 => 1,009,072
1010

1111
bus = [
1212
isDebug: false,

launcher/pkg/src/main/java/com/blankj/launcher/pkg/MainActivity.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import android.os.Bundle
55
import android.support.v7.app.ActionBarDrawerToggle
66
import android.view.View
77
import android.widget.ImageView
8-
import com.blankj.launcher.pkg.R
98
import com.blankj.lib.base.BaseDrawerActivity
109
import com.blankj.utilcode.util.ActivityUtils
1110
import com.blankj.utilcode.util.BarUtils
@@ -44,7 +43,7 @@ class MainActivity : BaseDrawerActivity() {
4443
mDrawerRootLayout.addDrawerListener(toggle)
4544
toggle.syncState()
4645

47-
BarUtils.setStatusBarAlpha4Drawer(this, mDrawerRootLayout, launcherMainFakeStatusBar, 0, false)
46+
BarUtils.setStatusBarColor4Drawer(mDrawerRootLayout, launcherMainFakeStatusBar, Color.TRANSPARENT, false)
4847
BarUtils.addMarginTopEqualStatusBarHeight(launcherMainToolbar)
4948

5049
launcherMainCoreUtilBtn.setOnClickListener {

lib/base/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ dependencies {
1515
api dep.free_proguard
1616
api 'com.r0adkll:slidableactivity:2.0.5'
1717
compileOnly dep.leakcanary.android_no_op
18-
// api 'com.blankj:utilcode:1.22.10'
18+
// api 'com.blankj:utilcode:1.22.11'
1919
}

lib/base/src/main/java/com/blankj/lib/base/BaseActivity.kt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import android.os.Bundle
55
import android.support.v7.app.AppCompatActivity
66
import android.view.LayoutInflater
77
import android.view.View
8-
import com.blankj.utilcode.util.AntiShakeUtils
8+
import com.blankj.utilcode.util.*
99

1010
/**
1111
* ```
@@ -27,6 +27,15 @@ abstract class BaseActivity : AppCompatActivity(), IBaseView {
2727
setRootLayout(bindLayout())
2828
initView(savedInstanceState, mContentView)
2929
doBusiness()
30+
AppUtils.registerAppStatusChangedListener(this, object : Utils.OnAppStatusChangedListener {
31+
override fun onForeground() {
32+
ToastUtils.showShort("foreground")
33+
}
34+
35+
override fun onBackground() {
36+
ToastUtils.showShort("background")
37+
}
38+
})
3039
}
3140

3241
override fun setRootLayout(layoutId: Int) {
@@ -40,4 +49,10 @@ abstract class BaseActivity : AppCompatActivity(), IBaseView {
4049
onWidgetClick(view)
4150
}
4251
}
52+
53+
override fun onDestroy() {
54+
super.onDestroy()
55+
AppUtils.unregisterAppStatusChangedListener(this)
56+
KeyboardUtils.fixSoftInputLeaks(this);
57+
}
4358
}

lib/base/src/main/java/com/blankj/lib/base/BaseBackActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ abstract class BaseBackActivity : BaseActivity() {
2828
setSupportActionBar(baseBackToolbar)
2929
supportActionBar?.setDisplayHomeAsUpEnabled(true)
3030

31-
BarUtils.setStatusBarColor(this, ContextCompat.getColor(Utils.getApp(), R.color.colorPrimary), 0)
31+
BarUtils.setStatusBarColor(this, ContextCompat.getColor(Utils.getApp(), R.color.colorPrimary))
3232
BarUtils.addMarginTopEqualStatusBarHeight(backRootLayout)
3333
}
3434

lib/base/src/main/res/values/colors.xml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,42 @@
2626
<item>@color/rainbow_blue</item>
2727
<item>@color/rainbow_purple</item>
2828
</integer-array>
29+
30+
31+
<!--beautiful color-->
32+
<color name="grapefruit">#ED5565</color>
33+
<color name="grapefruitDark">#DA4453</color>
34+
35+
<color name="bittersweet">#FC6E51</color>
36+
<color name="bittersweetDark">#E9573F</color>
37+
38+
<color name="sunflower">#FFCE54</color>
39+
<color name="sunflowerDark">#F6BB42</color>
40+
41+
<color name="grass">#A0D468</color>
42+
<color name="grassDark">#8CC152</color>
43+
44+
<color name="mint">#48CFAD</color>
45+
<color name="mintDark">#37BC9B</color>
46+
47+
<color name="aqua">#4FC1E9</color>
48+
<color name="aquaDark">#3BAFDA</color>
49+
50+
<color name="blueJeans">#5D9CEC</color>
51+
<color name="blueJeansDark">#4A89DC</color>
52+
53+
<color name="lavander">#AC92EC</color>
54+
<color name="lavanderDark">#967ADC</color>
55+
56+
<color name="pinkRose">#EC87C0</color>
57+
<color name="pinkRoseDark">#D770AD</color>
58+
59+
<color name="lightGray">#F5F7FA</color>
60+
<color name="lightGrayDark">#E6E9ED</color>
61+
62+
<color name="mediumGray">#CCD1D9</color>
63+
<color name="mediumGrayDark">#AAB2BD</color>
64+
65+
<color name="darkGray">#656D78</color>
66+
<color name="darkGrayDark">#434A54</color>
2967
</resources>

0 commit comments

Comments
 (0)