forked from penguin86/luna-tracker
Compare commits
8 Commits
master
...
ce349fe1cf
| Author | SHA1 | Date | |
|---|---|---|---|
| ce349fe1cf | |||
| 6fcc685b6e | |||
| 301e8d0476 | |||
| 0633b4d084 | |||
| 0a9821aef7 | |||
| 01f24694b5 | |||
| 693405cadb | |||
| 730ef95220 |
@@ -262,26 +262,6 @@ class MainActivity : AppCompatActivity() {
|
|||||||
alertDialog.show()
|
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))
|
|
||||||
}
|
|
||||||
d.setNegativeButton(android.R.string.cancel) { dialogInterface, i -> dialogInterface.dismiss() }
|
|
||||||
val alertDialog = d.create()
|
|
||||||
alertDialog.show()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun askNotes(lunaEvent: LunaEvent) {
|
fun askNotes(lunaEvent: LunaEvent) {
|
||||||
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)
|
||||||
@@ -817,7 +797,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
dismiss()
|
dismiss()
|
||||||
})
|
})
|
||||||
contentView.findViewById<View>(R.id.button_puke).setOnClickListener({
|
contentView.findViewById<View>(R.id.button_puke).setOnClickListener({
|
||||||
askPukeValue()
|
logEvent(LunaEvent(LunaEvent.TYPE_PUKE))
|
||||||
dismiss()
|
dismiss()
|
||||||
})
|
})
|
||||||
contentView.findViewById<View>(R.id.button_colic).setOnClickListener({
|
contentView.findViewById<View>(R.id.button_colic).setOnClickListener({
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package utils
|
package utils
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Build
|
|
||||||
import android.text.format.DateFormat
|
import android.text.format.DateFormat
|
||||||
import it.danieleverducci.lunatracker.R
|
import it.danieleverducci.lunatracker.R
|
||||||
import java.util.Date
|
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.
|
* Used in the event detail dialog.
|
||||||
*/
|
*/
|
||||||
fun formatDateTime(unixTime: Long): String {
|
fun formatDateTime(unixTime: Long): String {
|
||||||
val date = Date(unixTime * 1000)
|
val roundedUnixTime = unixTime - (unixTime % 60)
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
val date = Date(roundedUnixTime * 1000)
|
||||||
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()
|
val dateFormat = java.text.DateFormat.getDateTimeInstance()
|
||||||
return dateFormat.format(date)
|
return dateFormat.format(date)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -66,8 +66,6 @@ class NumericUtils (val context: Context) {
|
|||||||
formatted.append(when (item.type) {
|
formatted.append(when (item.type) {
|
||||||
LunaEvent.TYPE_TEMPERATURE ->
|
LunaEvent.TYPE_TEMPERATURE ->
|
||||||
(item.quantity / 10.0f).toString()
|
(item.quantity / 10.0f).toString()
|
||||||
LunaEvent.TYPE_PUKE ->
|
|
||||||
context.resources.getStringArray(R.array.AmountLabels)[item.quantity]
|
|
||||||
else ->
|
else ->
|
||||||
item.quantity
|
item.quantity
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -130,7 +130,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="20dp"
|
android:layout_marginStart="20dp"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="20dp"
|
||||||
android:inputType="textEmailAddress"
|
android:inputType="textEmailAddress"
|
||||||
android:background="@drawable/textview_background"/>
|
android:background="@drawable/textview_background"/>
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,7 @@
|
|||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:paddingTop="20dp"
|
android:padding="20dp">
|
||||||
android:paddingBottom="10dp"
|
|
||||||
android:paddingHorizontal="20dp">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/dialog_event_detail_type_emoji"
|
android:id="@+id/dialog_event_detail_type_emoji"
|
||||||
|
|||||||
@@ -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>
|
|
||||||
@@ -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_title">Temperature</string>
|
||||||
<string name="log_temperature_dialog_description">Insert the 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_bottle_type" translatable="false">🍼</string>
|
||||||
<string name="event_food_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>
|
||||||
@@ -75,10 +72,6 @@
|
|||||||
<string name="year_ago">year</string>
|
<string name="year_ago">year</string>
|
||||||
<string name="years_ago">years</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">No connection</string>
|
||||||
<string name="no_connection_explain">Unable to reach WebDAV service</string>
|
<string name="no_connection_explain">Unable to reach WebDAV service</string>
|
||||||
<string name="no_connection_go_to_settings">Settings</string>
|
<string name="no_connection_go_to_settings">Settings</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user