parent
56014794fc
commit
1a4f4d5e96
@ -3,7 +3,6 @@ package de.mm20.launcher2.searchactions.builders
|
||||
import android.content.Context
|
||||
import de.mm20.launcher2.searchactions.R
|
||||
import de.mm20.launcher2.searchactions.TextClassificationResult
|
||||
import de.mm20.launcher2.searchactions.actions.MessageAction
|
||||
import de.mm20.launcher2.searchactions.actions.ScheduleEventAction
|
||||
import de.mm20.launcher2.searchactions.actions.SearchAction
|
||||
import de.mm20.launcher2.searchactions.actions.SearchActionIcon
|
||||
@ -28,7 +27,10 @@ class ScheduleEventActionBuilder(
|
||||
time = classifiedQuery.time
|
||||
)
|
||||
}
|
||||
if (classifiedQuery.timespan != null && classifiedQuery.timespan.seconds > 86400) {
|
||||
// Time spans that are shorter than 24 hours are already handled by the TimerActionBuilder
|
||||
if (classifiedQuery.timespan != null && classifiedQuery.timespan.seconds > 86400
|
||||
&& classifiedQuery.timespan.seconds < 3153600000
|
||||
) {
|
||||
val datetime = LocalDateTime.now().plus(classifiedQuery.timespan)
|
||||
return ScheduleEventAction(
|
||||
context.getString(R.string.search_action_event),
|
||||
|
||||
@ -18,6 +18,7 @@ class TimerActionBuilder(
|
||||
override val icon: SearchActionIcon = SearchActionIcon.Timer
|
||||
|
||||
override fun build(context: Context, classifiedQuery: TextClassificationResult): SearchAction? {
|
||||
// Maximum time span for a timer is 24 hours, see https://developer.android.com/reference/android/provider/AlarmClock#EXTRA_LENGTH
|
||||
if (classifiedQuery.timespan != null && classifiedQuery.timespan.seconds <= 86400) {
|
||||
return TimerAction(
|
||||
context.getString(R.string.search_action_timer), classifiedQuery.timespan
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user