Allow saving rules without days

This commit is contained in:
Jonas Lochmann 2022-09-19 02:00:00 +02:00
parent 21fa778a32
commit 12b83a66f5
No known key found for this signature in database
GPG key ID: 8B8C9AEE10FA5B36
4 changed files with 9 additions and 4 deletions

View file

@ -1,5 +1,5 @@
/* /*
* TimeLimit Copyright <C> 2019 - 2020 Jonas Lochmann * TimeLimit Copyright <C> 2019 - 2022 Jonas Lochmann
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -39,6 +39,7 @@ object DayNameUtil {
} }
} }
return JoinUtil.join(dayGroups, context) return if (dayGroups.isEmpty()) context.getString(R.string.util_day_no_day)
else JoinUtil.join(dayGroups, context)
} }
} }

View file

@ -1,5 +1,5 @@
<!-- <!--
TimeLimit Copyright <C> 2019 - 2020 Jonas Lochmann TimeLimit Copyright <C> 2019 - 2022 Jonas Lochmann
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation version 3 of the License. the Free Software Foundation version 3 of the License.
@ -248,8 +248,11 @@
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<TextView <TextView
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:visibility="@{applyToZeroDays ? View.VISIBLE : View.GONE}" android:visibility="@{applyToZeroDays ? View.VISIBLE : View.GONE}"
android:textAppearance="?android:textAppearanceSmall" android:textAppearance="?android:textAppearanceSmall"
android:textColor="@color/orange_text"
android:text="@string/category_time_limit_rules_warning_zero_day_part" android:text="@string/category_time_limit_rules_warning_zero_day_part"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
@ -275,7 +278,6 @@
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<Button <Button
android:enabled="@{!applyToZeroDays}"
android:layout_marginEnd="4dp" android:layout_marginEnd="4dp"
android:layout_marginStart="4dp" android:layout_marginStart="4dp"
android:onClick="@{() -> handlers.onSaveRule()}" android:onClick="@{() -> handlers.onSaveRule()}"

View file

@ -1622,6 +1622,7 @@
<string name="util_time_used"><xliff:g example="4 minutes" id="used time">%1$s</xliff:g> benutzt</string> <string name="util_time_used"><xliff:g example="4 minutes" id="used time">%1$s</xliff:g> benutzt</string>
<string name="util_day_from_to">%s bis %s</string> <string name="util_day_from_to">%s bis %s</string>
<string name="util_day_no_day">an keinen Tagen</string>
<string name="widget_msg_unconfigured">Dieses Widget funktioniert nur auf beschränkten Geräten</string> <string name="widget_msg_unconfigured">Dieses Widget funktioniert nur auf beschränkten Geräten</string>
<string name="widget_msg_no_child">Momentan hat dieses Gerät keinen Kind-Benutzer</string> <string name="widget_msg_no_child">Momentan hat dieses Gerät keinen Kind-Benutzer</string>

View file

@ -1669,6 +1669,7 @@
<string name="util_time_used">Used <xliff:g example="4 minutes" id="used time">%1$s</xliff:g></string> <string name="util_time_used">Used <xliff:g example="4 minutes" id="used time">%1$s</xliff:g></string>
<string name="util_day_from_to">%s to %s</string> <string name="util_day_from_to">%s to %s</string>
<string name="util_day_no_day">at no days</string>
<string name="widget_msg_unconfigured">This Widget only works on limited devices</string> <string name="widget_msg_unconfigured">This Widget only works on limited devices</string>
<string name="widget_msg_no_child">This device is not used by a child right now</string> <string name="widget_msg_no_child">This device is not used by a child right now</string>