add setting to disable breastfeeding buttons
Some women do not breastfeed. Hide the buttons in order to have more space for log messages.
This commit is contained in:
@@ -3,6 +3,7 @@ package it.danieleverducci.lunatracker.repository
|
||||
import android.content.Context
|
||||
import android.content.Context.MODE_PRIVATE
|
||||
import android.content.SharedPreferences
|
||||
import androidx.core.content.edit
|
||||
|
||||
class LocalSettingsRepository(val context: Context) {
|
||||
companion object {
|
||||
@@ -12,6 +13,7 @@ class LocalSettingsRepository(val context: Context) {
|
||||
val SHARED_PREFS_DAV_URL = "webdav_url"
|
||||
val SHARED_PREFS_DAV_USER = "webdav_user"
|
||||
val SHARED_PREFS_DAV_PASS = "webdav_password"
|
||||
val SHARED_PREFS_NO_BREASTFEEDING = "no_breastfeeding"
|
||||
}
|
||||
enum class DATA_REPO {LOCAL_FILE, WEBDAV}
|
||||
val sharedPreferences: SharedPreferences
|
||||
@@ -28,6 +30,14 @@ class LocalSettingsRepository(val context: Context) {
|
||||
return sharedPreferences.getInt(SHARED_PREFS_BB_CONTENT, 1)
|
||||
}
|
||||
|
||||
fun saveNoBreastfeeding(content: Boolean) {
|
||||
sharedPreferences.edit().putBoolean(SHARED_PREFS_NO_BREASTFEEDING, content).apply()
|
||||
}
|
||||
|
||||
fun loadNoBreastfeeding(): Boolean {
|
||||
return sharedPreferences.getBoolean(SHARED_PREFS_NO_BREASTFEEDING, false)
|
||||
}
|
||||
|
||||
fun saveDataRepository(repo: DATA_REPO) {
|
||||
val spe = sharedPreferences.edit()
|
||||
spe.putString(
|
||||
|
||||
Reference in New Issue
Block a user