From e8480176c3956584dc9091bbebe52fb725ac6e10 Mon Sep 17 00:00:00 2001 From: Moritz Warning Date: Thu, 11 Dec 2025 22:57:08 +0100 Subject: [PATCH] MainAcitivty: add dynamic header setting The setting allows to build the menu and popup list to be populated by the frequency of events that has been created. This also makes the 'no breastfeeding' setting irrelevant. --- .../lunatracker/MainActivity.kt | 183 ++++++++++++------ .../lunatracker/SettingsActivity.kt | 11 +- .../lunatracker/entities/LunaEvent.kt | 159 ++++++++------- .../repository/LocalSettingsRepository.kt | 10 +- app/src/main/res/layout/activity_main.xml | 101 +++++----- app/src/main/res/layout/activity_settings.xml | 12 +- app/src/main/res/layout/more_events_popup.xml | 93 +-------- .../res/layout/more_events_popup_item.xml | 11 ++ app/src/main/res/values-de/strings.xml | 8 - app/src/main/res/values-fr/strings.xml | 7 - app/src/main/res/values-it/strings.xml | 7 - app/src/main/res/values/strings.xml | 57 +++--- 12 files changed, 327 insertions(+), 332 deletions(-) create mode 100644 app/src/main/res/layout/more_events_popup_item.xml diff --git a/app/src/main/java/it/danieleverducci/lunatracker/MainActivity.kt b/app/src/main/java/it/danieleverducci/lunatracker/MainActivity.kt index e6fd89f..9b46ce6 100644 --- a/app/src/main/java/it/danieleverducci/lunatracker/MainActivity.kt +++ b/app/src/main/java/it/danieleverducci/lunatracker/MainActivity.kt @@ -15,6 +15,7 @@ import android.widget.AdapterView import android.widget.ArrayAdapter import android.widget.Button import android.widget.EditText +import android.widget.LinearLayout import android.widget.NumberPicker import android.widget.PopupWindow import android.widget.Spinner @@ -53,6 +54,7 @@ class MainActivity : AppCompatActivity() { const val DEBUG_CHECK_LOGBOOK_CONSISTENCY = false // list of all events var allEvents = arrayListOf() + var currentPopupItems = listOf() } var logbook: Logbook? = null @@ -84,31 +86,13 @@ class MainActivity : AppCompatActivity() { recyclerView = findViewById(R.id.list_events) recyclerView.setLayoutManager(LinearLayoutManager(applicationContext)) + populateHeaderMenu() + // Set listeners findViewById(R.id.logbooks_add_button).setOnClickListener { showAddLogbookDialog(true) } - findViewById(R.id.button_bottle).setOnClickListener { - addBabyBottleEvent(LunaEvent(LunaEvent.TYPE_BABY_BOTTLE)) - } - findViewById(R.id.button_food).setOnClickListener { - addNoteEvent(LunaEvent(LunaEvent.TYPE_FOOD)) - } - findViewById(R.id.button_nipple_left).setOnClickListener { - addPlainEvent(LunaEvent(LunaEvent.TYPE_BREASTFEEDING_LEFT_NIPPLE)) - } - findViewById(R.id.button_nipple_both).setOnClickListener { - addPlainEvent(LunaEvent(LunaEvent.TYPE_BREASTFEEDING_BOTH_NIPPLE)) - } - findViewById(R.id.button_nipple_right).setOnClickListener { - addPlainEvent(LunaEvent(LunaEvent.TYPE_BREASTFEEDING_RIGHT_NIPPLE)) - } - findViewById(R.id.button_change_poo).setOnClickListener { - addAmountEvent(LunaEvent(LunaEvent.TYPE_DIAPERCHANGE_POO)) - } - findViewById(R.id.button_change_pee).setOnClickListener { - addAmountEvent(LunaEvent(LunaEvent.TYPE_DIAPERCHANGE_PEE)) - } + val moreButton = findViewById(R.id.button_more) moreButton.setOnClickListener { showOverflowPopupWindow(moreButton) @@ -150,6 +134,82 @@ class MainActivity : AppCompatActivity() { allEvents = logbook?.logs ?: arrayListOf() setListAdapter(allEvents) + + populateHeaderMenu() + } + + private fun populateHeaderMenu() { + val settingsRepository = LocalSettingsRepository(this) + val dynamicMenu = settingsRepository.loadDynamicMenu() + val eventTypeStats = mutableMapOf() + + if (dynamicMenu) { + val sampleSize = 100 + // populate frequency map from first 100 events + allEvents.take(sampleSize.coerceAtMost(allEvents.size)).forEach { + eventTypeStats[it.type] = 1 + (eventTypeStats[it.type] ?: 0) + } + } + + // sort all event types by frequency or ordinal + val eventTypesSorted = LunaEvent.Type.entries.toList().sortedWith( + compareBy({ -1 * (eventTypeStats[it] ?: 0) }, { it.ordinal }) + ).filter { it != LunaEvent.Type.UNKNOWN } + + fun setupMenu(maxButtonCount: Int, sortedEventTypes: List): Int { + val row1 = findViewById(R.id.linear_layout_row1) + val row1Button1 = findViewById(R.id.button1_row1) + val row1Button2 = findViewById(R.id.button2_row1) + + val row2 = findViewById(R.id.linear_layout_row2) + val row2Button1 = findViewById(R.id.button1_row2) + val row2Button2 = findViewById(R.id.button2_row2) + val row2Button3 = findViewById(R.id.button3_row2) + + val row3 = findViewById(R.id.linear_layout_row3) + val row3Button1 = findViewById(R.id.button1_row3) + val row3Button2 = findViewById(R.id.button2_row3) + + // hide all rows/buttons (except row 3) + for (view in listOf(row1, row1Button1, row1Button2, + row2, row2Button1, row2Button2, row2Button3, + row3, row3Button1, row3Button2)) { + view.visibility = View.GONE + } + row3.visibility = View.VISIBLE + + var showCounter = 0 + + fun show(vararg tvs: TextView) { + for (tv in tvs) { + val type = sortedEventTypes[showCounter] + tv.text = LunaEvent.getTypeEmoji(applicationContext, type) + tv.setOnClickListener { showCreateDialog(type) } + tv.visibility = View.VISIBLE + // show parent row + (tv.parent as View).visibility = View.VISIBLE + showCounter += 1 + } + } + + when (maxButtonCount) { + 0 -> { } // ignore - show empty row3 + 1 -> show(row3Button1) + 2 -> show(row3Button1, row3Button2) + 3 -> show(row1Button1, row3Button1) + 4, 5, 6 -> show(row1Button1, row1Button2, row3Button1, row3Button2) + else -> show(row1Button1, row1Button2, row2Button1, row2Button2, row2Button3, row3Button1, row3Button2) + } + + return showCounter + } + + val usedEventCount = eventTypeStats.count { it.value > 0 } + val maxButtonCount = if (dynamicMenu) { usedEventCount } else { 7 } + val eventsShown = setupMenu(maxButtonCount, eventTypesSorted) + + // store left over events for popup menu + currentPopupItems = eventTypesSorted.subList(eventsShown, eventTypesSorted.size) } override fun onStart() { @@ -172,12 +232,6 @@ class MainActivity : AppCompatActivity() { signature = settingsRepository.loadSignature() - val noBreastfeeding = settingsRepository.loadNoBreastfeeding() - findViewById(R.id.layout_nipples).visibility = when (noBreastfeeding) { - true -> View.GONE - false -> View.VISIBLE - } - // Update list dates recyclerView.adapter?.notifyDataSetChanged() @@ -1188,6 +1242,29 @@ class MainActivity : AppCompatActivity() { } } + private fun showCreateDialog(type: LunaEvent.Type) { + val event = LunaEvent(type) + when (type) { + LunaEvent.Type.BABY_BOTTLE -> addBabyBottleEvent(event) + LunaEvent.Type.WEIGHT -> addWeightEvent(event) + LunaEvent.Type.BREASTFEEDING_LEFT_NIPPLE -> addPlainEvent(event) + LunaEvent.Type.BREASTFEEDING_BOTH_NIPPLE -> addPlainEvent(event) + LunaEvent.Type.BREASTFEEDING_RIGHT_NIPPLE -> addPlainEvent(event) + LunaEvent.Type.DIAPERCHANGE_POO -> addAmountEvent(event) + LunaEvent.Type.DIAPERCHANGE_PEE -> addAmountEvent(event) + LunaEvent.Type.MEDICINE -> addNoteEvent(event) + LunaEvent.Type.ENEMA -> addNoteEvent(event) + LunaEvent.Type.NOTE -> addNoteEvent(event) + LunaEvent.Type.COLIC -> addPlainEvent(event) + LunaEvent.Type.TEMPERATURE -> addTemperatureEvent(event) + LunaEvent.Type.FOOD -> addNoteEvent(event) + LunaEvent.Type.PUKE -> addAmountEvent(event) + LunaEvent.Type.BATH -> addPlainEvent(event) + LunaEvent.Type.SLEEP -> addSleepEvent(event) + LunaEvent.Type.UNKNOWN -> {} // ignore + } + } + private fun showOverflowPopupWindow(anchor: View) { if (showingOverflowPopupWindow) return @@ -1196,42 +1273,8 @@ class MainActivity : AppCompatActivity() { isOutsideTouchable = true val inflater = LayoutInflater.from(anchor.context) contentView = inflater.inflate(R.layout.more_events_popup, null) - contentView.findViewById(R.id.button_medicine).setOnClickListener { - addNoteEvent(LunaEvent(LunaEvent.TYPE_MEDICINE)) - dismiss() - } - contentView.findViewById(R.id.button_enema).setOnClickListener { - addPlainEvent(LunaEvent(LunaEvent.TYPE_ENEMA)) - dismiss() - } - contentView.findViewById(R.id.button_note).setOnClickListener { - addNoteEvent(LunaEvent(LunaEvent.TYPE_NOTE)) - dismiss() - } - contentView.findViewById(R.id.button_temperature).setOnClickListener { - addTemperatureEvent(LunaEvent(LunaEvent.TYPE_TEMPERATURE)) - dismiss() - } - contentView.findViewById(R.id.button_puke).setOnClickListener { - addAmountEvent(LunaEvent(LunaEvent.TYPE_PUKE)) - dismiss() - } - contentView.findViewById(R.id.button_sleep).setOnClickListener { - addSleepEvent(LunaEvent(LunaEvent.TYPE_SLEEP)) - dismiss() - } - contentView.findViewById(R.id.button_colic).setOnClickListener { - addPlainEvent(LunaEvent(LunaEvent.TYPE_COLIC)) - dismiss() - } - contentView.findViewById(R.id.button_scale).setOnClickListener { - addWeightEvent(LunaEvent(LunaEvent.TYPE_WEIGHT)) - dismiss() - } - contentView.findViewById(R.id.button_bath).setOnClickListener { - addPlainEvent(LunaEvent(LunaEvent.TYPE_BATH)) - dismiss() - } + + // Add statistics (hard coded) contentView.findViewById(R.id.button_statistics).setOnClickListener { if (logbook != null && !pauseLogbookUpdate) { val i = Intent(applicationContext, StatisticsActivity::class.java) @@ -1242,6 +1285,20 @@ class MainActivity : AppCompatActivity() { } dismiss() } + + val linearLayout = contentView.findViewById(R.id.layout_list) + + // Add buttons to create other events + for (type in currentPopupItems) { + val view = layoutInflater.inflate(R.layout.more_events_popup_item, linearLayout, false) + val textView = view.findViewById(R.id.tv) + textView.text = LunaEvent.getPopupItemTitle(applicationContext, type) + textView.setOnClickListener { + showCreateDialog(type) + dismiss() + } + linearLayout.addView(textView) + } }.also { popupWindow -> popupWindow.setOnDismissListener({ Handler(mainLooper).postDelayed({ diff --git a/app/src/main/java/it/danieleverducci/lunatracker/SettingsActivity.kt b/app/src/main/java/it/danieleverducci/lunatracker/SettingsActivity.kt index 8006986..cdcc3ee 100644 --- a/app/src/main/java/it/danieleverducci/lunatracker/SettingsActivity.kt +++ b/app/src/main/java/it/danieleverducci/lunatracker/SettingsActivity.kt @@ -4,6 +4,7 @@ import android.os.Bundle import android.view.View import android.widget.EditText import android.widget.RadioButton +import android.widget.Spinner import android.widget.TextView import android.widget.Toast import androidx.appcompat.app.AppCompatActivity @@ -24,7 +25,7 @@ open class SettingsActivity : AppCompatActivity() { protected lateinit var textViewWebDAVUser: TextView protected lateinit var textViewWebDAVPass: TextView protected lateinit var progressIndicator: LinearProgressIndicator - protected lateinit var switchNoBreastfeeding: SwitchMaterial + protected lateinit var switchDynamicMenu: SwitchMaterial protected lateinit var textViewSignature: EditText override fun onCreate(savedInstanceState: Bundle?) { @@ -37,7 +38,7 @@ open class SettingsActivity : AppCompatActivity() { textViewWebDAVUser = findViewById(R.id.settings_data_webdav_user) textViewWebDAVPass = findViewById(R.id.settings_data_webdav_pass) progressIndicator = findViewById(R.id.progress_indicator) - switchNoBreastfeeding = findViewById(R.id.switch_no_breastfeeding) + switchDynamicMenu = findViewById(R.id.switch_dynamic_menu) textViewSignature = findViewById(R.id.settings_signature) findViewById(R.id.settings_save).setOnClickListener({ @@ -54,7 +55,7 @@ open class SettingsActivity : AppCompatActivity() { fun loadSettings() { val dataRepo = settingsRepository.loadDataRepository() val webDavCredentials = settingsRepository.loadWebdavCredentials() - val noBreastfeeding = settingsRepository.loadNoBreastfeeding() + val dynamicMenu = settingsRepository.loadDynamicMenu() val signature = settingsRepository.loadSignature() when (dataRepo) { @@ -63,7 +64,7 @@ open class SettingsActivity : AppCompatActivity() { } textViewSignature.setText(signature) - switchNoBreastfeeding.isChecked = noBreastfeeding + switchDynamicMenu.isChecked = dynamicMenu if (webDavCredentials != null) { textViewWebDAVUrl.text = webDavCredentials[0] @@ -160,7 +161,7 @@ open class SettingsActivity : AppCompatActivity() { if (radioDataWebDAV.isChecked) LocalSettingsRepository.DATA_REPO.WEBDAV else LocalSettingsRepository.DATA_REPO.LOCAL_FILE ) - settingsRepository.saveNoBreastfeeding(switchNoBreastfeeding.isChecked) + settingsRepository.saveDynamicMenu(switchDynamicMenu.isChecked) settingsRepository.saveSignature(textViewSignature.text.toString()) settingsRepository.saveWebdavCredentials( textViewWebDAVUrl.text.toString(), diff --git a/app/src/main/java/it/danieleverducci/lunatracker/entities/LunaEvent.kt b/app/src/main/java/it/danieleverducci/lunatracker/entities/LunaEvent.kt index 2c0a1b3..b96bc9d 100644 --- a/app/src/main/java/it/danieleverducci/lunatracker/entities/LunaEvent.kt +++ b/app/src/main/java/it/danieleverducci/lunatracker/entities/LunaEvent.kt @@ -33,56 +33,6 @@ class LunaEvent: Comparable { UNKNOWN } - companion object { - fun getTypeEmoji(context: Context, type: Type): String { - return context.getString( - when (type) { - Type.BABY_BOTTLE -> R.string.event_bottle_type - Type.WEIGHT -> R.string.event_weight_type - Type.BREASTFEEDING_LEFT_NIPPLE -> R.string.event_breastfeeding_left_type - Type.BREASTFEEDING_BOTH_NIPPLE -> R.string.event_breastfeeding_both_type - Type.BREASTFEEDING_RIGHT_NIPPLE -> R.string.event_breastfeeding_right_type - Type.DIAPERCHANGE_POO -> R.string.event_diaperchange_poo_type - Type.DIAPERCHANGE_PEE -> R.string.event_diaperchange_pee_type - Type.MEDICINE -> R.string.event_medicine_type - Type.ENEMA -> R.string.event_enema_type - Type.NOTE -> R.string.event_note_type - Type.TEMPERATURE -> R.string.event_temperature_type - Type.COLIC -> R.string.event_colic_type - Type.FOOD -> R.string.event_food_type - Type.PUKE -> R.string.event_puke_type - Type.BATH -> R.string.event_bath_type - Type.SLEEP -> R.string.event_sleep_type - Type.UNKNOWN -> R.string.event_unknown_type - } - ) - } - - fun getTypeDescription(context: Context, type: Type): String { - return context.getString( - when (type) { - Type.BABY_BOTTLE -> R.string.event_bottle_desc - Type.WEIGHT -> R.string.event_weight_desc - Type.BREASTFEEDING_LEFT_NIPPLE -> R.string.event_breastfeeding_left_desc - Type.BREASTFEEDING_BOTH_NIPPLE -> R.string.event_breastfeeding_both_desc - Type.BREASTFEEDING_RIGHT_NIPPLE -> R.string.event_breastfeeding_right_desc - Type.DIAPERCHANGE_POO -> R.string.event_diaperchange_poo_desc - Type.DIAPERCHANGE_PEE -> R.string.event_diaperchange_pee_desc - Type.MEDICINE -> R.string.event_medicine_desc - Type.ENEMA -> R.string.event_enema_desc - Type.NOTE -> R.string.event_note_desc - Type.TEMPERATURE -> R.string.event_temperature_desc - Type.COLIC -> R.string.event_colic_desc - Type.FOOD -> R.string.event_food_desc - Type.PUKE -> R.string.event_puke_desc - Type.BATH -> R.string.event_bath_desc - Type.SLEEP -> R.string.event_sleep_desc - Type.UNKNOWN -> R.string.event_unknown_desc - } - ) - } - } - private val jo: JSONObject var time: Long // In unix time (seconds since 1970) @@ -170,20 +120,8 @@ class LunaEvent: Comparable { return getTypeDescription(context, type) } - fun getDialogMessage(context: Context): String? { - return context.getString( - when(type) { - Type.BABY_BOTTLE -> R.string.log_bottle_dialog_description - Type.MEDICINE -> R.string.log_medicine_dialog_description - Type.TEMPERATURE -> R.string.log_temperature_dialog_description - Type.DIAPERCHANGE_POO, - Type.DIAPERCHANGE_PEE, - Type.PUKE -> R.string.log_amount_dialog_description - Type.WEIGHT -> R.string.log_weight_dialog_description - Type.SLEEP -> R.string.log_sleep_dialog_description - else -> R.string.log_unknown_dialog_description - } - ) + fun getDialogMessage(context: Context): String { + return getDialogMessage(context, type) } fun toJson(): JSONObject { @@ -197,4 +135,95 @@ class LunaEvent: Comparable { override fun compareTo(other: LunaEvent): Int { return (this.time - other.time).toInt() } -} \ No newline at end of file + + companion object { + fun getTypeEmoji(context: Context, type: Type): String { + return context.getString( + when (type) { + Type.BABY_BOTTLE -> R.string.event_bottle_type + Type.WEIGHT -> R.string.event_weight_type + Type.BREASTFEEDING_LEFT_NIPPLE -> R.string.event_breastfeeding_left_type + Type.BREASTFEEDING_BOTH_NIPPLE -> R.string.event_breastfeeding_both_type + Type.BREASTFEEDING_RIGHT_NIPPLE -> R.string.event_breastfeeding_right_type + Type.DIAPERCHANGE_POO -> R.string.event_diaperchange_poo_type + Type.DIAPERCHANGE_PEE -> R.string.event_diaperchange_pee_type + Type.MEDICINE -> R.string.event_medicine_type + Type.ENEMA -> R.string.event_enema_type + Type.NOTE -> R.string.event_note_type + Type.TEMPERATURE -> R.string.event_temperature_type + Type.COLIC -> R.string.event_colic_type + Type.FOOD -> R.string.event_food_type + Type.PUKE -> R.string.event_puke_type + Type.BATH -> R.string.event_bath_type + Type.SLEEP -> R.string.event_sleep_type + Type.UNKNOWN -> R.string.event_unknown_type + } + ) + } + + fun getDialogMessage(context: Context, type: Type): String { + return context.getString( + when (type) { + Type.BABY_BOTTLE -> R.string.log_bottle_dialog_description + Type.MEDICINE -> R.string.log_medicine_dialog_description + Type.TEMPERATURE -> R.string.log_temperature_dialog_description + Type.DIAPERCHANGE_POO, + Type.DIAPERCHANGE_PEE, + Type.PUKE -> R.string.log_amount_dialog_description + Type.WEIGHT -> R.string.log_weight_dialog_description + Type.SLEEP -> R.string.log_sleep_dialog_description + else -> R.string.log_unknown_dialog_description + } + ) + } + + fun getTypeDescription(context: Context, type: Type): String { + return context.getString( + when (type) { + Type.BABY_BOTTLE -> R.string.event_bottle_desc + Type.WEIGHT -> R.string.event_weight_desc + Type.BREASTFEEDING_LEFT_NIPPLE -> R.string.event_breastfeeding_left_desc + Type.BREASTFEEDING_BOTH_NIPPLE -> R.string.event_breastfeeding_both_desc + Type.BREASTFEEDING_RIGHT_NIPPLE -> R.string.event_breastfeeding_right_desc + Type.DIAPERCHANGE_POO -> R.string.event_diaperchange_poo_desc + Type.DIAPERCHANGE_PEE -> R.string.event_diaperchange_pee_desc + Type.MEDICINE -> R.string.event_medicine_desc + Type.ENEMA -> R.string.event_enema_desc + Type.NOTE -> R.string.event_note_desc + Type.TEMPERATURE -> R.string.event_temperature_desc + Type.COLIC -> R.string.event_colic_desc + Type.FOOD -> R.string.event_food_desc + Type.PUKE -> R.string.event_puke_desc + Type.BATH -> R.string.event_bath_desc + Type.SLEEP -> R.string.event_sleep_desc + Type.UNKNOWN -> R.string.event_unknown_desc + } + ) + } + + // Entries for for popup list + fun getPopupItemTitle(context: Context, type: Type): String { + return context.getString( + when (type) { + Type.BABY_BOTTLE -> R.string.event_type_item_bottle + Type.WEIGHT -> R.string.event_type_item_weight + Type.BREASTFEEDING_LEFT_NIPPLE -> R.string.event_type_item_breastfeeding_left + Type.BREASTFEEDING_BOTH_NIPPLE -> R.string.event_type_item_breastfeeding_both + Type.BREASTFEEDING_RIGHT_NIPPLE -> R.string.event_type_item_breastfeeding_right + Type.DIAPERCHANGE_POO -> R.string.event_type_item_diaperchange_poo + Type.DIAPERCHANGE_PEE -> R.string.event_type_item_diaperchange_pee + Type.MEDICINE -> R.string.event_type_item_medicine + Type.ENEMA -> R.string.event_type_item_enema + Type.NOTE -> R.string.event_type_item_note + Type.TEMPERATURE -> R.string.event_type_item_temperature + Type.COLIC -> R.string.event_type_item_colic + Type.FOOD -> R.string.event_type_item_food + Type.PUKE -> R.string.event_type_item_puke + Type.BATH -> R.string.event_type_item_bath + Type.SLEEP -> R.string.event_type_item_sleep + Type.UNKNOWN -> R.string.event_type_item_unknown + } + ) + } + } +} diff --git a/app/src/main/java/it/danieleverducci/lunatracker/repository/LocalSettingsRepository.kt b/app/src/main/java/it/danieleverducci/lunatracker/repository/LocalSettingsRepository.kt index 9431194..59e61e9 100644 --- a/app/src/main/java/it/danieleverducci/lunatracker/repository/LocalSettingsRepository.kt +++ b/app/src/main/java/it/danieleverducci/lunatracker/repository/LocalSettingsRepository.kt @@ -13,7 +13,7 @@ class LocalSettingsRepository(val context: Context) { const val SHARED_PREFS_DAV_URL = "webdav_url" const val SHARED_PREFS_DAV_USER = "webdav_user" const val SHARED_PREFS_DAV_PASS = "webdav_password" - const val SHARED_PREFS_NO_BREASTFEEDING = "no_breastfeeding" + const val SHARED_PREFS_DYNAMIC_MENU = "dynamic_menu" const val SHARED_PREFS_SIGNATURE = "signature" } enum class DATA_REPO {LOCAL_FILE, WEBDAV} @@ -31,12 +31,12 @@ class LocalSettingsRepository(val context: Context) { return sharedPreferences.getString(SHARED_PREFS_SIGNATURE, "") ?: "" } - fun saveNoBreastfeeding(content: Boolean) { - sharedPreferences.edit { putBoolean(SHARED_PREFS_NO_BREASTFEEDING, content) } + fun saveDynamicMenu(content: Boolean) { + sharedPreferences.edit { putBoolean(SHARED_PREFS_DYNAMIC_MENU, content) } } - fun loadNoBreastfeeding(): Boolean { - return sharedPreferences.getBoolean(SHARED_PREFS_NO_BREASTFEEDING, false) + fun loadDynamicMenu(): Boolean { + return sharedPreferences.getBoolean(SHARED_PREFS_DYNAMIC_MENU, false) } fun saveDataRepository(repo: DATA_REPO) { diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index a04a510..3fd98fe 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -86,15 +86,16 @@ android:orientation="vertical"> - - - - - - - - - - + android:textSize="30sp"/> + + + + + + + + + android:textSize="30sp"/> + + @@ -149,13 +149,13 @@ + android:text="@string/settings_dynamic_menu" /> + android:text="@string/settings_dynamic_menu_desc"/> @@ -14,102 +15,12 @@ android:id="@+id/button_statistics" android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_marginTop="10dp" android:padding="10dp" android:background="@drawable/dropdown_list_item_background" style="@style/OverflowMenuText" android:text="📊 Statistics"/> - - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/app/src/main/res/layout/more_events_popup_item.xml b/app/src/main/res/layout/more_events_popup_item.xml new file mode 100644 index 0000000..2468dda --- /dev/null +++ b/app/src/main/res/layout/more_events_popup_item.xml @@ -0,0 +1,11 @@ + + diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index b7ddd7d..f1564e8 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -18,13 +18,6 @@ Blähungskolik - ⚖️ Gewicht - 💊 Medikament - 🪠 Einlauf - 📝 Notiz - 🌡️ Temperatur - 💨 Blähungskolik - Ereignis gespeichert Logbuch gespeichert Ereignis konnte nicht protokolliert werden @@ -42,7 +35,6 @@ Erneut versuchen Einstellungen - Kein Stillen Speicherort für Daten auswählen Auf dem Gerät Datenschutzfreundlichste Lösung: Deine Daten verlassen dein Gerät nicht diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 9364887..87cb8af 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -18,13 +18,6 @@ Colique gazeuse - ⚖️ Poids - 💊 Médicament - 🪠 Lavement - 📝 Note - 🌡️ Température - 💨 Colique gazeuse - Entrée ajoutée Journal ajouté Impossible d\'enregistrer cette entrée diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 3e1fdd2..76cc78e 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -3,13 +3,6 @@ 🌜 LunaTracker 🌛 Diario di bordo - ⚖️ Peso - 💊 Medicina - 🪠 Clistere - 📝 Nota - 🌡️ Temperatura - 💨 Colichette - Biberon Cibo Pesata diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index bbeac28..e0c81b7 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -3,12 +3,13 @@ 🌜 LunaTracker 🌛 Logged events + 🍼 🥣 ⚖️ - 🤱 ← - 🤱 ↔ - 🤱 → + 🤱⬅️ + 🤱↔️ + 🤱➡️️ 🚼 💩 🚼 💧 💊 @@ -19,16 +20,36 @@ 🤮 🛁 💤 - \? + - Baby bottle + + 🍼 Bottle + 🥣 Food + ⚖️ Weight + 🤱⬅️ Nursing + 🤱↔️ Nursing + 🤱➡️️ Nursing + 🚼💩 Diaper + 🚼💧 Diaper + 💊 Medicine + 🪠 Enema + 📝 Note + 🌡️ Temperature + 💨 Colic + 🤮 Puke + 💤 Sleep + 🛁 Bath + ❓ Unknown + + + Milk Bottle Food Weight - Breastfeeding (left) - Breastfeeding - Breastfeeding (right) - Diaper chg (poo) - Diaper chg (pee) + Nursing (left) + Nursing (both) + Nursing (right) + Diaper Change (poo) + Diaper Change (pee) Medicine Enema Note @@ -37,17 +58,7 @@ Puke Bath Sleep - - - ⚖️ Weight - 💊 Medicine - 🪠 Enema - 📝 Note - 🌡️ Temperature - 💨 Gaseous colic - 🤮 Puke - 💤 Sleep - 🛁 Bath + Unknown Event logged Logbook saved @@ -79,6 +90,8 @@ Statistics + Dynamic Menu + Populate the header menu with the most used events. Settings Signature Attach a signature to each event you create and for others to see. Useful if multiple people add events. @@ -97,8 +110,6 @@ Error while trying to access WebDAV: Unable to save a file on the WebDAV server: Successfully connected with the WebDAV server - No Breastfeeding - Hide the Breastfeeding buttons for when they are not needed. There\'s a save file on the server, but it is corrupted or unreadable. Please delete it Error: Error while uploading local logbook %1$s to webdav: %2$s