Allow usage of legacy Wi-Fi switch in-app only on 7.1
This commit is contained in:
@@ -170,7 +170,7 @@ sealed class TetherManager(protected val parent: TetheringFragment) : Manager(),
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
@Deprecated("Not usable since API 25")
|
@Deprecated("Not usable since API 26, malfunctioning on API 25")
|
||||||
class WifiLegacy(parent: TetheringFragment) : TetherManager(parent) {
|
class WifiLegacy(parent: TetheringFragment) : TetherManager(parent) {
|
||||||
override val title get() = parent.getString(R.string.tethering_manage_wifi_legacy)
|
override val title get() = parent.getString(R.string.tethering_manage_wifi_legacy)
|
||||||
override val tetherType get() = TetherType.WIFI
|
override val tetherType get() = TetherType.WIFI
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class TetheringFragment : Fragment(), ServiceConnection {
|
|||||||
list.addAll(tetherManagers)
|
list.addAll(tetherManagers)
|
||||||
tetherManagers.forEach { it.updateErrorMessage(erroredIfaces) }
|
tetherManagers.forEach { it.updateErrorMessage(erroredIfaces) }
|
||||||
}
|
}
|
||||||
if (Build.VERSION.SDK_INT < 25) {
|
if (Build.VERSION.SDK_INT < 26) {
|
||||||
list.add(wifiManagerLegacy)
|
list.add(wifiManagerLegacy)
|
||||||
wifiManagerLegacy.onTetheringStarted()
|
wifiManagerLegacy.onTetheringStarted()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,12 +25,12 @@ object WifiApManager {
|
|||||||
private fun WifiManager.setWifiApEnabled(wifiConfig: WifiConfiguration?, enabled: Boolean) =
|
private fun WifiManager.setWifiApEnabled(wifiConfig: WifiConfiguration?, enabled: Boolean) =
|
||||||
setWifiApEnabled.invoke(this, wifiConfig, enabled) as Boolean
|
setWifiApEnabled.invoke(this, wifiConfig, enabled) as Boolean
|
||||||
|
|
||||||
@Deprecated("No longer usable since API 25.")
|
@Deprecated("Not usable since API 26, malfunctioning on API 25")
|
||||||
fun start(wifiConfig: WifiConfiguration? = null) {
|
fun start(wifiConfig: WifiConfiguration? = null) {
|
||||||
app.wifi.isWifiEnabled = false
|
app.wifi.isWifiEnabled = false
|
||||||
app.wifi.setWifiApEnabled(wifiConfig, true)
|
app.wifi.setWifiApEnabled(wifiConfig, true)
|
||||||
}
|
}
|
||||||
@Deprecated("No longer usable since API 25.")
|
@Deprecated("Not usable since API 26")
|
||||||
fun stop() {
|
fun stop() {
|
||||||
app.wifi.setWifiApEnabled(null, false)
|
app.wifi.setWifiApEnabled(null, false)
|
||||||
app.wifi.isWifiEnabled = true
|
app.wifi.isWifiEnabled = true
|
||||||
|
|||||||
Reference in New Issue
Block a user