Skip to content

Commit 3add537

Browse files
author
chenhao
committed
升级工具库
1 parent 6009f26 commit 3add537

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

SmartCode/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ dependencies {
132132
}
133133

134134
api 'com.qmuiteam:qmui:1.4.3'
135-
api 'com.blankj:utilcodex:1.26.0'
135+
api 'com.blankj:utilcodex:1.30.6'
136136
api 'me.jessyan:autosize:1.2.1'
137137
api 'me.jessyan:retrofit-url-manager:1.4.0'
138138
api 'com.tencent:mmkv-static:1.2.9'

SmartCode/src/main/java/ch/smart/code/util/UIExt.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ import java.util.concurrent.TimeUnit
3737
fun showToast(msg: String, @DrawableRes iconId: Int? = null) {
3838
try {
3939
if (msg.isNotEmpty()) {
40-
ToastUtils.setGravity(Gravity.CENTER, 0, 0)
41-
val v: View = ToastUtils.showCustomLong(R.layout.public_layout_toast)
40+
val v: View = View.inflate(Utils.getApp(), R.layout.public_layout_toast, null)
4241
val vIcon: ImageView = v.findViewById(R.id.public_toast_icon)
4342
val vTxt: TextView = v.findViewById(R.id.public_toast_txt)
4443
if (iconId != null) {
@@ -48,6 +47,9 @@ fun showToast(msg: String, @DrawableRes iconId: Int? = null) {
4847
vIcon.visibility = View.GONE
4948
}
5049
vTxt.text = msg
50+
ToastUtils.getDefaultMaker()
51+
.setGravity(Gravity.CENTER, 0, 0)
52+
.show(v)
5153
}
5254
} catch (e: Exception) {
5355
Timber.e(e)

SmartCode/src/main/java/ch/smart/code/util/VersionCheck.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ class VersionCheck(
2525
private val nowVersionCode: Int,
2626
private val nowVersionName: String,
2727
private val buildVersionNum: Int = 0,
28-
private val needForceUpdate: Boolean = false
28+
private val needForceUpdate: Boolean = false,
29+
private val needForceDescRule: String = "强制更新"
2930
) {
3031

3132
interface Api {
@@ -92,11 +93,12 @@ class VersionCheck(
9293
if ((versionNo > nowVersionCode || buildVersionNum in 1 until versionBB)
9394
&& url?.isStartsWithHttp() == true
9495
) {
96+
val desc =
97+
data.get("buildUpdateDescription")?.asString ?: ""
9598
map["url"] = url
9699
map["name"] = data.get("buildVersion")?.asString ?: ""
97-
map["desc"] =
98-
data.get("buildUpdateDescription")?.asString ?: ""
99-
if (needForceUpdate || versionNo - nowVersionCode > 1) {
100+
map["desc"] = desc
101+
if (needForceUpdate || desc.contains(needForceDescRule)) {
100102
map["force"] = "true"
101103
}
102104
}

0 commit comments

Comments
 (0)