UpdatesPreference: Allow to configure automated updates constraints

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta
2025-02-18 15:56:16 +08:00
parent 86d085fe55
commit 5c7289381f
9 changed files with 172 additions and 6 deletions

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ SPDX-FileCopyrightText: 2025 The Calyx Institute
~ SPDX-License-Identifier: GPL-3.0-or-later
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingHorizontal="@dimen/padding_large">
<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/checkboxMetered"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/pref_updates_restrictions_metered" />
<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/checkboxBattery"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/pref_updates_restrictions_battery" />
<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/checkboxIdle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/pref_updates_restrictions_idle" />
</LinearLayout>

View File

@@ -113,7 +113,7 @@
tools:layout="@layout/fragment_setting" />
<fragment
android:id="@+id/updatesPreference"
android:name="com.aurora.store.view.ui.preferences.UpdatesPreference"
android:name="com.aurora.store.view.ui.preferences.updates.UpdatesPreference"
android:label="UpdatesPreference"
tools:layout="@layout/fragment_setting" />
<fragment
@@ -468,10 +468,14 @@
</dialog>
<dialog
android:id="@+id/proxyURLDialog"
android:name="com.aurora.store.view.ui.preferences.ProxyURLDialog"
android:name="com.aurora.store.view.ui.preferences.network.ProxyURLDialog"
android:label="@string/pref_network_proxy_url" />
<dialog
android:id="@+id/forceRestartDialog"
android:name="com.aurora.store.view.ui.commons.ForceRestartDialog"
android:label="@string/force_restart_title" />
<dialog
android:id="@+id/updatesRestrictionsDialog"
android:name="com.aurora.store.view.ui.preferences.updates.UpdatesRestrictionsDialog"
android:label="@string/pref_updates_restrictions_title" />
</navigation>

View File

@@ -495,4 +495,11 @@
<string name="toast_proxy_disabled">Proxy disabled successfully</string>
<string name="pref_network_proxy_desc">View and manage proxy configuration</string>
<string name="pref_network_proxy_url_hint" translatable="false">protocol://user:password@host:port</string>
<!-- UpdatesPreferences -->
<string name="pref_updates_restrictions_title">Automatic updates restrictions</string>
<string name="pref_updates_restrictions_desc">Configure device restrictions for automated updates.</string>
<string name="pref_updates_restrictions_metered">Only on unmetered networks</string>
<string name="pref_updates_restrictions_idle">When device is idle</string>
<string name="pref_updates_restrictions_battery">When battery is not low</string>
</resources>

View File

@@ -40,6 +40,13 @@
app:min="1"
app:showSeekBarValue="true" />
<Preference
app:disableDependentsState="false"
app:iconSpaceReserved="false"
app:key="PREFERENCES_UPDATES_RESTRICTIONS"
app:summary="@string/pref_updates_restrictions_desc"
app:title="@string/pref_updates_restrictions_title" />
<PreferenceCategory
app:iconSpaceReserved="false"
app:singleLineTitle="false"