Remove deprecation
This commit is contained in:
parent
71be72cd03
commit
23946f6c2a
|
@ -1,6 +1,7 @@
|
|||
package info.nightscout.androidaps.logging
|
||||
|
||||
import info.nightscout.androidaps.utils.SP
|
||||
import androidx.preference.PreferenceManager
|
||||
import info.nightscout.androidaps.MainApp
|
||||
import java.util.*
|
||||
|
||||
object L {
|
||||
|
@ -53,7 +54,9 @@ object L {
|
|||
this.name = tag.tag
|
||||
this.defaultValue = tag.defaultValue
|
||||
this.requiresRestart = tag.requiresRestart
|
||||
enabled = SP.getBoolean(getSPName(), defaultValue)
|
||||
//TODO: remove after getting rid of old logging style "if (L.isEnabled(...))"
|
||||
@Suppress("DEPRECATION")
|
||||
enabled = PreferenceManager.getDefaultSharedPreferences(MainApp.instance()).getBoolean(getSPName(), defaultValue)
|
||||
}
|
||||
|
||||
internal constructor(defaultValue: Boolean) {
|
||||
|
@ -66,7 +69,8 @@ object L {
|
|||
|
||||
fun enable(enabled: Boolean) {
|
||||
this.enabled = enabled
|
||||
SP.putBoolean(getSPName(), enabled)
|
||||
@Suppress("DEPRECATION")
|
||||
PreferenceManager.getDefaultSharedPreferences(MainApp.instance()).edit().putBoolean(getSPName(), enabled).apply()
|
||||
}
|
||||
|
||||
fun resetToDefault() {
|
||||
|
|
|
@ -39,6 +39,7 @@ object OKDialog {
|
|||
}
|
||||
|
||||
fun runOnUiThread(theRunnable: Runnable?) {
|
||||
@Suppress("DEPRECATION"
|
||||
val mainHandler = Handler(MainApp.instance().applicationContext.mainLooper)
|
||||
theRunnable?.let { mainHandler.post(it) }
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue