forked from penguin86/luna-tracker
Compare commits
14 Commits
58088aeec7
...
bottle_tim
| Author | SHA1 | Date | |
|---|---|---|---|
| 4f0416e1c1 | |||
| 8c2fcaaef5 | |||
| 01907d7c4e | |||
| 3a3dc2faf4 | |||
| 2518118759 | |||
| d8b67531db | |||
| 0a424e8807 | |||
| 8adacd3bfe | |||
| 508c14ff6e | |||
| 7d67a2e33b | |||
| a0dc023941 | |||
| 6759956461 | |||
| c521a3373f | |||
| 1ad5f31b32 |
@@ -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 < (12 * 60 * 60)
|
return (timeSeconds + durationSeconds) <= now && durationSeconds < (24 * 60 * 60)
|
||||||
}
|
}
|
||||||
|
|
||||||
val onDateChange = { time: Long ->
|
val onDateChange = { time: Long ->
|
||||||
@@ -499,7 +499,6 @@ 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 getTypeDescription(context, type)
|
return getDialogTitle(context, type)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getRowItemTitle(context: Context): String {
|
fun getRowItemTitle(context: Context): String {
|
||||||
@@ -168,7 +168,7 @@ class LunaEvent: Comparable<LunaEvent> {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getTypeDescription(context: Context, type: Type): String {
|
fun getDialogTitle(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()
|
return formatted.toString().trim()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user