Merge branch 'master' into develop

This commit is contained in:
Daniele Verducci 2025-04-19 08:53:43 +02:00
commit 4c5c7bcf1a
8 changed files with 38 additions and 11 deletions

View File

@ -12,8 +12,8 @@ android {
applicationId = "it.danieleverducci.lunatracker" applicationId = "it.danieleverducci.lunatracker"
minSdk = 21 minSdk = 21
targetSdk = 34 targetSdk = 34
versionCode = 2 versionCode = 3
versionName = "0.3" versionName = "0.5"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
} }

View File

@ -90,7 +90,7 @@ class MainActivity : AppCompatActivity() {
// Set listeners // Set listeners
findViewById<View>(R.id.logbooks_add_button).setOnClickListener { showAddLogbookDialog(true) } findViewById<View>(R.id.logbooks_add_button).setOnClickListener { showAddLogbookDialog(true) }
findViewById<View>(R.id.button_bottle).setOnClickListener { askBabyBottleContent() } findViewById<View>(R.id.button_bottle).setOnClickListener { askBabyBottleContent() }
findViewById<View>(R.id.button_scale).setOnClickListener { askWeightValue() } findViewById<View>(R.id.button_food).setOnClickListener { askNotes(LunaEvent(LunaEvent.TYPE_FOOD)) }
findViewById<View>(R.id.button_nipple_left).setOnClickListener { logEvent( findViewById<View>(R.id.button_nipple_left).setOnClickListener { logEvent(
LunaEvent( LunaEvent(
LunaEvent.TYPE_BREASTFEEDING_LEFT_NIPPLE LunaEvent.TYPE_BREASTFEEDING_LEFT_NIPPLE
@ -257,12 +257,7 @@ class MainActivity : AppCompatActivity() {
val d = AlertDialog.Builder(this) val d = AlertDialog.Builder(this)
val dialogView = layoutInflater.inflate(R.layout.dialog_notes, null) val dialogView = layoutInflater.inflate(R.layout.dialog_notes, null)
d.setTitle(lunaEvent.getTypeDescription(this)) d.setTitle(lunaEvent.getTypeDescription(this))
d.setMessage( d.setMessage(lunaEvent.getDialogMessage(this))
when (lunaEvent.type){
LunaEvent.TYPE_MEDICINE -> R.string.log_medicine_dialog_description
else -> R.string.log_notes_dialog_description
}
)
d.setView(dialogView) d.setView(dialogView)
val notesET = dialogView.findViewById<EditText>(R.id.notes_edittext) val notesET = dialogView.findViewById<EditText>(R.id.notes_edittext)
val qtyET = dialogView.findViewById<EditText>(R.id.notes_qty_edittext) val qtyET = dialogView.findViewById<EditText>(R.id.notes_qty_edittext)
@ -732,6 +727,10 @@ class MainActivity : AppCompatActivity() {
) )
dismiss() dismiss()
}) })
contentView.findViewById<View>(R.id.button_scale).setOnClickListener({
askWeightValue()
dismiss()
})
}.also { popupWindow -> }.also { popupWindow ->
popupWindow.setOnDismissListener({ popupWindow.setOnDismissListener({
Handler(mainLooper).postDelayed({ Handler(mainLooper).postDelayed({

View File

@ -27,6 +27,7 @@ class LunaEvent {
val TYPE_CUSTOM = "CUSTOM" val TYPE_CUSTOM = "CUSTOM"
val TYPE_COLIC = "COLIC" val TYPE_COLIC = "COLIC"
val TYPE_TEMPERATURE = "TEMPERATURE" val TYPE_TEMPERATURE = "TEMPERATURE"
val TYPE_FOOD = "FOOD"
} }
private val jo: JSONObject private val jo: JSONObject
@ -88,6 +89,7 @@ class LunaEvent {
TYPE_NOTE -> R.string.event_note_type TYPE_NOTE -> R.string.event_note_type
TYPE_TEMPERATURE -> R.string.event_temperature_type TYPE_TEMPERATURE -> R.string.event_temperature_type
TYPE_COLIC -> R.string.event_colic_type TYPE_COLIC -> R.string.event_colic_type
TYPE_FOOD -> R.string.event_food_type
else -> R.string.event_unknown_type else -> R.string.event_unknown_type
} }
) )
@ -108,11 +110,19 @@ class LunaEvent {
TYPE_NOTE -> R.string.event_note_desc TYPE_NOTE -> R.string.event_note_desc
TYPE_TEMPERATURE -> R.string.event_temperature_desc TYPE_TEMPERATURE -> R.string.event_temperature_desc
TYPE_COLIC -> R.string.event_colic_desc TYPE_COLIC -> R.string.event_colic_desc
TYPE_FOOD -> R.string.event_food_desc
else -> R.string.event_unknown_desc else -> R.string.event_unknown_desc
} }
) )
} }
fun getDialogMessage(context: Context): String? {
return when(type) {
TYPE_MEDICINE -> context.getString(R.string.log_medicine_dialog_description)
else -> null
}
}
fun toJson(): JSONObject { fun toJson(): JSONObject {
return jo return jo
} }

View File

@ -108,7 +108,7 @@
android:text="@string/event_bottle_type"/> android:text="@string/event_bottle_type"/>
<TextView <TextView
android:id="@+id/button_scale" android:id="@+id/button_food"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
@ -116,7 +116,7 @@
android:background="@drawable/button_background" android:background="@drawable/button_background"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:textSize="50dp" android:textSize="50dp"
android:text="@string/event_scale_type"/> android:text="@string/event_food_type"/>
</LinearLayout> </LinearLayout>

View File

@ -59,6 +59,16 @@
style="@style/OverflowMenuText" style="@style/OverflowMenuText"
android:text="@string/overflow_event_colic"/> android:text="@string/overflow_event_colic"/>
<TextView
android:id="@+id/button_scale"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:padding="20dp"
android:background="@drawable/dropdown_list_item_background"
style="@style/OverflowMenuText"
android:text="@string/overflow_event_scale"/>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>

View File

@ -13,6 +13,7 @@
<string name="log_temperature_dialog_title">Temperatura</string> <string name="log_temperature_dialog_title">Temperatura</string>
<string name="log_temperature_dialog_description">Inserisci la temperatura</string> <string name="log_temperature_dialog_description">Inserisci la temperatura</string>
<string name="overflow_event_scale">⚖️ Peso</string>
<string name="overflow_event_medicine">💊 Medicina</string> <string name="overflow_event_medicine">💊 Medicina</string>
<string name="overflow_event_enema">🪠 Clistere</string> <string name="overflow_event_enema">🪠 Clistere</string>
<string name="overflow_event_note">📝 Nota</string> <string name="overflow_event_note">📝 Nota</string>
@ -20,6 +21,7 @@
<string name="overflow_event_colic">💨 Colichette</string> <string name="overflow_event_colic">💨 Colichette</string>
<string name="event_bottle_desc">Biberon</string> <string name="event_bottle_desc">Biberon</string>
<string name="event_food_desc">Cibo</string>
<string name="event_scale_desc">Pesata</string> <string name="event_scale_desc">Pesata</string>
<string name="event_breastfeeding_left_desc">Allatt. al seno (sx)</string> <string name="event_breastfeeding_left_desc">Allatt. al seno (sx)</string>
<string name="event_breastfeeding_both_desc">Allatt. al seno</string> <string name="event_breastfeeding_both_desc">Allatt. al seno</string>

View File

@ -14,6 +14,7 @@
<string name="log_temperature_dialog_description">Insert the temperature</string> <string name="log_temperature_dialog_description">Insert the temperature</string>
<string name="event_bottle_type" translatable="false">🍼</string> <string name="event_bottle_type" translatable="false">🍼</string>
<string name="event_food_type" translatable="false">🥣</string>
<string name="event_scale_type" translatable="false">⚖️</string> <string name="event_scale_type" translatable="false">⚖️</string>
<string name="event_breastfeeding_left_type" translatable="false">🤱 ←</string> <string name="event_breastfeeding_left_type" translatable="false">🤱 ←</string>
<string name="event_breastfeeding_both_type" translatable="false">🤱 ↔</string> <string name="event_breastfeeding_both_type" translatable="false">🤱 ↔</string>
@ -28,6 +29,7 @@
<string name="event_unknown_type" translatable="false">\?</string> <string name="event_unknown_type" translatable="false">\?</string>
<string name="event_bottle_desc">Baby bottle</string> <string name="event_bottle_desc">Baby bottle</string>
<string name="event_food_desc">Food</string>
<string name="event_scale_desc">Weight</string> <string name="event_scale_desc">Weight</string>
<string name="event_breastfeeding_left_desc">Breastfeeding (left)</string> <string name="event_breastfeeding_left_desc">Breastfeeding (left)</string>
<string name="event_breastfeeding_both_desc">Breastfeeding</string> <string name="event_breastfeeding_both_desc">Breastfeeding</string>
@ -41,6 +43,7 @@
<string name="event_colic_desc">Gaseous colic</string> <string name="event_colic_desc">Gaseous colic</string>
<string name="event_unknown_desc"></string> <string name="event_unknown_desc"></string>
<string name="overflow_event_scale">⚖️ Weight</string>
<string name="overflow_event_medicine">💊 Medicine</string> <string name="overflow_event_medicine">💊 Medicine</string>
<string name="overflow_event_enema">🪠 Enema</string> <string name="overflow_event_enema">🪠 Enema</string>
<string name="overflow_event_note">📝 Note</string> <string name="overflow_event_note">📝 Note</string>

View File

@ -0,0 +1,3 @@
Multiple children support
Fixed interface in devices with big font size