forked from penguin86/luna-tracker
Compare commits
13 Commits
f3fb584ec2
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 8c906369df | |||
| 5eeb462836 | |||
| 5b777c0b88 | |||
| 6f3061974d | |||
| 3ea396c045 | |||
| 193e21ce25 | |||
| 7f67c758c9 | |||
| dfa64d71a8 | |||
| b7180068f3 | |||
| 36b848b95e | |||
| a1bde917f8 | |||
| 4f4ff5ed21 | |||
| 453d838470 |
19
README.md
19
README.md
@@ -13,7 +13,24 @@ Dedicated to my daughter Luna.
|
||||
|
||||

|
||||
|
||||
## Thanks for the valuable contributions to:
|
||||
## 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:
|
||||
|
||||
- Chepycou (French translation)
|
||||
- Daniel Neubauer (German translation)
|
||||
|
||||
@@ -12,8 +12,8 @@ android {
|
||||
applicationId = "it.danieleverducci.lunatracker"
|
||||
minSdk = 21
|
||||
targetSdk = 34
|
||||
versionCode = 5
|
||||
versionName = "0.7"
|
||||
versionCode = 7
|
||||
versionName = "0.9"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
@@ -262,6 +262,26 @@ 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)
|
||||
@@ -797,7 +817,7 @@ class MainActivity : AppCompatActivity() {
|
||||
dismiss()
|
||||
})
|
||||
contentView.findViewById<View>(R.id.button_puke).setOnClickListener({
|
||||
logEvent(LunaEvent(LunaEvent.TYPE_PUKE))
|
||||
askPukeValue()
|
||||
dismiss()
|
||||
})
|
||||
contentView.findViewById<View>(R.id.button_colic).setOnClickListener({
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package utils
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.text.format.DateFormat
|
||||
import it.danieleverducci.lunatracker.R
|
||||
import java.util.Date
|
||||
@@ -107,15 +108,19 @@ class DateUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* Format time as localized string without seconds. E.g. "Sept 18, 2025, 03:36 PM".
|
||||
* Used in the event detail dialog.
|
||||
*/
|
||||
fun formatDateTime(unixTime: Long): String {
|
||||
val roundedUnixTime = unixTime - (unixTime % 60)
|
||||
val date = Date(roundedUnixTime * 1000)
|
||||
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 dateFormat = java.text.DateFormat.getDateTimeInstance()
|
||||
return dateFormat.format(date)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,6 +66,8 @@ 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
|
||||
})
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="20dp">
|
||||
android:paddingTop="20dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingHorizontal="20dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dialog_event_detail_type_emoji"
|
||||
|
||||
17
app/src/main/res/layout/puke_dialog.xml
Normal file
17
app/src/main/res/layout/puke_dialog.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?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>
|
||||
8
app/src/main/res/values/arrays.xml
Normal file
8
app/src/main/res/values/arrays.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?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,6 +12,9 @@
|
||||
<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>
|
||||
@@ -72,6 +75,10 @@
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user