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:
2025-09-14 16:25:35 +02:00
parent 5c247f5948
commit f1f73b65f7
7 changed files with 82 additions and 29 deletions

View File

@@ -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(