Refine code style

This commit is contained in:
Mygod
2018-12-29 01:38:50 +08:00
parent cfe785f510
commit 5fc67d4249
9 changed files with 12 additions and 16 deletions

View File

@@ -95,13 +95,13 @@ exceptions:
PrintStackTrace: PrintStackTrace:
active: false active: false
RethrowCaughtException: RethrowCaughtException:
active: true active: false
ReturnFromFinally: ReturnFromFinally:
active: true active: true
SwallowedException: SwallowedException:
active: true active: true
ThrowingExceptionFromFinally: ThrowingExceptionFromFinally:
active: true active: false
ThrowingExceptionInMain: ThrowingExceptionInMain:
active: true active: true
ThrowingExceptionsWithoutMessageOrCause: ThrowingExceptionsWithoutMessageOrCause:
@@ -317,8 +317,7 @@ style:
CollapsibleIfStatements: CollapsibleIfStatements:
active: true active: true
DataClassContainsFunctions: DataClassContainsFunctions:
active: true active: false
conversionFunctionPrefix: 'to'
EqualsNullCall: EqualsNullCall:
active: true active: true
ExpressionBodySyntax: ExpressionBodySyntax:

View File

@@ -17,7 +17,7 @@ android {
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 28 targetSdkVersion 28
resConfigs "zh-rCN" resConfigs "zh-rCN"
versionCode 109 versionCode 110
versionName "2.1.1" versionName "2.1.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions { javaCompileOptions {

View File

@@ -4,7 +4,6 @@ import android.content.Intent
import android.content.IntentFilter import android.content.IntentFilter
import android.content.res.Configuration import android.content.res.Configuration
import android.net.wifi.WifiManager import android.net.wifi.WifiManager
import android.os.Build
import androidx.annotation.RequiresApi import androidx.annotation.RequiresApi
import be.mygod.vpnhotspot.App.Companion.app import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.net.TetheringManager import be.mygod.vpnhotspot.net.TetheringManager

View File

@@ -118,9 +118,8 @@ class RepeaterService : Service(), WifiP2pManager.ChannelListener, SharedPrefere
} }
private val deviceListener = broadcastReceiver { _, intent -> private val deviceListener = broadcastReceiver { _, intent ->
when (intent.action) { when (intent.action) {
WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION -> { WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION -> binder.thisDevice =
binder.thisDevice = intent.getParcelableExtra(WifiP2pManager.EXTRA_WIFI_P2P_DEVICE) intent.getParcelableExtra(WifiP2pManager.EXTRA_WIFI_P2P_DEVICE)
}
WifiP2pManagerHelper.WIFI_P2P_PERSISTENT_GROUPS_CHANGED_ACTION -> onPersistentGroupsChanged() WifiP2pManagerHelper.WIFI_P2P_PERSISTENT_GROUPS_CHANGED_ACTION -> onPersistentGroupsChanged()
} }
} }

View File

@@ -10,7 +10,6 @@ import androidx.databinding.BaseObservable
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import be.mygod.vpnhotspot.App.Companion.app import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.databinding.ListitemManageBinding import be.mygod.vpnhotspot.databinding.ListitemManageBinding
import be.mygod.vpnhotspot.widget.SmartSnackbar
import timber.log.Timber import timber.log.Timber
object ManageBar : Manager() { object ManageBar : Manager() {

View File

@@ -58,8 +58,8 @@ object DefaultNetworkMonitor : UpstreamMonitor() {
it.onAvailable(ifname, properties.dnsServers) it.onAvailable(ifname, properties.dnsServers)
} }
} }
properties.dnsServers != oldProperties.dnsServers -> { properties.dnsServers != oldProperties.dnsServers -> callbacks.forEach {
callbacks.forEach { it.onAvailable(ifname, properties.dnsServers) } it.onAvailable(ifname, properties.dnsServers)
} }
} }
} }

View File

@@ -3,6 +3,7 @@ package be.mygod.vpnhotspot.net.monitor
import android.content.SharedPreferences import android.content.SharedPreferences
import android.net.LinkProperties import android.net.LinkProperties
import be.mygod.vpnhotspot.App.Companion.app import be.mygod.vpnhotspot.App.Companion.app
import java.lang.UnsupportedOperationException
import java.net.InetAddress import java.net.InetAddress
import java.util.* import java.util.*
import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.ConcurrentHashMap
@@ -61,7 +62,7 @@ abstract class UpstreamMonitor {
* commit: https://android.googlesource.com/platform/system/netd/+/758627c4d93392190b08e9aaea3bbbfb92a5f364 * commit: https://android.googlesource.com/platform/system/netd/+/758627c4d93392190b08e9aaea3bbbfb92a5f364
*/ */
fun onFallback() { fun onFallback() {
throw NotImplementedError() throw UnsupportedOperationException()
} }
} }

View File

@@ -62,8 +62,8 @@ object VpnMonitor : UpstreamMonitor() {
it.onAvailable(ifname, properties.dnsServers) it.onAvailable(ifname, properties.dnsServers)
} }
} }
properties.dnsServers != oldProperties.dnsServers -> { properties.dnsServers != oldProperties.dnsServers -> callbacks.forEach {
callbacks.forEach { it.onAvailable(ifname, properties.dnsServers) } it.onAvailable(ifname, properties.dnsServers)
} }
} }
} }

View File

@@ -7,7 +7,6 @@ import android.widget.Toast
import androidx.annotation.StringRes import androidx.annotation.StringRes
import androidx.lifecycle.Lifecycle import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleObserver import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.OnLifecycleEvent import androidx.lifecycle.OnLifecycleEvent
import be.mygod.vpnhotspot.App.Companion.app import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.R import be.mygod.vpnhotspot.R