Update dependencies and refine code style
This commit is contained in:
@@ -11,9 +11,9 @@ if (!getGradle().getStartParameter().getTaskRequests().toString().contains("Fdro
|
||||
def javaVersion = JavaVersion.VERSION_1_8
|
||||
def aux = [
|
||||
'com.crashlytics.sdk.android:crashlytics:2.10.1',
|
||||
'com.google.firebase:firebase-analytics:17.1.0',
|
||||
'com.google.firebase:firebase-analytics:17.2.0',
|
||||
]
|
||||
def lifecycleVersion = '2.2.0-alpha03'
|
||||
def lifecycleVersion = '2.2.0-alpha05'
|
||||
def roomVersion = '2.1.0'
|
||||
|
||||
android {
|
||||
@@ -75,27 +75,27 @@ androidExtensions {
|
||||
dependencies {
|
||||
kapt "androidx.room:room-compiler:$roomVersion"
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation 'androidx.browser:browser:1.2.0-alpha07'
|
||||
implementation 'androidx.core:core-ktx:1.1.0-rc03'
|
||||
implementation 'androidx.browser:browser:1.2.0-alpha08'
|
||||
implementation 'androidx.core:core-ktx:1.1.0'
|
||||
implementation 'androidx.emoji:emoji:1.0.0'
|
||||
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion"
|
||||
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycleVersion"
|
||||
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion"
|
||||
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion"
|
||||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion"
|
||||
implementation 'androidx.preference:preference:1.1.0-rc01'
|
||||
implementation 'androidx.preference:preference:1.1.0'
|
||||
implementation "androidx.room:room-ktx:$roomVersion"
|
||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
|
||||
implementation 'com.android.billingclient:billing:2.0.3'
|
||||
implementation 'com.github.topjohnwu.libsu:core:2.5.0'
|
||||
implementation 'com.google.android.material:material:1.1.0-alpha09'
|
||||
implementation 'com.github.topjohnwu.libsu:core:2.5.1'
|
||||
implementation 'com.google.android.material:material:1.1.0-alpha10'
|
||||
implementation 'com.jakewharton.timber:timber:4.7.1'
|
||||
implementation 'com.linkedin.dexmaker:dexmaker:2.25.0'
|
||||
implementation 'com.takisoft.preferencex:preferencex-simplemenu:1.0.0'
|
||||
implementation 'net.glxn.qrgen:android:2.0'
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
|
||||
implementation 'org.jetbrains.kotlinx:kotlinx-collections-immutable:0.2'
|
||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0'
|
||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.1'
|
||||
for (dep in aux) {
|
||||
freedomImplementation dep
|
||||
googleImplementation dep
|
||||
|
||||
@@ -62,7 +62,7 @@ abstract class RoutingManager(private val caller: Any, val downstream: String, p
|
||||
fun start() = when (val other = active.putIfAbsentCompat(downstream, this)) {
|
||||
null -> initRouting()
|
||||
this -> true // already started
|
||||
else -> throw IllegalStateException("Double routing detected for $downstream from $caller != ${other.caller}")
|
||||
else -> error("Double routing detected for $downstream from $caller != ${other.caller}")
|
||||
}
|
||||
|
||||
private fun initRouting() = try {
|
||||
|
||||
@@ -59,7 +59,7 @@ open class Client(val mac: Long, val iface: String) {
|
||||
IpNeighbour.State.INCOMPLETE -> R.string.connected_state_incomplete
|
||||
IpNeighbour.State.VALID -> R.string.connected_state_valid
|
||||
IpNeighbour.State.FAILED -> R.string.connected_state_failed
|
||||
else -> throw IllegalStateException("Invalid IpNeighbour.State: $state")
|
||||
else -> error("Invalid IpNeighbour.State: $state")
|
||||
}))
|
||||
}
|
||||
}.trimEnd()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package be.mygod.vpnhotspot.client
|
||||
|
||||
import androidx.emoji.text.EmojiCompat
|
||||
import java.lang.IllegalStateException
|
||||
|
||||
fun emojize(text: CharSequence?): CharSequence? = if (text == null) null else try {
|
||||
EmojiCompat.get().process(text)
|
||||
|
||||
@@ -27,7 +27,7 @@ import java.lang.reflect.InvocationTargetException
|
||||
|
||||
sealed class TetherManager(protected val parent: TetheringFragment) : Manager(),
|
||||
TetheringManager.OnStartTetheringCallback {
|
||||
class ViewHolder(val binding: ListitemInterfaceBinding) : RecyclerView.ViewHolder(binding.root),
|
||||
class ViewHolder(private val binding: ListitemInterfaceBinding) : RecyclerView.ViewHolder(binding.root),
|
||||
View.OnClickListener {
|
||||
init {
|
||||
itemView.updatePaddingRelative(start = itemView.resources.getDimensionPixelOffset(
|
||||
|
||||
@@ -35,7 +35,6 @@ import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import timber.log.Timber
|
||||
import java.lang.IllegalArgumentException
|
||||
import java.lang.reflect.InvocationTargetException
|
||||
import java.net.NetworkInterface
|
||||
import java.net.SocketException
|
||||
@@ -195,6 +194,7 @@ class TetheringFragment : Fragment(), ServiceConnection, Toolbar.OnMenuItemClick
|
||||
CONFIGURE_AP -> if (resultCode == DialogInterface.BUTTON_POSITIVE) try {
|
||||
WifiApManager.configuration = configuration
|
||||
} catch (e: IllegalArgumentException) {
|
||||
Timber.d(e)
|
||||
SmartSnackbar.make(R.string.configuration_rejected).show()
|
||||
} catch (e: InvocationTargetException) {
|
||||
SmartSnackbar.make(e.targetException).show()
|
||||
|
||||
@@ -13,7 +13,6 @@ import be.mygod.vpnhotspot.App.Companion.app
|
||||
import be.mygod.vpnhotspot.util.broadcastReceiver
|
||||
import be.mygod.vpnhotspot.util.intentFilter
|
||||
import timber.log.Timber
|
||||
import java.lang.IllegalArgumentException
|
||||
|
||||
@RequiresApi(28)
|
||||
class TetherTimeoutMonitor(private val context: Context, private val handler: Handler,
|
||||
|
||||
@@ -5,7 +5,6 @@ import android.net.LinkProperties
|
||||
import be.mygod.vpnhotspot.App.Companion.app
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import java.lang.UnsupportedOperationException
|
||||
import java.net.InetAddress
|
||||
import java.util.*
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
@@ -3,7 +3,6 @@ package be.mygod.vpnhotspot.net.wifi
|
||||
import android.net.wifi.WifiConfiguration
|
||||
import android.net.wifi.WifiManager
|
||||
import be.mygod.vpnhotspot.App.Companion.app
|
||||
import java.lang.IllegalArgumentException
|
||||
|
||||
object WifiApManager {
|
||||
private val getWifiApConfiguration by lazy { WifiManager::class.java.getDeclaredMethod("getWifiApConfiguration") }
|
||||
@@ -13,8 +12,8 @@ object WifiApManager {
|
||||
var configuration: WifiConfiguration
|
||||
get() = getWifiApConfiguration.invoke(app.wifi) as? WifiConfiguration ?: WifiConfiguration()
|
||||
set(value) {
|
||||
if (setWifiApConfiguration.invoke(app.wifi, value) as? Boolean != true) {
|
||||
throw IllegalArgumentException("setWifiApConfiguration failed")
|
||||
require(setWifiApConfiguration.invoke(app.wifi, value) as? Boolean == true) {
|
||||
"setWifiApConfiguration failed"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import android.net.wifi.p2p.WifiP2pManager
|
||||
import be.mygod.vpnhotspot.DebugHelper
|
||||
import com.android.dx.stock.ProxyBuilder
|
||||
import timber.log.Timber
|
||||
import java.lang.IllegalArgumentException
|
||||
import java.lang.reflect.Proxy
|
||||
|
||||
object WifiP2pManagerHelper {
|
||||
@@ -30,7 +29,7 @@ object WifiP2pManagerHelper {
|
||||
listener: WifiP2pManager.ActionListener) {
|
||||
try {
|
||||
setWifiP2pChannels.invoke(this, c, lc, oc, listener)
|
||||
} catch (e: NoSuchMethodException) {
|
||||
} catch (_: NoSuchMethodException) {
|
||||
DebugHelper.logEvent("NoSuchMethod_setWifiP2pChannels")
|
||||
listener.onFailure(UNSUPPORTED)
|
||||
}
|
||||
@@ -46,7 +45,7 @@ object WifiP2pManagerHelper {
|
||||
try {
|
||||
WifiP2pManager::class.java.getDeclaredMethod("startWps",
|
||||
WifiP2pManager.Channel::class.java, WpsInfo::class.java, WifiP2pManager.ActionListener::class.java)
|
||||
} catch (e: NoSuchMethodException) {
|
||||
} catch (_: NoSuchMethodException) {
|
||||
DebugHelper.logEvent("NoSuchMethod_startWps")
|
||||
null
|
||||
}
|
||||
@@ -69,7 +68,7 @@ object WifiP2pManagerHelper {
|
||||
listener: WifiP2pManager.ActionListener) {
|
||||
try {
|
||||
deletePersistentGroup.invoke(this, c, netId, listener)
|
||||
} catch (e: NoSuchMethodException) {
|
||||
} catch (_: NoSuchMethodException) {
|
||||
DebugHelper.logEvent("NoSuchMethod_deletePersistentGroup")
|
||||
listener.onFailure(UNSUPPORTED)
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import be.mygod.vpnhotspot.DebugHelper
|
||||
import be.mygod.vpnhotspot.RepeaterService
|
||||
import be.mygod.vpnhotspot.util.RootSession
|
||||
import java.io.File
|
||||
import java.lang.IllegalStateException
|
||||
|
||||
/**
|
||||
* This parser is based on:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package be.mygod.vpnhotspot.net.wifi.configuration
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.annotation.TargetApi
|
||||
import android.content.ClipData
|
||||
import android.content.DialogInterface
|
||||
@@ -90,6 +91,7 @@ class WifiApDialogFragment : AlertDialogFragment<WifiApDialogFragment.Arg, WifiA
|
||||
|
||||
override fun AlertDialog.Builder.prepare(listener: DialogInterface.OnClickListener) {
|
||||
val activity = requireActivity()
|
||||
@SuppressLint("InflateParams")
|
||||
dialogView = activity.layoutInflater.inflate(R.layout.dialog_wifi_ap, null)
|
||||
setView(dialogView)
|
||||
if (!arg.readOnly) setPositiveButton(R.string.wifi_save, listener)
|
||||
@@ -103,8 +105,7 @@ class WifiApDialogFragment : AlertDialogFragment<WifiApDialogFragment.Arg, WifiA
|
||||
setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
|
||||
}
|
||||
onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
||||
override fun onNothingSelected(parent: AdapterView<*>?) =
|
||||
throw IllegalStateException("Must select something")
|
||||
override fun onNothingSelected(parent: AdapterView<*>?) = error("Must select something")
|
||||
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
|
||||
dialogView.password_wrapper.isGone = position == WifiConfiguration.KeyMgmt.NONE
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user