Add Homescreen lock to preferences

Co-authored-by: Daria Hamrah Paytakht <info@dariarnd.ir>
This commit is contained in:
Yasan Ghaffarian
2022-05-28 15:35:25 +04:30
parent fae3211c03
commit 4545814835
4 changed files with 14 additions and 0 deletions

View File

@@ -55,6 +55,7 @@
<bool name="config_default_rounded_widgets">true</bool>
<bool name="config_default_show_status_bar">true</bool>
<bool name="config_default_show_top_shadow">true</bool>
<bool name="config_default_lock_home_screen">false</bool>
<bool name="config_default_hide_app_drawer_search_bar">false</bool>
<bool name="config_default_enable_font_selection">true</bool>
<bool name="config_default_enable_smartspace_calendar_selection">true</bool>

View File

@@ -43,6 +43,7 @@
<string name="max_folder_columns">Max. Folder Columns</string>
<string name="max_folder_rows">Max. Folder Rows</string>
<string name="home_screen_grid">Home Screen Grid</string>
<string name="home_screen_lock">Lock Home Screen</string>
<string name="columns">Columns</string>
<string name="grid">Grid</string>
<string name="rows">Rows</string>
@@ -116,6 +117,7 @@
<string name="wallpaper_scrolling_label">Scroll Wallpaper</string>
<string name="show_sys_ui_scrim">Top Shadow</string>
<string name="show_status_bar">Show Status Bar</string>
<string name="layout">Layout</string>
<string name="what_to_show">What to Show</string>
<string name="missing_notification_access_label">Notification Access Needed</string>
<string name="missing_notification_access_description">Notification access needed.</string>

View File

@@ -142,6 +142,11 @@ class PreferenceManager2(private val context: Context) : PreferenceManager {
defaultValue = context.resources.getBoolean(R.bool.config_default_show_top_shadow),
)
val lockHomeScreen = preference(
key = booleanPreferencesKey(name = "lock_home_screen"),
defaultValue = context.resources.getBoolean(R.bool.config_default_lock_home_screen),
)
val hideAppDrawerSearchBar = preference(
key = booleanPreferencesKey(name = "hide_app_drawer_search_bar"),
defaultValue = context.resources.getBoolean(R.bool.config_default_hide_app_drawer_search_bar),

View File

@@ -80,6 +80,8 @@ fun HomeScreenPreferences() {
adapter = prefs2.showTopShadow.getAdapter(),
label = stringResource(id = R.string.show_sys_ui_scrim),
)
}
PreferenceGroup(heading = stringResource(id = R.string.layout)) {
val columns by prefs.workspaceColumns.getAdapter()
val rows by prefs.workspaceRows.getAdapter()
NavigationActionPreference(
@@ -87,6 +89,10 @@ fun HomeScreenPreferences() {
destination = subRoute(name = HomeScreenRoutes.GRID),
subtitle = stringResource(id = R.string.x_by_y, columns, rows),
)
SwitchPreference(
adapter = prefs2.lockHomeScreen.getAdapter(),
label = stringResource(id = R.string.home_screen_lock),
)
}
PreferenceGroup(heading = stringResource(id = R.string.status_bar_label)) {
val showStatusBarAdapter = prefs2.showStatusBar.getAdapter()