style: optimize code

This commit is contained in:
2023-09-16 01:05:48 +08:00
parent 147b7fa6f5
commit 2e56baa6c7
4 changed files with 13 additions and 10 deletions

View File

@@ -19,8 +19,6 @@
* *
* This file is Created by fankes on 2022/2/15. * This file is Created by fankes on 2022/2/15.
*/ */
@file:Suppress("IMPLICIT_CAST_TO_ANY")
package com.fankes.tsbattery.hook package com.fankes.tsbattery.hook
import com.fankes.tsbattery.const.PackageName import com.fankes.tsbattery.const.PackageName

View File

@@ -19,8 +19,6 @@
* *
* This file is Created by fankes on 2022/1/30. * This file is Created by fankes on 2022/1/30.
*/ */
@file:Suppress("UNCHECKED_CAST")
package com.fankes.tsbattery.ui.activity.base package com.fankes.tsbattery.ui.activity.base
import android.os.Build import android.os.Build

View File

@@ -19,7 +19,7 @@
* *
* This file is Created by fankes on 2022/3/13. * This file is Created by fankes on 2022/3/13.
*/ */
@file:Suppress("unused") @file:Suppress("unused", "UnusedReceiverParameter")
package com.fankes.tsbattery.utils.factory package com.fankes.tsbattery.utils.factory

View File

@@ -28,12 +28,20 @@ import android.content.Context
import android.icu.text.SimpleDateFormat import android.icu.text.SimpleDateFormat
import android.icu.util.Calendar import android.icu.util.Calendar
import android.icu.util.TimeZone import android.icu.util.TimeZone
import com.fankes.tsbattery.utils.factory.* import com.fankes.tsbattery.utils.factory.isNetWorkSuccess
import okhttp3.* import com.fankes.tsbattery.utils.factory.openBrowser
import com.fankes.tsbattery.utils.factory.openSelfSetting
import com.fankes.tsbattery.utils.factory.runInSafe
import com.fankes.tsbattery.utils.factory.showDialog
import okhttp3.Call
import okhttp3.Callback
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
import org.json.JSONObject import org.json.JSONObject
import java.io.IOException import java.io.IOException
import java.io.Serializable import java.io.Serializable
import java.util.* import java.util.Locale
/** /**
* 获取 GitHub Release 最新版本工具类 * 获取 GitHub Release 最新版本工具类
@@ -60,7 +68,6 @@ object GithubReleaseTool {
.build() .build()
).enqueue(object : Callback { ).enqueue(object : Callback {
override fun onFailure(call: Call, e: IOException) {} override fun onFailure(call: Call, e: IOException) {}
override fun onResponse(call: Call, response: Response) = runInSafe { override fun onResponse(call: Call, response: Response) = runInSafe {
JSONObject(response.body.string()).apply { JSONObject(response.body.string()).apply {
GithubReleaseBean( GithubReleaseBean(
@@ -72,7 +79,7 @@ object GithubReleaseTool {
fun showUpdate() = context.showDialog { fun showUpdate() = context.showDialog {
title = "最新版本 $name" title = "最新版本 $name"
msg = "发布于 $date\n\n" + msg = "发布于 $date\n\n" +
"更新日志\n\n" + content "更新日志\n\n" + content
confirmButton(text = "更新") { context.openBrowser(htmlUrl) } confirmButton(text = "更新") { context.openBrowser(htmlUrl) }
cancelButton() cancelButton()
} }