forked from penguin86/luna-tracker
Compare commits
14 Commits
bottle_tim
...
58088aeec7
| Author | SHA1 | Date | |
|---|---|---|---|
| 58088aeec7 | |||
| 907decf8d1 | |||
| 7700258414 | |||
| b88b88623e | |||
| 2709050496 | |||
| 5fe383e488 | |||
| 7d480d6e1c | |||
| bbf3b0ce8e | |||
| 38f2a27c38 | |||
| 6d63ad54f2 | |||
| 553e1c351f | |||
| f8f5d68bb6 | |||
| 280d4558ad | |||
| d74310fad5 |
@@ -455,7 +455,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
fun isValidTime(timeSeconds: Long, durationSeconds: Int): Boolean {
|
fun isValidTime(timeSeconds: Long, durationSeconds: Int): Boolean {
|
||||||
val now = System.currentTimeMillis() / 1000
|
val now = System.currentTimeMillis() / 1000
|
||||||
return (timeSeconds + durationSeconds) <= now && durationSeconds < (24 * 60 * 60)
|
return (timeSeconds + durationSeconds) <= now && durationSeconds < (12 * 60 * 60)
|
||||||
}
|
}
|
||||||
|
|
||||||
val onDateChange = { time: Long ->
|
val onDateChange = { time: Long ->
|
||||||
@@ -499,6 +499,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
d.setPositiveButton(android.R.string.ok) { dialogInterface, i ->
|
d.setPositiveButton(android.R.string.ok) { dialogInterface, i ->
|
||||||
val time = pickedDateTime.time.time / 1000
|
val time = pickedDateTime.time.time / 1000
|
||||||
|
|
||||||
if (isValidTime(time, duration)) {
|
if (isValidTime(time, duration)) {
|
||||||
event.time = time
|
event.time = time
|
||||||
event.quantity = duration
|
event.quantity = duration
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ class LunaEvent: Comparable<LunaEvent> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getDialogTitle(context: Context): String {
|
fun getDialogTitle(context: Context): String {
|
||||||
return getDialogTitle(context, type)
|
return getTypeDescription(context, type)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getRowItemTitle(context: Context): String {
|
fun getRowItemTitle(context: Context): String {
|
||||||
@@ -168,7 +168,7 @@ class LunaEvent: Comparable<LunaEvent> {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getDialogTitle(context: Context, type: Type): String {
|
fun getTypeDescription(context: Context, type: Type): String {
|
||||||
return context.getString(
|
return context.getString(
|
||||||
when (type) {
|
when (type) {
|
||||||
Type.BABY_BOTTLE -> R.string.event_bottle_desc
|
Type.BABY_BOTTLE -> R.string.event_bottle_desc
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ class NumericUtils (val context: Context) {
|
|||||||
else -> ""
|
else -> ""
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return formatted.toString().trim()
|
return formatted.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user