Code clean

This commit is contained in:
2dust 2024-12-21 17:18:35 +08:00
parent 0e6c860360
commit 7afffa60c3
14 changed files with 23 additions and 18 deletions

View file

@ -95,4 +95,4 @@ inline fun <reified T : Serializable> Intent.serializable(key: String): T? = whe
else -> @Suppress("DEPRECATION") getSerializableExtra(key) as? T
}
inline fun CharSequence?.isNotNullEmpty(): Boolean = (this != null && this.isNotEmpty())
fun CharSequence?.isNotNullEmpty(): Boolean = (this != null && this.isNotEmpty())

View file

@ -240,7 +240,7 @@ object V2rayConfigManager {
val rulesetItems = MmkvManager.decodeRoutingRulesets()
rulesetItems?.forEach { key ->
if (key != null && key.enabled && key.outboundTag == tag && !key.domain.isNullOrEmpty()) {
if (key.enabled && key.outboundTag == tag && !key.domain.isNullOrEmpty()) {
key.domain?.forEach {
if (it != GEOSITE_PRIVATE
&& (it.startsWith("geosite:") || it.startsWith("domain:"))

View file

@ -222,7 +222,7 @@ object PluginManager {
return File(pluginDir, pluginId).absolutePath
}
fun ComponentInfo.loadString(key: String) = when (val value = metaData.get(key)) {
fun ComponentInfo.loadString(key: String) = when (val value = metaData.getString(key)) {
is String -> value
is Int -> AngApplication.application.packageManager.getResourcesForApplication(applicationInfo)
.getString(value)

View file

@ -4,6 +4,7 @@ import android.app.Notification
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.app.Service
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
@ -353,7 +354,12 @@ object V2RayServiceManager {
fun cancelNotification() {
val service = serviceControl?.get()?.getService() ?: return
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
service.stopForeground(Service.STOP_FOREGROUND_REMOVE)
} else {
service.stopForeground(true)
}
mBuilder = null
mDisposable?.dispose()
mDisposable = null

View file

@ -387,7 +387,7 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList
}
}
}
.setNegativeButton(android.R.string.no) { _, _ ->
.setNegativeButton(android.R.string.cancel) { _, _ ->
//do noting
}
.show()
@ -407,7 +407,7 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList
}
}
}
.setNegativeButton(android.R.string.no) { _, _ ->
.setNegativeButton(android.R.string.cancel) { _, _ ->
//do noting
}
.show()
@ -427,7 +427,7 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList
}
}
}
.setNegativeButton(android.R.string.no) { _, _ ->
.setNegativeButton(android.R.string.cancel) { _, _ ->
//do noting
}
.show()

View file

@ -143,7 +143,7 @@ class MainRecyclerAdapter(val activity: MainActivity) : RecyclerView.Adapter<Mai
.setPositiveButton(android.R.string.ok) { _, _ ->
removeServer(guid, position)
}
.setNegativeButton(android.R.string.no) { _, _ ->
.setNegativeButton(android.R.string.cancel) { _, _ ->
//do noting
}
.show()

View file

@ -95,7 +95,7 @@ class RoutingEditActivity : BaseActivity() {
}
}
}
.setNegativeButton(android.R.string.no) { _, _ ->
.setNegativeButton(android.R.string.cancel) { _, _ ->
// do nothing
}
.show()

View file

@ -105,7 +105,7 @@ class RoutingSettingActivity : BaseActivity() {
}
.setNegativeButton(android.R.string.no) { _, _ ->
.setNegativeButton(android.R.string.cancel) { _, _ ->
//do noting
}
.show()
@ -134,7 +134,7 @@ class RoutingSettingActivity : BaseActivity() {
}
}
}
.setNegativeButton(android.R.string.no) { _, _ ->
.setNegativeButton(android.R.string.cancel) { _, _ ->
//do nothing
}
.show()
@ -189,7 +189,7 @@ class RoutingSettingActivity : BaseActivity() {
}
}
}
.setNegativeButton(android.R.string.no) { _, _ ->
.setNegativeButton(android.R.string.cancel) { _, _ ->
//do nothing
}
.show()

View file

@ -600,7 +600,7 @@ class ServerActivity : BaseActivity() {
MmkvManager.removeServer(editGuid)
finish()
}
.setNegativeButton(android.R.string.no) { _, _ ->
.setNegativeButton(android.R.string.cancel) { _, _ ->
// do nothing
}
.show()

View file

@ -106,7 +106,7 @@ class ServerCustomConfigActivity : BaseActivity() {
MmkvManager.removeServer(editGuid)
finish()
}
.setNegativeButton(android.R.string.no) { _, _ ->
.setNegativeButton(android.R.string.cancel) { _, _ ->
// do nothing
}
.show()

View file

@ -113,7 +113,7 @@ class SubEditActivity : BaseActivity() {
}
}
}
.setNegativeButton(android.R.string.no) { _, _ ->
.setNegativeButton(android.R.string.cancel) { _, _ ->
// do nothing
}
.show()

View file

@ -333,7 +333,7 @@ class UserAssetActivity : BaseActivity() {
MmkvManager.removeAssetUrl(item.first)
initAssets()
}
.setNegativeButton(android.R.string.no) { _, _ ->
.setNegativeButton(android.R.string.cancel) { _, _ ->
//do noting
}
.show()

View file

@ -116,7 +116,7 @@ class UserAssetUrlActivity : BaseActivity() {
MmkvManager.removeAssetUrl(editAssetId)
finish()
}
.setNegativeButton(android.R.string.no) { _, _ ->
.setNegativeButton(android.R.string.cancel) { _, _ ->
// do nothing
}
.show()

View file

@ -16,7 +16,6 @@ dependencyResolutionManagement {
repositories {
google()
mavenCentral()
jcenter()
maven { url = uri("https://jitpack.io") }
}
}