Add app drawer indent configuration (#3918)
This commit is contained in:
@@ -120,6 +120,7 @@
|
||||
<item name="config_default_home_icon_label_folder_size_factor" type="dimen" format="float">1.0</item>
|
||||
<item name="config_default_drawer_icon_label_size_factor" type="dimen" format="float">1.0</item>
|
||||
<item name="config_default_drawer_cell_height_factor" type="dimen" format="float">1.0</item>
|
||||
<item name="config_default_drawer_left_right_factor" type="dimen" format="float">0.1</item>
|
||||
<item name="config_default_search_max_result_count" type="dimen" format="integer">5</item>
|
||||
<item name="config_default_files_max_result_count" type="dimen" format="integer">3</item>
|
||||
<item name="config_default_people_max_result_count" type="dimen" format="integer">10</item>
|
||||
|
||||
@@ -350,6 +350,7 @@
|
||||
<!-- <string name="grid" /> -->
|
||||
<string name="app_drawer_columns">App Drawer Columns</string>
|
||||
<string name="row_height_label">Row Height</string>
|
||||
<string name="app_drawer_indent_label">App Drawer Indent</string>
|
||||
|
||||
<string name="perform_wide_search_title">Device Search</string>
|
||||
<string name="perform_wide_search_file">Files</string>
|
||||
|
||||
@@ -1,38 +1,86 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<device-paddings xmlns:launcher="http://schemas.android.com/apk/res-auto">
|
||||
<device-padding launcher:maxEmptySpace="22.0dip">
|
||||
<workspaceTopPadding launcher:a="0.0" launcher:b="0.0" />
|
||||
<workspaceBottomPadding launcher:a="1.0" launcher:b="0.0" />
|
||||
<hotseatBottomPadding launcher:a="0.0" launcher:b="0.0" />
|
||||
<device-padding launcher:maxEmptySpace="22dp">
|
||||
<workspaceTopPadding
|
||||
launcher:a="0"
|
||||
launcher:b="0"/>
|
||||
<workspaceBottomPadding
|
||||
launcher:a="1"
|
||||
launcher:b="0"/>
|
||||
<hotseatBottomPadding
|
||||
launcher:a="0"
|
||||
launcher:b="0"/>
|
||||
</device-padding>
|
||||
<device-padding launcher:maxEmptySpace="44.0dip">
|
||||
<workspaceTopPadding launcher:a="0.0" launcher:b="8.0dip" />
|
||||
<workspaceBottomPadding launcher:a="1.0" launcher:b="0.0" launcher:c="8.0dip" />
|
||||
<hotseatBottomPadding launcher:a="0.0" launcher:b="0.0" />
|
||||
<device-padding launcher:maxEmptySpace="44dp">
|
||||
<workspaceTopPadding
|
||||
launcher:a="0"
|
||||
launcher:b="8dp"/>
|
||||
<workspaceBottomPadding
|
||||
launcher:a="1"
|
||||
launcher:b="0"
|
||||
launcher:c="8dp"/>
|
||||
<hotseatBottomPadding
|
||||
launcher:a="0"
|
||||
launcher:b="0"/>
|
||||
</device-padding>
|
||||
<device-padding launcher:maxEmptySpace="64.0dip">
|
||||
<workspaceTopPadding launcher:a="0.0" launcher:b="16.0dip" />
|
||||
<workspaceBottomPadding launcher:a="1.0" launcher:b="0.0" launcher:c="16.0dip" />
|
||||
<hotseatBottomPadding launcher:a="0.0" launcher:b="0.0" />
|
||||
<device-padding launcher:maxEmptySpace="64dp">
|
||||
<workspaceTopPadding
|
||||
launcher:a="0"
|
||||
launcher:b="16dp"/>
|
||||
<workspaceBottomPadding
|
||||
launcher:a="1"
|
||||
launcher:b="0"
|
||||
launcher:c="16dp"/>
|
||||
<hotseatBottomPadding
|
||||
launcher:a="0"
|
||||
launcher:b="0"/>
|
||||
</device-padding>
|
||||
<device-padding launcher:maxEmptySpace="114.0dip">
|
||||
<workspaceTopPadding launcher:a="0.0" launcher:b="36.0dip" />
|
||||
<workspaceBottomPadding launcher:a="1.0" launcher:b="0.0" launcher:c="36.0dip" />
|
||||
<hotseatBottomPadding launcher:a="0.0" launcher:b="0.0" />
|
||||
<device-padding launcher:maxEmptySpace="114dp">
|
||||
<workspaceTopPadding
|
||||
launcher:a="0"
|
||||
launcher:b="36dp"/>
|
||||
<workspaceBottomPadding
|
||||
launcher:a="1"
|
||||
launcher:b="0"
|
||||
launcher:c="36dp"/>
|
||||
<hotseatBottomPadding
|
||||
launcher:a="0"
|
||||
launcher:b="0"/>
|
||||
</device-padding>
|
||||
<device-padding launcher:maxEmptySpace="138.0dip">
|
||||
<workspaceTopPadding launcher:a="0.0" launcher:b="48.0dip" />
|
||||
<workspaceBottomPadding launcher:a="1.0" launcher:b="0.0" launcher:c="48.0dip" />
|
||||
<hotseatBottomPadding launcher:a="0.0" launcher:b="0.0" />
|
||||
<device-padding launcher:maxEmptySpace="138dp">
|
||||
<workspaceTopPadding
|
||||
launcher:a="0"
|
||||
launcher:b="48dp"/>
|
||||
<workspaceBottomPadding
|
||||
launcher:a="1"
|
||||
launcher:b="0"
|
||||
launcher:c="48dp"/>
|
||||
<hotseatBottomPadding
|
||||
launcher:a="0"
|
||||
launcher:b="0"/>
|
||||
</device-padding>
|
||||
<device-padding launcher:maxEmptySpace="154.0dip">
|
||||
<workspaceTopPadding launcher:a="0.0" launcher:b="60.0dip" />
|
||||
<workspaceBottomPadding launcher:a="1.0" launcher:b="0.0" launcher:c="60.0dip" />
|
||||
<hotseatBottomPadding launcher:a="0.0" launcher:b="0.0" />
|
||||
<device-padding launcher:maxEmptySpace="154dp">
|
||||
<workspaceTopPadding
|
||||
launcher:a="0"
|
||||
launcher:b="60dp"/>
|
||||
<workspaceBottomPadding
|
||||
launcher:a="1"
|
||||
launcher:b="0"
|
||||
launcher:c="60dp"/>
|
||||
<hotseatBottomPadding
|
||||
launcher:a="0"
|
||||
launcher:b="0"/>
|
||||
</device-padding>
|
||||
<device-padding launcher:maxEmptySpace="9999.0dip">
|
||||
<workspaceTopPadding launcher:a="0.0" launcher:b="72.0dip" />
|
||||
<workspaceBottomPadding launcher:a="1.0" launcher:b="0.0" launcher:c="72.0dip" />
|
||||
<hotseatBottomPadding launcher:a="0.0" launcher:b="0.0" />
|
||||
<device-padding launcher:maxEmptySpace="9999dp">
|
||||
<workspaceTopPadding
|
||||
launcher:a="0"
|
||||
launcher:b="72dp"/>
|
||||
<workspaceBottomPadding
|
||||
launcher:a="1"
|
||||
launcher:b="0"
|
||||
launcher:c="72dp"/>
|
||||
<hotseatBottomPadding
|
||||
launcher:a="0"
|
||||
launcher:b="0"/>
|
||||
</device-padding>
|
||||
</device-paddings>
|
||||
|
||||
@@ -336,6 +336,12 @@ class PreferenceManager2 private constructor(private val context: Context) : Pre
|
||||
onSet = { reloadHelper.reloadGrid() },
|
||||
)
|
||||
|
||||
val drawerLeftRightMarginFactor = preference(
|
||||
key = floatPreferencesKey(name = "drawer_left_right_factor"),
|
||||
defaultValue = resourceProvider.getFloat(R.dimen.config_default_drawer_left_right_factor),
|
||||
onSet = { reloadHelper.reloadGrid() },
|
||||
)
|
||||
|
||||
val enableFuzzySearch = preference(
|
||||
key = booleanPreferencesKey(name = "enable_fuzzy_search"),
|
||||
defaultValue = context.resources.getBoolean(R.bool.config_default_enable_fuzzy_search),
|
||||
|
||||
@@ -262,6 +262,13 @@ fun AppDrawerPreferences() {
|
||||
step = 0.1F,
|
||||
showAsPercentage = true,
|
||||
)
|
||||
SliderPreference(
|
||||
adapter = prefs2.drawerLeftRightMarginFactor.getAdapter(),
|
||||
label = stringResource(id = R.string.app_drawer_indent_label),
|
||||
valueRange = 0.0F..1.0F,
|
||||
step = 0.01F,
|
||||
showAsPercentage = true,
|
||||
)
|
||||
}
|
||||
PreferenceGroup(heading = stringResource(id = R.string.icons)) {
|
||||
SliderPreference(
|
||||
|
||||
@@ -1305,9 +1305,14 @@ public class DeviceProfile {
|
||||
+ allAppsLeftRightPadding * 2;
|
||||
allAppsLeftRightMargin = Math.max(1, (availableWidthPx - usedWidth) / 2);
|
||||
} else {
|
||||
allAppsLeftRightPadding = Math.max(0, desiredWorkspaceHorizontalMarginPx + cellLayoutHorizontalPadding
|
||||
allAppsLeftRightPadding = Math.max(1, desiredWorkspaceHorizontalMarginPx + cellLayoutHorizontalPadding
|
||||
- (allAppsBorderSpacePx.x / 2));
|
||||
}
|
||||
var allAppLeftRightMarginMultiplier = PreferenceExtensionsKt
|
||||
.firstBlocking(preferenceManager2.getDrawerLeftRightMarginFactor());
|
||||
var margin = pxFromDp(inv.allAppsCellSize[mTypeIndex].y, mMetrics, allAppLeftRightMarginMultiplier);
|
||||
allAppsLeftRightMargin *= margin;
|
||||
allAppsLeftRightPadding *= margin;
|
||||
}
|
||||
|
||||
private void setupAllAppsStyle(Context context) {
|
||||
|
||||
Reference in New Issue
Block a user