mirror of
https://github.com/2dust/v2rayNG.git
synced 2025-06-28 12:19:52 +00:00
Code clean
This commit is contained in:
parent
0e6c860360
commit
7afffa60c3
14 changed files with 23 additions and 18 deletions
|
@ -95,4 +95,4 @@ inline fun <reified T : Serializable> Intent.serializable(key: String): T? = whe
|
||||||
else -> @Suppress("DEPRECATION") getSerializableExtra(key) as? T
|
else -> @Suppress("DEPRECATION") getSerializableExtra(key) as? T
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun CharSequence?.isNotNullEmpty(): Boolean = (this != null && this.isNotEmpty())
|
fun CharSequence?.isNotNullEmpty(): Boolean = (this != null && this.isNotEmpty())
|
|
@ -240,7 +240,7 @@ object V2rayConfigManager {
|
||||||
|
|
||||||
val rulesetItems = MmkvManager.decodeRoutingRulesets()
|
val rulesetItems = MmkvManager.decodeRoutingRulesets()
|
||||||
rulesetItems?.forEach { key ->
|
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 {
|
key.domain?.forEach {
|
||||||
if (it != GEOSITE_PRIVATE
|
if (it != GEOSITE_PRIVATE
|
||||||
&& (it.startsWith("geosite:") || it.startsWith("domain:"))
|
&& (it.startsWith("geosite:") || it.startsWith("domain:"))
|
||||||
|
|
|
@ -222,7 +222,7 @@ object PluginManager {
|
||||||
return File(pluginDir, pluginId).absolutePath
|
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 String -> value
|
||||||
is Int -> AngApplication.application.packageManager.getResourcesForApplication(applicationInfo)
|
is Int -> AngApplication.application.packageManager.getResourcesForApplication(applicationInfo)
|
||||||
.getString(value)
|
.getString(value)
|
||||||
|
|
|
@ -4,6 +4,7 @@ import android.app.Notification
|
||||||
import android.app.NotificationChannel
|
import android.app.NotificationChannel
|
||||||
import android.app.NotificationManager
|
import android.app.NotificationManager
|
||||||
import android.app.PendingIntent
|
import android.app.PendingIntent
|
||||||
|
import android.app.Service
|
||||||
import android.content.BroadcastReceiver
|
import android.content.BroadcastReceiver
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
@ -353,7 +354,12 @@ object V2RayServiceManager {
|
||||||
|
|
||||||
fun cancelNotification() {
|
fun cancelNotification() {
|
||||||
val service = serviceControl?.get()?.getService() ?: return
|
val service = serviceControl?.get()?.getService() ?: return
|
||||||
service.stopForeground(true)
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
|
service.stopForeground(Service.STOP_FOREGROUND_REMOVE)
|
||||||
|
} else {
|
||||||
|
service.stopForeground(true)
|
||||||
|
}
|
||||||
|
|
||||||
mBuilder = null
|
mBuilder = null
|
||||||
mDisposable?.dispose()
|
mDisposable?.dispose()
|
||||||
mDisposable = null
|
mDisposable = null
|
||||||
|
|
|
@ -387,7 +387,7 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.setNegativeButton(android.R.string.no) { _, _ ->
|
.setNegativeButton(android.R.string.cancel) { _, _ ->
|
||||||
//do noting
|
//do noting
|
||||||
}
|
}
|
||||||
.show()
|
.show()
|
||||||
|
@ -407,7 +407,7 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.setNegativeButton(android.R.string.no) { _, _ ->
|
.setNegativeButton(android.R.string.cancel) { _, _ ->
|
||||||
//do noting
|
//do noting
|
||||||
}
|
}
|
||||||
.show()
|
.show()
|
||||||
|
@ -427,7 +427,7 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.setNegativeButton(android.R.string.no) { _, _ ->
|
.setNegativeButton(android.R.string.cancel) { _, _ ->
|
||||||
//do noting
|
//do noting
|
||||||
}
|
}
|
||||||
.show()
|
.show()
|
||||||
|
|
|
@ -143,7 +143,7 @@ class MainRecyclerAdapter(val activity: MainActivity) : RecyclerView.Adapter<Mai
|
||||||
.setPositiveButton(android.R.string.ok) { _, _ ->
|
.setPositiveButton(android.R.string.ok) { _, _ ->
|
||||||
removeServer(guid, position)
|
removeServer(guid, position)
|
||||||
}
|
}
|
||||||
.setNegativeButton(android.R.string.no) { _, _ ->
|
.setNegativeButton(android.R.string.cancel) { _, _ ->
|
||||||
//do noting
|
//do noting
|
||||||
}
|
}
|
||||||
.show()
|
.show()
|
||||||
|
|
|
@ -95,7 +95,7 @@ class RoutingEditActivity : BaseActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.setNegativeButton(android.R.string.no) { _, _ ->
|
.setNegativeButton(android.R.string.cancel) { _, _ ->
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
.show()
|
.show()
|
||||||
|
|
|
@ -105,7 +105,7 @@ class RoutingSettingActivity : BaseActivity() {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
.setNegativeButton(android.R.string.no) { _, _ ->
|
.setNegativeButton(android.R.string.cancel) { _, _ ->
|
||||||
//do noting
|
//do noting
|
||||||
}
|
}
|
||||||
.show()
|
.show()
|
||||||
|
@ -134,7 +134,7 @@ class RoutingSettingActivity : BaseActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.setNegativeButton(android.R.string.no) { _, _ ->
|
.setNegativeButton(android.R.string.cancel) { _, _ ->
|
||||||
//do nothing
|
//do nothing
|
||||||
}
|
}
|
||||||
.show()
|
.show()
|
||||||
|
@ -189,7 +189,7 @@ class RoutingSettingActivity : BaseActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.setNegativeButton(android.R.string.no) { _, _ ->
|
.setNegativeButton(android.R.string.cancel) { _, _ ->
|
||||||
//do nothing
|
//do nothing
|
||||||
}
|
}
|
||||||
.show()
|
.show()
|
||||||
|
|
|
@ -600,7 +600,7 @@ class ServerActivity : BaseActivity() {
|
||||||
MmkvManager.removeServer(editGuid)
|
MmkvManager.removeServer(editGuid)
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
.setNegativeButton(android.R.string.no) { _, _ ->
|
.setNegativeButton(android.R.string.cancel) { _, _ ->
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
.show()
|
.show()
|
||||||
|
|
|
@ -106,7 +106,7 @@ class ServerCustomConfigActivity : BaseActivity() {
|
||||||
MmkvManager.removeServer(editGuid)
|
MmkvManager.removeServer(editGuid)
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
.setNegativeButton(android.R.string.no) { _, _ ->
|
.setNegativeButton(android.R.string.cancel) { _, _ ->
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
.show()
|
.show()
|
||||||
|
|
|
@ -113,7 +113,7 @@ class SubEditActivity : BaseActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.setNegativeButton(android.R.string.no) { _, _ ->
|
.setNegativeButton(android.R.string.cancel) { _, _ ->
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
.show()
|
.show()
|
||||||
|
|
|
@ -333,7 +333,7 @@ class UserAssetActivity : BaseActivity() {
|
||||||
MmkvManager.removeAssetUrl(item.first)
|
MmkvManager.removeAssetUrl(item.first)
|
||||||
initAssets()
|
initAssets()
|
||||||
}
|
}
|
||||||
.setNegativeButton(android.R.string.no) { _, _ ->
|
.setNegativeButton(android.R.string.cancel) { _, _ ->
|
||||||
//do noting
|
//do noting
|
||||||
}
|
}
|
||||||
.show()
|
.show()
|
||||||
|
|
|
@ -116,7 +116,7 @@ class UserAssetUrlActivity : BaseActivity() {
|
||||||
MmkvManager.removeAssetUrl(editAssetId)
|
MmkvManager.removeAssetUrl(editAssetId)
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
.setNegativeButton(android.R.string.no) { _, _ ->
|
.setNegativeButton(android.R.string.cancel) { _, _ ->
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
.show()
|
.show()
|
||||||
|
|
|
@ -16,7 +16,6 @@ dependencyResolutionManagement {
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
jcenter()
|
|
||||||
maven { url = uri("https://jitpack.io") }
|
maven { url = uri("https://jitpack.io") }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue