diff options
| author | 2023-09-05 10:29:32 +0000 | |
|---|---|---|
| committer | 2023-09-05 10:29:32 +0000 | |
| commit | 10dc16e9c1f06c18302569c1e5c82822b9dbafce (patch) | |
| tree | 4111507d3406df63a643029411a9d9451fe2886e | |
| parent | 7bef96b88cac944f89fd4f1a522516d355a22062 (diff) | |
| parent | 2e5c0b58b7c845bc34f09881543530cd8672c2cd (diff) | |
Merge "Allow SearchBox title to scale to system font size" into udc-qpr-dev am: 2e5c0b58b7
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24633587
Change-Id: Ifd24ebf2d5211af34ee1574a2b831e7a3f4494be
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/widget/scaffold/CustomizedAppBar.kt | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/widget/scaffold/CustomizedAppBar.kt b/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/widget/scaffold/CustomizedAppBar.kt index 90a723f707da..b77368a429ae 100644 --- a/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/widget/scaffold/CustomizedAppBar.kt +++ b/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/widget/scaffold/CustomizedAppBar.kt @@ -253,6 +253,7 @@ private fun SingleRowTopAppBar( hideTitleSemantics = false, navigationIcon = navigationIcon, actions = actionsRow, + titleScaleDisabled = false, ) } } @@ -426,6 +427,7 @@ private fun TwoRowsTopAppBar( * accessibility services at the same time, when animating between collapsed / expanded states. * @param navigationIcon a navigation icon [Composable] * @param actions actions [Composable] + * @param titleScaleDisabled whether the title font scaling is disabled. Default is disabled. */ @Composable private fun TopAppBarLayout( @@ -443,6 +445,7 @@ private fun TopAppBarLayout( hideTitleSemantics: Boolean, navigationIcon: @Composable () -> Unit, actions: @Composable () -> Unit, + titleScaleDisabled: Boolean = true, ) { Layout( { @@ -466,9 +469,12 @@ private fun TopAppBarLayout( ProvideTextStyle(value = titleTextStyle) { CompositionLocalProvider( LocalContentColor provides titleContentColor, - // Disable the title font scaling by only passing the density but not the - // font scale. - LocalDensity provides Density(density = LocalDensity.current.density), + LocalDensity provides with(LocalDensity.current) { + Density( + density = density, + fontScale = if (titleScaleDisabled) 1f else fontScale, + ) + }, content = title ) } |