diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/manage/LocalOnlyHotspotManager.kt b/mobile/src/main/java/be/mygod/vpnhotspot/manage/LocalOnlyHotspotManager.kt index 148fd198..6c19c387 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/manage/LocalOnlyHotspotManager.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/manage/LocalOnlyHotspotManager.kt @@ -7,6 +7,8 @@ import android.content.ComponentName import android.content.Intent import android.content.ServiceConnection import android.content.pm.PackageManager +import android.location.LocationManager +import android.os.Build import android.os.IBinder import android.provider.Settings import android.support.v7.widget.RecyclerView @@ -46,8 +48,10 @@ class LocalOnlyHotspotManager(private val parent: TetheringFragment) : Manager() * https://android.googlesource.com/platform/frameworks/opt/net/wifi/+/53e0284/service/java/com/android/server/wifi/WifiServiceImpl.java#1204 * https://android.googlesource.com/platform/frameworks/opt/net/wifi/+/53e0284/service/java/com/android/server/wifi/WifiSettingsStore.java#228 */ - if (Settings.Secure.getInt(view.context.contentResolver, Settings.Secure.LOCATION_MODE, - Settings.Secure.LOCATION_MODE_OFF) == Settings.Secure.LOCATION_MODE_OFF) { + if (if (Build.VERSION.SDK_INT < 28) @Suppress("DEPRECATION") { + Settings.Secure.getInt(view.context.contentResolver, Settings.Secure.LOCATION_MODE, + Settings.Secure.LOCATION_MODE_OFF) == Settings.Secure.LOCATION_MODE_OFF + } else !context.getSystemService(LocationManager::class.java).isLocationEnabled) { Toast.makeText(view.context, R.string.tethering_temp_hotspot_location, Toast.LENGTH_LONG).show() try { view.context.startActivity(Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS)) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/manage/RepeaterManager.kt b/mobile/src/main/java/be/mygod/vpnhotspot/manage/RepeaterManager.kt index bd8760c5..db3c7f70 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/manage/RepeaterManager.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/manage/RepeaterManager.kt @@ -142,13 +142,11 @@ class RepeaterManager(private val parent: TetheringFragment) : Manager(), Servic (viewHolder as ViewHolder).binding.data = data } - fun update() = data.notifyChange() - override fun onServiceConnected(name: ComponentName?, service: IBinder?) { binder = service as RepeaterService.Binder service.statusChanged[this] = data::onStatusChanged service.groupChanged[this] = data::onGroupChanged - update() + data.notifyChange() } override fun onServiceDisconnected(name: ComponentName?) { diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/TetheringManager.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/TetheringManager.kt index 519e6821..2c715b6d 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/TetheringManager.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/TetheringManager.kt @@ -127,7 +127,8 @@ object TetheringManager { } fun getTetheredIfaces(extras: Bundle) = extras.getStringArrayList( - if (Build.VERSION.SDK_INT >= 26) EXTRA_ACTIVE_TETHER else EXTRA_ACTIVE_TETHER_LEGACY) + if (Build.VERSION.SDK_INT >= 26) EXTRA_ACTIVE_TETHER else EXTRA_ACTIVE_TETHER_LEGACY)!! fun getLocalOnlyTetheredIfaces(extras: Bundle) = - if (Build.VERSION.SDK_INT >= 26) extras.getStringArrayList(EXTRA_ACTIVE_LOCAL_ONLY) else emptyList() + if (Build.VERSION.SDK_INT >= 26) extras.getStringArrayList(EXTRA_ACTIVE_LOCAL_ONLY)!! + else emptyList() } diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/preference/AlwaysAutoCompleteEditTextPreferenceDialogFragmentCompat.kt b/mobile/src/main/java/be/mygod/vpnhotspot/preference/AlwaysAutoCompleteEditTextPreferenceDialogFragmentCompat.kt index d5fae19b..d7b71a58 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/preference/AlwaysAutoCompleteEditTextPreferenceDialogFragmentCompat.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/preference/AlwaysAutoCompleteEditTextPreferenceDialogFragmentCompat.kt @@ -37,7 +37,7 @@ open class AlwaysAutoCompleteEditTextPreferenceDialogFragmentCompat : Preference override fun needInputMethod(): Boolean = true - protected fun onAddEditTextToDialogView(dialogView: View, editText: EditText) { + protected open fun onAddEditTextToDialogView(dialogView: View, editText: EditText) { val oldEditText = dialogView.findViewById(android.R.id.edit) if (oldEditText != null) { val container = oldEditText.parent as? ViewGroup?