Refine code style
This commit is contained in:
@@ -88,19 +88,15 @@ class LocalOnlyHotspotService : IpNeighbourMonitoringService() {
|
||||
}
|
||||
|
||||
override fun onFailed(reason: Int) {
|
||||
val message = getString(R.string.tethering_temp_hotspot_failure,
|
||||
when (reason) {
|
||||
WifiManager.LocalOnlyHotspotCallback.ERROR_NO_CHANNEL ->
|
||||
getString(R.string.tethering_temp_hotspot_failure_no_channel)
|
||||
WifiManager.LocalOnlyHotspotCallback.ERROR_GENERIC ->
|
||||
getString(R.string.tethering_temp_hotspot_failure_generic)
|
||||
WifiManager.LocalOnlyHotspotCallback.ERROR_INCOMPATIBLE_MODE ->
|
||||
getString(R.string.tethering_temp_hotspot_failure_incompatible_mode)
|
||||
WifiManager.LocalOnlyHotspotCallback.ERROR_TETHERING_DISALLOWED ->
|
||||
getString(R.string.tethering_temp_hotspot_failure_tethering_disallowed)
|
||||
else -> getString(R.string.failure_reason_unknown, reason)
|
||||
})
|
||||
SmartSnackbar.make(message).show()
|
||||
SmartSnackbar.make(getString(R.string.tethering_temp_hotspot_failure, when (reason) {
|
||||
ERROR_NO_CHANNEL -> getString(R.string.tethering_temp_hotspot_failure_no_channel)
|
||||
ERROR_GENERIC -> getString(R.string.tethering_temp_hotspot_failure_generic)
|
||||
ERROR_INCOMPATIBLE_MODE -> getString(R.string.tethering_temp_hotspot_failure_incompatible_mode)
|
||||
ERROR_TETHERING_DISALLOWED -> {
|
||||
getString(R.string.tethering_temp_hotspot_failure_tethering_disallowed)
|
||||
}
|
||||
else -> getString(R.string.failure_reason_unknown, reason)
|
||||
})).show()
|
||||
startFailure()
|
||||
}
|
||||
}, null)
|
||||
|
||||
@@ -36,7 +36,7 @@ class TetheringService : IpNeighbourMonitoringService() {
|
||||
RoutingManager(caller, downstream, TetherType.ofInterface(downstream).isWifi) {
|
||||
override fun Routing.configure() {
|
||||
forward()
|
||||
masquerade(RoutingManager.masqueradeMode)
|
||||
masquerade(masqueradeMode)
|
||||
if (app.pref.getBoolean("service.disableIpv6", true)) disableIpv6()
|
||||
commit()
|
||||
}
|
||||
|
||||
@@ -105,8 +105,7 @@ sealed class TetherManager(protected val parent: TetheringFragment) : Manager(),
|
||||
fun updateErrorMessage(errored: List<String>) {
|
||||
data.text = errored.filter { TetherType.ofInterface(it) == tetherType }.joinToString("\n") {
|
||||
"$it: " + try {
|
||||
val error = TetheringManager.getLastTetherError(it)
|
||||
when (error) {
|
||||
when (val error = TetheringManager.getLastTetherError(it)) {
|
||||
TetheringManager.TETHER_ERROR_NO_ERROR -> "TETHER_ERROR_NO_ERROR"
|
||||
TetheringManager.TETHER_ERROR_UNKNOWN_IFACE -> "TETHER_ERROR_UNKNOWN_IFACE"
|
||||
TetheringManager.TETHER_ERROR_SERVICE_UNAVAIL -> "TETHER_ERROR_SERVICE_UNAVAIL"
|
||||
|
||||
@@ -59,9 +59,8 @@ object SpanFormatter {
|
||||
|
||||
val argTerm = m.group(1)
|
||||
val modTerm = m.group(2)
|
||||
val typeTerm = m.group(3)
|
||||
|
||||
val cookedArg = when (typeTerm) {
|
||||
val cookedArg = when (val typeTerm = m.group(3)) {
|
||||
"%" -> "%"
|
||||
"n" -> "\n"
|
||||
else -> {
|
||||
|
||||
Reference in New Issue
Block a user