Add a lot more QS tiles

Fix #53. Also fix Bluetooth connection leaks.
This commit is contained in:
Mygod
2018-12-25 11:37:36 +08:00
parent 365287202e
commit 426b93226d
15 changed files with 481 additions and 163 deletions

View File

@@ -54,12 +54,12 @@ class LocalOnlyHotspotManager(private val parent: TetheringFragment) : Manager()
* https://android.googlesource.com/platform/frameworks/opt/net/wifi/+/53e0284/service/java/com/android/server/wifi/WifiSettingsStore.java#228
*/
if (if (Build.VERSION.SDK_INT < 28) @Suppress("DEPRECATION") {
Settings.Secure.getInt(view.context.contentResolver, Settings.Secure.LOCATION_MODE,
Settings.Secure.getInt(context.contentResolver, Settings.Secure.LOCATION_MODE,
Settings.Secure.LOCATION_MODE_OFF) == Settings.Secure.LOCATION_MODE_OFF
} else context.getSystemService<LocationManager>()?.isLocationEnabled != true) {
Toast.makeText(view.context, R.string.tethering_temp_hotspot_location, Toast.LENGTH_LONG).show()
Toast.makeText(context, R.string.tethering_temp_hotspot_location, Toast.LENGTH_LONG).show()
try {
view.context.startActivity(Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS))
context.startActivity(Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS))
} catch (e: ActivityNotFoundException) {
Timber.w(e)
}