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:
active: false
RethrowCaughtException:
active: true
active: false
ReturnFromFinally:
active: true
SwallowedException:
active: true
ThrowingExceptionFromFinally:
active: true
active: false
ThrowingExceptionInMain:
active: true
ThrowingExceptionsWithoutMessageOrCause:
@@ -317,8 +317,7 @@ style:
CollapsibleIfStatements:
active: true
DataClassContainsFunctions:
active: true
conversionFunctionPrefix: 'to'
active: false
EqualsNullCall:
active: true
ExpressionBodySyntax:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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