Remove deprecation
This commit is contained in:
parent
71be72cd03
commit
23946f6c2a
2 changed files with 9 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
||||||
package info.nightscout.androidaps.logging
|
package info.nightscout.androidaps.logging
|
||||||
|
|
||||||
import info.nightscout.androidaps.utils.SP
|
import androidx.preference.PreferenceManager
|
||||||
|
import info.nightscout.androidaps.MainApp
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
object L {
|
object L {
|
||||||
|
@ -49,11 +50,13 @@ object L {
|
||||||
var enabled: Boolean
|
var enabled: Boolean
|
||||||
private var requiresRestart = false
|
private var requiresRestart = false
|
||||||
|
|
||||||
internal constructor(tag:LTag) {
|
internal constructor(tag: LTag) {
|
||||||
this.name = tag.tag
|
this.name = tag.tag
|
||||||
this.defaultValue = tag.defaultValue
|
this.defaultValue = tag.defaultValue
|
||||||
this.requiresRestart = tag.requiresRestart
|
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) {
|
internal constructor(defaultValue: Boolean) {
|
||||||
|
@ -66,7 +69,8 @@ object L {
|
||||||
|
|
||||||
fun enable(enabled: Boolean) {
|
fun enable(enabled: Boolean) {
|
||||||
this.enabled = enabled
|
this.enabled = enabled
|
||||||
SP.putBoolean(getSPName(), enabled)
|
@Suppress("DEPRECATION")
|
||||||
|
PreferenceManager.getDefaultSharedPreferences(MainApp.instance()).edit().putBoolean(getSPName(), enabled).apply()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun resetToDefault() {
|
fun resetToDefault() {
|
||||||
|
|
|
@ -39,6 +39,7 @@ object OKDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun runOnUiThread(theRunnable: Runnable?) {
|
fun runOnUiThread(theRunnable: Runnable?) {
|
||||||
|
@Suppress("DEPRECATION"
|
||||||
val mainHandler = Handler(MainApp.instance().applicationContext.mainLooper)
|
val mainHandler = Handler(MainApp.instance().applicationContext.mainLooper)
|
||||||
theRunnable?.let { mainHandler.post(it) }
|
theRunnable?.let { mainHandler.post(it) }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue