Support toggling hotspots in app

This is a just-for-fun feature. It probably doesn't work.
This commit is contained in:
Mygod
2018-04-21 13:02:52 -07:00
parent 0355dae65e
commit 958b1ec350
15 changed files with 440 additions and 50 deletions

View File

@@ -5,6 +5,7 @@ import android.app.Application
import android.content.Context
import android.content.SharedPreferences
import android.content.res.Configuration
import android.net.ConnectivityManager
import android.os.Build
import android.os.Handler
import android.preference.PreferenceManager
@@ -37,6 +38,7 @@ class App : Application() {
lateinit var deviceContext: Context
val handler = Handler()
val pref: SharedPreferences by lazy { PreferenceManager.getDefaultSharedPreferences(deviceContext) }
val connectivity by lazy { getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager }
fun toast(@StringRes resId: Int) = handler.post { Toast.makeText(this, resId, Toast.LENGTH_SHORT).show() }
}