Compare commits
8 Commits
master
...
ac8eb209eb
| Author | SHA1 | Date | |
|---|---|---|---|
| ac8eb209eb | |||
| bf028c8f1d | |||
| ff0d4df2de | |||
| 251ebd647a | |||
| e09df3b0bf | |||
| f36005de3b | |||
| 19abf20628 | |||
| 730ef95220 |
19
README.md
19
README.md
@@ -13,24 +13,7 @@ Dedicated to my daughter Luna.
|
||||
|
||||

|
||||
|
||||
## Contributions
|
||||
|
||||
### Why isn't this hosted on GitHub?
|
||||
|
||||
I'm using a private git server just because I'm worried for the vast majority of open source code being hosted in a server property of Microsoft and being used to train theirs AI.
|
||||
I didn't find a better option, BTW the Gitea project is working on implementing federation, so soon it will be possible to contribute using any other gitea server, selfhosted or not.
|
||||
|
||||
### How to contribute
|
||||
|
||||
The project is open to contribution, but with some limits:
|
||||
|
||||
- I'm sorry I can't accept AI-generated contributions. Reviewing a contribution requires time and effort from my side, while generating code with AI requires very little time and produces non reliable code that must be reviewed in detail. This is effectively shifting the work on my side, and in a forced way. If you feel you need a feature but you're not able to implement it by yourself, I prefer you to create an issue in the repository so I can implement it when I can, in a more mantainable way.
|
||||
- I prefer to make project-wide changes (i.e. updating Android target, app name and icon, release number...) by myself.
|
||||
|
||||
To contribute, you'll have to create an account on this git instance. Unfortunately, I had to disable registration to avoid huge waves of fake accounts created by bots.
|
||||
You can request an account writing to daniele.verducci@ichibi.eu
|
||||
|
||||
### Thanks for the valuable contributions to:
|
||||
## Thanks for the valuable contributions to:
|
||||
|
||||
- Chepycou (French translation)
|
||||
- Daniel Neubauer (German translation)
|
||||
|
||||
@@ -12,8 +12,8 @@ android {
|
||||
applicationId = "it.danieleverducci.lunatracker"
|
||||
minSdk = 21
|
||||
targetSdk = 34
|
||||
versionCode = 7
|
||||
versionName = "0.9"
|
||||
versionCode = 5
|
||||
versionName = "0.7"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import android.view.ViewGroup
|
||||
import android.widget.AdapterView
|
||||
import android.widget.ArrayAdapter
|
||||
import android.widget.EditText
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.NumberPicker
|
||||
import android.widget.PopupWindow
|
||||
import android.widget.Spinner
|
||||
@@ -262,26 +263,6 @@ class MainActivity : AppCompatActivity() {
|
||||
alertDialog.show()
|
||||
}
|
||||
|
||||
fun askPukeValue() {
|
||||
val d = AlertDialog.Builder(this)
|
||||
val dialogView = layoutInflater.inflate(R.layout.puke_dialog, null)
|
||||
d.setTitle(R.string.log_puke_dialog_title)
|
||||
d.setMessage(R.string.log_puke_dialog_description)
|
||||
d.setView(dialogView)
|
||||
|
||||
val spinner = dialogView.findViewById<Spinner>(R.id.dialog_puke_value)
|
||||
spinner.adapter = ArrayAdapter.createFromResource(this, R.array.AmountLabels, android.R.layout.simple_spinner_dropdown_item)
|
||||
spinner.setSelection(1)
|
||||
|
||||
d.setPositiveButton(android.R.string.ok) { dialogInterface, i ->
|
||||
val pos = spinner.selectedItemPosition
|
||||
logEvent(LunaEvent(LunaEvent.TYPE_PUKE, pos + 1))
|
||||
}
|
||||
d.setNegativeButton(android.R.string.cancel) { dialogInterface, i -> dialogInterface.dismiss() }
|
||||
val alertDialog = d.create()
|
||||
alertDialog.show()
|
||||
}
|
||||
|
||||
fun askNotes(lunaEvent: LunaEvent) {
|
||||
val d = AlertDialog.Builder(this)
|
||||
val dialogView = layoutInflater.inflate(R.layout.dialog_notes, null)
|
||||
@@ -410,10 +391,11 @@ class MainActivity : AppCompatActivity() {
|
||||
})
|
||||
|
||||
// show optional signature
|
||||
if (event.signature.isNotEmpty()) {
|
||||
val signatureTextEdit = dialogView.findViewById<TextView>(R.id.dialog_event_detail_type_signature)
|
||||
signatureTextEdit.text = String.format(getString(R.string.dialog_event_detail_signature), event.signature)
|
||||
signatureTextEdit.visibility = View.VISIBLE
|
||||
dialogView.findViewById<TextView>(R.id.dialog_event_detail_type_signature).text = event.signature
|
||||
dialogView.findViewById<LinearLayout>(R.id.dialog_event_signature_layout).visibility = if (event.signature.isNotEmpty()) {
|
||||
View.VISIBLE
|
||||
} else {
|
||||
View.GONE
|
||||
}
|
||||
|
||||
// create next/previous links to events of the same type
|
||||
@@ -817,7 +799,9 @@ class MainActivity : AppCompatActivity() {
|
||||
dismiss()
|
||||
})
|
||||
contentView.findViewById<View>(R.id.button_puke).setOnClickListener({
|
||||
askPukeValue()
|
||||
logEvent(
|
||||
LunaEvent(LunaEvent.TYPE_PUKE)
|
||||
)
|
||||
dismiss()
|
||||
})
|
||||
contentView.findViewById<View>(R.id.button_colic).setOnClickListener({
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package utils
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.text.format.DateFormat
|
||||
import it.danieleverducci.lunatracker.R
|
||||
import java.util.Date
|
||||
@@ -108,19 +107,15 @@ class DateUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Format time as localized string without seconds. E.g. "Sept 18, 2025, 03:36 PM".
|
||||
* Format time as localized string. E.g. "28 Sept 03:36:00".
|
||||
* The seconds are set to 0 since they are distracting and not relevant.
|
||||
* Used in the event detail dialog.
|
||||
*/
|
||||
fun formatDateTime(unixTime: Long): String {
|
||||
val date = Date(unixTime * 1000)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
val dateFormat = android.icu.text.DateFormat.getDateTimeInstance(android.icu.text.DateFormat.DEFAULT, android.icu.text.DateFormat.SHORT)
|
||||
return dateFormat.format(date)
|
||||
} else {
|
||||
// fallback
|
||||
val roundedUnixTime = unixTime - (unixTime % 60)
|
||||
val date = Date(roundedUnixTime * 1000)
|
||||
val dateFormat = java.text.DateFormat.getDateTimeInstance()
|
||||
return dateFormat.format(date)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,8 +66,6 @@ class NumericUtils (val context: Context) {
|
||||
formatted.append(when (item.type) {
|
||||
LunaEvent.TYPE_TEMPERATURE ->
|
||||
(item.quantity / 10.0f).toString()
|
||||
LunaEvent.TYPE_PUKE ->
|
||||
context.resources.getStringArray(R.array.AmountLabels)[item.quantity - 1]
|
||||
else ->
|
||||
item.quantity
|
||||
})
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:inputType="textEmailAddress"
|
||||
android:background="@drawable/textview_background"/>
|
||||
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="20dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingHorizontal="20dp">
|
||||
android:padding="20dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dialog_event_detail_type_emoji"
|
||||
@@ -63,14 +61,6 @@
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:id="@+id/dialog_event_detail_type_signature"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -99,4 +89,25 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/dialog_event_signature_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:text="@string/dialog_event_detail_signature"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dialog_event_detail_type_signature"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:text="" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/dialog_puke_value"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:paddingVertical="8dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -50,8 +50,9 @@
|
||||
<string name="no_connection_go_to_settings">Einstellungen</string>
|
||||
<string name="no_connection_retry">Erneut versuchen</string>
|
||||
|
||||
<string name="no_breastfeeding">Kein Stillen</string>
|
||||
|
||||
<string name="settings_title">Einstellungen</string>
|
||||
<string name="settings_no_breastfeeding">Kein Stillen</string>
|
||||
<string name="settings_storage">Speicherort für Daten auswählen</string>
|
||||
<string name="settings_storage_local">Auf dem Gerät</string>
|
||||
<string name="settings_storage_local_desc">Datenschutzfreundlichste Lösung: Deine Daten verlassen dein Gerät nicht</string>
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string-array name="AmountLabels">
|
||||
<item>@string/amount_little</item>
|
||||
<item>@string/amount_normal</item>
|
||||
<item>@string/amount_plenty</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
@@ -12,9 +12,6 @@
|
||||
<string name="log_temperature_dialog_title">Temperature</string>
|
||||
<string name="log_temperature_dialog_description">Insert the temperature</string>
|
||||
|
||||
<string name="log_puke_dialog_title">Puke</string>
|
||||
<string name="log_puke_dialog_description">Select the amount</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>
|
||||
@@ -75,10 +72,6 @@
|
||||
<string name="year_ago">year</string>
|
||||
<string name="years_ago">years</string>
|
||||
|
||||
<string name="amount_little">Little</string>
|
||||
<string name="amount_normal">Normal</string>
|
||||
<string name="amount_plenty">Plenty</string>
|
||||
|
||||
<string name="no_connection">No connection</string>
|
||||
<string name="no_connection_explain">Unable to reach WebDAV service</string>
|
||||
<string name="no_connection_go_to_settings">Settings</string>
|
||||
@@ -138,7 +131,7 @@
|
||||
<string name="dialog_event_detail_delete_button">Delete</string>
|
||||
<string name="dialog_event_detail_quantity">Quantity</string>
|
||||
<string name="dialog_event_detail_notes">Notes</string>
|
||||
<string name="dialog_event_detail_signature">by %s</string>
|
||||
<string name="dialog_event_detail_signature">Created By</string>
|
||||
|
||||
<string name="dialog_add_logbook_title">Add logbook</string>
|
||||
<string name="dialog_add_logbook_logbookname">👶 Logbook name</string>
|
||||
|
||||
Reference in New Issue
Block a user