Skip to content

Commit 7a89b10

Browse files
committed
更新弹窗内容支持SpannableString
1 parent a4f71b0 commit 7a89b10

File tree

6 files changed

+1425
-13
lines changed

6 files changed

+1425
-13
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,6 @@ UpdateAppUtils在应用启动时,通过对比当前应用和已下载apk的Ver
178178
<img src="https://github.com/teprinciple/UpdateAppUtils/blob/master/img/demo.png" width="220">
179179

180180
### 更新日志
181-
#### 2.0.2
182-
* 9.0Http适配
181+
#### 2.0.3
182+
* 更新弹窗内容支持SpannableString
183183
##### [更多历史版本](https://github.com/teprinciple/UpdateAppUtils/blob/master/readme/version.md)

app/src/main/java/com/example/teprinciple/updateappdemo/MainActivity.kt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,21 @@ class MainActivity : AppCompatActivity() {
4242

4343
// 浏览器下载
4444
btn_download_by_browser.setOnClickListener {
45+
46+
// 使用SpannableString
47+
val content = SpanUtils(this)
48+
.appendLine("1、Kotlin重构版")
49+
.appendLine("2、支持自定义UI").setForegroundColor(Color.RED)
50+
.appendLine("3、增加md5校验").setForegroundColor(Color.parseColor("#88e16531")).setFontSize(20, true)
51+
.appendLine("4、更多功能等你探索").setBoldItalic()
52+
.appendLine().appendImage(R.mipmap.ic_launcher).setBoldItalic()
53+
.create()
54+
4555
UpdateAppUtils
4656
.getInstance()
4757
.apkUrl(apkUrl)
4858
.updateTitle(updateTitle)
49-
.updateContent(updateContent)
59+
.updateContent(content)
5060
.updateConfig(UpdateConfig().apply {
5161
downloadBy = DownLoadBy.APP
5262
// alwaysShow = false
@@ -79,7 +89,7 @@ class MainActivity : AppCompatActivity() {
7989
startActivity(Intent(this, JavaDemoActivity::class.java))
8090
}
8191

82-
// md5校验
92+
// md5校验
8393
btn_check_md5.setOnClickListener {
8494
startActivity(Intent(this, CheckMd5DemoActivity::class.java))
8595
}

0 commit comments

Comments
 (0)