mirror of
https://codeberg.org/timelimit/opentimelimit-android.git
synced 2025-10-05 10:49:29 +02:00
Show warning if time limit rule affects multiple days
This commit is contained in:
parent
1808710e0b
commit
b74350f85f
4 changed files with 24 additions and 1 deletions
|
@ -134,7 +134,9 @@ class EditTimeLimitRuleDialogFragment : BottomSheetDialogFragment() {
|
||||||
view.applyToExtraTime = newRule.applyToExtraTimeUsage
|
view.applyToExtraTime = newRule.applyToExtraTimeUsage
|
||||||
view.timeSpan.timeInMillis = newRule.maximumTimeInMillis.toLong()
|
view.timeSpan.timeInMillis = newRule.maximumTimeInMillis.toLong()
|
||||||
|
|
||||||
view.timeSpan.maxDays = Math.max(0, (0..6).map { (newRule.dayMask.toInt() shr it) and 1 }.sum() - 1)
|
val affectedDays = Math.max(0, (0..6).map { (newRule.dayMask.toInt() shr it) and 1 }.sum())
|
||||||
|
view.timeSpan.maxDays = affectedDays - 1
|
||||||
|
view.affectsMultipleDays = affectedDays >= 2
|
||||||
}
|
}
|
||||||
|
|
||||||
bindRule()
|
bindRule()
|
||||||
|
|
|
@ -30,6 +30,10 @@
|
||||||
name="handlers"
|
name="handlers"
|
||||||
type="io.timelimit.android.ui.manage.category.timelimit_rules.edit.Handlers" />
|
type="io.timelimit.android.ui.manage.category.timelimit_rules.edit.Handlers" />
|
||||||
|
|
||||||
|
<variable
|
||||||
|
name="affectsMultipleDays"
|
||||||
|
type="boolean" />
|
||||||
|
|
||||||
<import type="android.view.View" />
|
<import type="android.view.View" />
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
|
@ -75,6 +79,13 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:visibility="@{affectsMultipleDays ? View.VISIBLE : View.GONE}"
|
||||||
|
android:textAppearance="?android:textAppearanceSmall"
|
||||||
|
android:text="@string/category_time_limit_rules_warning_multiple_days"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -31,4 +31,9 @@
|
||||||
<string name="category_time_limit_rules_snackbar_created">Regel wurde erstellt</string>
|
<string name="category_time_limit_rules_snackbar_created">Regel wurde erstellt</string>
|
||||||
<string name="category_time_limit_rules_snackbar_updated">Regel wurde geändert</string>
|
<string name="category_time_limit_rules_snackbar_updated">Regel wurde geändert</string>
|
||||||
<string name="category_time_limit_rules_snackbar_deleted">Regel wurde gelöscht</string>
|
<string name="category_time_limit_rules_snackbar_deleted">Regel wurde gelöscht</string>
|
||||||
|
|
||||||
|
<string name="category_time_limit_rules_warning_multiple_days">Diese Regel
|
||||||
|
wird die Gesamtnutzungsdauer in einer Woche an den gewählten Tagen einschränken.
|
||||||
|
Wenn Sei die Begrenzung je Tag wollen, dann erstellen Sie eine Regel je Tag.
|
||||||
|
</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -31,4 +31,9 @@
|
||||||
<string name="category_time_limit_rules_snackbar_created">Rule was created</string>
|
<string name="category_time_limit_rules_snackbar_created">Rule was created</string>
|
||||||
<string name="category_time_limit_rules_snackbar_updated">Rule was modified</string>
|
<string name="category_time_limit_rules_snackbar_updated">Rule was modified</string>
|
||||||
<string name="category_time_limit_rules_snackbar_deleted">Rule was deleted</string>
|
<string name="category_time_limit_rules_snackbar_deleted">Rule was deleted</string>
|
||||||
|
|
||||||
|
<string name="category_time_limit_rules_warning_multiple_days">This rule
|
||||||
|
will limit the total usage duration during one week at the selected days.
|
||||||
|
If you want it per day, create one rule per day.
|
||||||
|
</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue