Commit Graph

54 Commits

Author SHA1 Message Date
Magdi
db9493dc75 Adding CollapsingToolbar and Settings styles to Health Connect.
Test: Manual built and flashed app.
Bug: 244693342
Change-Id: I5863dc67c3b43d58da374ded0d4d38543a56b7c4
2022-09-08 14:21:50 +00:00
Sunny Shao
71ae129696 Fix the header can't be scrolling problem in landscape mode
- Settings header is restricted scrolling by this ag/15029686
- To void some pages can't show the contain part while heading unscrolling.
  We allow the header can be scrolling in the landscape mode.

Fixes: 207353353
Test: make RunSettingsRoboTests -j
Change-Id: I7de4e7cb8d86516ec039f5fe7d033097dca1c9d8
2022-08-11 15:31:20 +08:00
Edgar Wang
12aabbf433 Merge "Apply phrase based line breaking on most of Preference" into tm-qpr-dev am: e1ba912e3b am: a917e5b013
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19415041

Change-Id: I879db0f3324ea546b15a4333338527145631acde
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-04 09:55:01 +00:00
Edgar Wang
e8cff4feea Apply phrase based line breaking on most of Preference
- move related change to v33 folder for bater maintenance

Bug: 232992171
Test: manual
Change-Id: I269000147bddb027299367e2178f43597d8ab76c
2022-08-04 00:35:04 +00:00
George Lin
3105abbdd1 Merge "Change package name for merging to SettingsLibWidget" into tm-qpr-dev am: 1f2a3d9f37 am: c885ae3582
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19448612

Change-Id: I36b437596155d9bb753b42f6a6495c67805d6c40
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-01 17:10:10 +00:00
George Lin
771b0061b7 Change package name for merging to SettingsLibWidget
To have the modules merged to SettingsLibWidget, we changed the package
name in the Manifest to com.android.settingslib.widget

Test: WallpapaerPickerGoogle can successfully built after the merge of
modules
Bug: 240421545

Change-Id: If9eb4cefaa22c71eb8dad32618e84e1102c599df
2022-07-28 19:14:34 +00:00
Albert Kong
29888de92b Allowing libraries for styling the Privacy Sandbox Beta app.
Test: manual
Bug: 239428231
Change-Id: Iead479f53488a642a3f5ab69b9b19acf24017039
(cherry picked from commit 05c7a58408)
2022-07-22 18:55:17 +00:00
Edgar Wang
c3ba431972 Enable hyphenation on most of preference.
Bug: 217659992
Bug: 231924943
Bug: 229763000
Test: manual
Change-Id: Ia490c4c17a60004efd3a6f2d03b5eaaccc491a00
2022-05-24 12:39:42 +00:00
Sunny Shao
686ed4f3fd Set collapsing toolbar background color
-Set collapsing toolbar background as transparent.
-Let header and preference contain use the same background.

Bug: 230230017
Test: manual test
Change-Id: I3152d93b2ac34d73c2f877e719ea3c865a7ce58b
2022-05-06 11:49:38 +08:00
Sunny Shao
b39d4c77e7 Move codes to gerrit for CollapsingToolbar
Fixes: 228929356
Test: make RunSettingsLibRoboTests -j ROBOTEST_FILTER=com.android.settingslib.collapsingtoolbar
Change-Id: Ib48afdbb157b11a83d8f7e4ac52f9da7a9e5e9eb
2022-04-12 16:16:35 +08:00
Edgar Wang
b001361495 Fix null pointer expection when get CollapsingToolbrDelegate
Bug: 219413863
Test: robotest
Change-Id: I4b3b020cec7864da052eb6eeb36cdd9990a09858
2022-03-21 16:09:35 +00:00
Sunny Shao
1db6b9776c Add a new CollapsingCoordinatorLayout in CollapsingToolbar
- Add this widget which is wrapping the collapsing toolbar.
- This new widget can be directly used by the AppCompatActivity.

Bug: 215463210
Test: make RunSettingsLibRoboTests ROBOTEST_FILTER=com.android.settingslib.collapsingtoolbar
Change-Id: Id5ab5ff10ac691b8ff2997a0635f0047c1fa4f75
2022-01-26 16:42:04 +08:00
Edgar Wang
2dc1536010 Allow to use the collapsing toolbar without forcing specific inheritance structure on the host.
Allows for better code reuse across Activity and Fragment
All Activities/Fragments simply delegate to the helper class making them easy to maintain.

Bug: 211847783
Test: robotest
Change-Id: If863484c093069c653c7c6b9bd4ccc77f3eafad5
2021-12-23 23:33:42 +00:00
Mill Chen
23dd0bd4a1 Set CollapsingToolbar Title textColor
The original title color seems to be set incorrectly for all OEM
devices except for Pixel. This change stabilizes the color.

Bug: 196106314
Bug: 196614394
Test: manual test
Change-Id: I2b9f7ddec17d1d447cb7348e8f96cabb81e2e229
2021-08-14 03:48:12 +00:00
Mill Chen
5c84edacf0 Replace private attributes with public resources.
The change replaces all existing usage of private resources in
SettingsLib with corresponding public resources. The only exception
is android:string/config_headlineFontFamily where there's no proper
replaccement.

The library is currently used by bundled apps (such as SettingsGoogle)
and unbundled apps (such as PermissionController and
CellBroadcastReceiver). Since we still want these bundled apps to
reference config_headlineFontFamily properly while not breaking
unbundled apps due to them referencing private attributes, we added a
new attribute settingslib_config_headlineFontFamily (alongside with
other FontFamily variance for completeness) in
SettingsTheme/res/values-v31/strings.xml which points to
config_headlineFontFamily by default. Then, in separate CLs, we will add
resource overrides to these unbundled apps to replace the value of
settingslib_config_headlineFontFamily to point to a public value. While
this means that the style of the pages from the unbundled apps will be
different from the rest of SettingsLib clients, the change provides a
tactical fix to make sure that these unbundled apps won't crash when
shipped to other devices. We can address the issue at its core by
potentially exposing some private resources in future Android releases.

Bug: 191387775
Bug: 190964071
Bug: 196106314
Test: manual test to confirm this is a no-op CL.
Change-Id: Ie25950d9f54964aa40038a27b302ed017e4e4d15
2021-08-12 23:52:16 +08:00
Mill Chen
4fdb7c9f26 Support customize layout in CollapsingToolbarBaseActivity
We introduced the collapsing toolbar on S. To enable this feature needs
to correspondingly adjust the theme that the activity uses. However
these changes might cause some mainline module apps get crashed when
running on R. A customize layout is allowed to use for some cases that
need to roll back to the layout used in R.

Bug: 192395187
Test: visual verified
Change-Id: I9b409842198a2d52a6440cdd9ad68268293681f2
2021-07-14 21:47:49 +08:00
Hai Zhang
24dbdd58e1 Fix CollapsingToolbarBaseFragment crash on R.
The view with R.id.content_parent is a LinearLayout in the R layout
file, and will cause a ClassCastException on R.

Bug: 182960931
Bug: 183757373
Test: presubmit
Change-Id: I15bf8f14ac1e6b0986b040e25a2b5f57735b62a8
2021-07-07 23:02:25 +00:00
Mill Chen
4bc5bdeb78 Update dynamic height adjusting
The current dynamic height adjusting workaround might cause that a
flicker problem happens in the collapsing toolbar and it might cause
that the collapsing toolbar has different background colors in some
setting pages. The new Material library has already supported the
dynamic height adjusting for multi-line titles, so we will use the new
mechanism instead.

Fix: 191038325
Fix: 189896657
Test: visual verified
1) Navigate to permission pages
2) Observe the title and check if it has different background color and
is overlapping with the back arrow

Change-Id: Ib928ab628cb7838460264f704bebf5c7a2aa9a47
2021-07-02 21:56:23 +08:00
Mill Chen
5b58e6d2ae Add null checker to AppBarLayout
Fix: 191746368
Test: run atest CellBroadcastReceiverOemUnitTests on R
Change-Id: Id8130466fd282b68137ee8d848041f8607bf80a4
2021-07-01 12:24:57 +08:00
Mill Chen
f639c4ebe4 Merge "Add line spacing multiplier for CollapsingToolbarLayout" into sc-dev 2021-06-28 17:34:02 +00:00
Yi-Ling Chuang
99a680a50f Merge "Make CollapsingToolbarBaseActivity extend FragmentActivity" into sc-dev 2021-06-28 14:14:12 +00:00
Mill Chen
fbfd4ef12e Add line spacing multiplier for CollapsingToolbarLayout
Since there is a problem with a small line spacing between multiline
title of collapsing toolbar in a few locales, that caused the title is
overlapping with each other. Enlarging the line spacing by using
lineSpacingMultiplier to fix it.

Fix: 183223866
Test: visual verified
1) Change to MY locale
2) Navigate to Settings > Sounds & vibration > Do not disturb > Alarms &
other interruptions
3) Observe the title and check if it is overlapping with each other

Change-Id: Ib35ae0edb6fb168293bdb39a926bad5049eece34
2021-06-28 18:24:44 +08:00
Yi-Ling Chuang
acf451f9a7 Make CollapsingToolbarBaseActivity extend FragmentActivity
Since SettingsTransitionActivity is reverted, make
CollapsingToolbarBaseActivity extend FragmentActivity directly.

Bug: 191335572
Test: rebuild
Change-Id: I6eda699ec97f11f5a89a4bce7be041960c5d6e32
2021-06-28 18:08:11 +08:00
TreeHugger Robot
6f383b1b8e Merge "Export the instance of CoordinatorLayout" into sc-dev 2021-06-28 08:35:04 +00:00
Mill Chen
5f2725d334 Export the instance of CoordinatorLayout
Providing an API to access to the instance of CoordinatorLayout in
collapsing_toolbar_base_layout, that facilitates the insertion of
components as a direct child of CoordinatorLayout.

Bug: 189423430
Test: rebuild permission controller apk
Change-Id: Iebd7a6cd0cb5bdc38c70343a86736e91f58ce254
2021-06-26 06:10:26 +08:00
Mill Chen
5165374be0 Fix NPE crash in PermissionController
Fix: 192101825
Test: manual test
Change-Id: I18dec61f41bedb121863f78898e105b1e3f82bf9
2021-06-26 05:57:33 +08:00
TreeHugger Robot
43aeef53ea Merge "Fix a flicker problem on top app bar" into sc-dev 2021-06-24 13:32:55 +00:00
Mill Chen
b18068a0b9 Fix a flicker problem on top app bar
The height of top app bar area is dependent on the line count of title.
This mechanism is always triggered when entering either subsetting page
or rotating the screen, regardless the state of collapsing toolbar. That
is saying this mechanism caused a flicker problem or a title in wrong
color. The mechanism will be updated to check the state of collapsing
toolbar to make sure that it is only triggered if the collapsing toolbar
is in expanded state.

This changes also added null checker to app bar since there's no
AppBarLayout existing in the older version of Android.

Fix: 186419089
Fix: 187709056
Fix: 191746368
Test: visual verified
1) Navigate to a subsetting page with multiline title
2) Rotate the screen to landscape mode and collapse the title
3) Rotate the screen to portrait mode and see if the title is in
collapsing state

Change-Id: Ica868245e0b0a799f76b7f953c606c8e543375f6
2021-06-24 17:54:27 +08:00
Mill Chen
98360bcb04 Update the text size for collapsedTextAppearance
Fix: 177967930
Test: visual verified
1) Navigate to either sub-setting page
2) Rotate the screen to landscape mode
3) See if the size of title is the same as the one in portrait mode

Change-Id: I91621b6be298ae886432d3b06996be0ccc7b974c
2021-06-23 15:31:18 +08:00
TreeHugger Robot
6c10325d9c Merge "Disable scrolling behavior for collapsing toolbar" into sc-dev 2021-06-21 21:18:18 +00:00
Mill Chen
3a9be3a6c6 Disable scrolling behavior for collapsing toolbar
We intended to make subsetting pages disable the scrolling behavior
within the collapsing toolbar area. The collapsing toolbar is still
able to be expanded/collapsed depending on the content of page.

Fix: 191614437
Fix: 189003332
Test: manual test
Cannot scroll/drag with the collapsing toolbar area

Change-Id: Ifa545a1720c64be742f85b34188516eb9c6683df
2021-06-21 16:47:03 +08:00
Yi-Ling Chuang
ff4ca837de Revert transition codes in SettingsLib
Bug: 191335572
Change-Id: Ib6be344b84a531c7261a7a69f4f9d042c8e24186
2021-06-18 18:49:13 +08:00
TreeHugger Robot
b0e554dc8f Merge "Update the collapsing toolbar layout" into sc-dev 2021-06-02 07:59:22 +00:00
TreeHugger Robot
1028f0b624 Merge "Make the content animated together with the app bar" into sc-dev 2021-05-27 23:31:38 +00:00
Mill Chen
cb4bb08c5e Update the collapsing toolbar layout
- Updating the height of title area to fulfill the spec
- Increasing the trigger points of animation for fade mode based
  on the line count of title, so the overlapping problem is
  prevented from the title scrolling up the title area
- Removing getLineCountWithReflection method since
  CollapsingToolbarLayout has already been supporting this method

Fix: 188608451
Fix: 189068911
Test: visual verified
Change-Id: I8dac87458f13d79e1941a4f2b3e961ac4d6a2944
2021-05-27 18:15:00 +08:00
Yi-Ling Chuang
c4ab5a4b5a Make the content animated together with the app bar
Set transitionGroup to the whole page layout so all the content could be
animated in together.

Fixes: 189417218
Test: rebuild and launch All apps page
Change-Id: Ib584fc9ea272b9c61aec3067440fe95435220735
2021-05-27 16:53:03 +08:00
Yi-Ling Chuang
abf096f21f Provide a way to suppress page transitions.
Some pages are not suitable to apply the page transition, for example,
launching an acitivity that is depending on a value in the config file.

External apps that are not applying the same transition may be launched
in this case, applying the transition may lead to some unexpected
behaviour.

Hence, create a way to ignore the transition. Also refactor some logics.

Fixes: 189299479
Test: rebuild
Change-Id: Iebb47b9e0b0d9a3496f7e5f0c6cf1cd3d8d75031
2021-05-26 18:59:56 +08:00
Hai Zhang
32a20b392c Improve SettingsTransitionActivity for standalone usage.
- Allow subclass to override when the transition should be enabled,
because we may not want to enable it on other form factors, e.g. on
wear.

- Retrieve the Toolbar instance by overriding setActionBar() which
should be called by any activity using Toolbar as its action bar. Even
if there's any activity not using Toolbar as action bar, it won't
behave well with our transition anyway.

- Refactored ActivityOptions Bundle creation logic to simplify the
code. I did the refactoring originally for sharing it with a new
SettingsTransitionFragment, but then realized doing it in fragment
would be very tedious and unreliable. Still the refactoring looks a
good simplification to me.

- Don't override onOptionsItemSelected() in SettingsTransitionActivity
because different form factors might be expecting different behaviors
for the home/up indicator on Toolbar, e.g. we might expand/collapse a
drawer or do something else instead of finishing the current activity
on Tablet.

    The original implementation that calls onBackPressed() is also
technically incorrect because pressing up is a different action. The
reason the original implementation did so is probably for enabling
transition upon activity finish, but that should actually be done by
calling finishAfterTransition(), so I've fixed the
CollapsingToolbarBaseActivity to call finishAfterTransition() instead
of finish(). This shouldn't bring any regression to existing users of
SettingsTransitionActivity as well because currently the only user of
it is CollapsingToolbarBaseActivity.

Bug: 177638625
Test: manually on R and S platforms
Change-Id: I3c5955db3753f00604b625bd21bf7e78f237ec15
2021-05-13 11:24:48 -07:00
Yi-Ling Chuang
98362d0ee0 Merge existing bundle with ActivityOptions
Use Bundle.putAll() to take both the bundle passed in to the
startActivity(Intent, Bundle) and also the new created ActivityOptions
bundle, so no extra info will be lost.

Test: rebuild and add log to make sure all bundle info are kept
Bug: 187471344
Change-Id: I802e17893b86fd4eacb812b4a7ab20b5167790fe
2021-05-07 11:44:50 +08:00
TreeHugger Robot
228f33d9dd Merge "Fix Settings crash" into sc-dev 2021-05-06 11:56:03 +00:00
Mill Chen
2694cd8c42 Fix Settings crash
After enabling the view attribute inspection, Settings always gets
crashed when entering any sub-setting pages. It's due to the undefined
value set in the app:statusBarScrim.

Using app:statusBarScrim="@empty" is trying to clear the
CollapsingToolbarLayout's default statusBarScrim. So the value of the
attribute can be replaced with other value that indicated null. This
change also needs to make sure the collapsing toolbar leaves the same
behavior as the one before changing. Eventually we use
app:statusBarScrim="@null" instead to fix this issue.

Fix: 186055380
Test: manual test
1) Enable developer options
2) Settings > System > Developer options
3) Enable view attribute inspection
4) See if Settings gets crashed

Change-Id: Ic829bb11b67d5cfd4de626f79d4a5c3e0ebd8e67
2021-05-06 16:06:27 +08:00
Yi-Ling Chuang
d321b8690e Set background color to the AppBarLayout
During the page transition, the back arrow on the action bar is acting
as a shared element. The transition seems to render the shared element
first and then the other parts of the UI. As the background color of the
AppBarLayout is transparent, so during the rendering process, the UI
will flash/blink for a few milliseconds and the content behind the
AppBarLayout will be shown.

Hence, set a background color to the AppBarLayout to fix this issue.

Fixes: 186701900
Test: rebuild and review Display Settings page transition
Change-Id: Id009b47d983adafd8b92af585b5089c68de0afc3
2021-05-04 19:14:19 +08:00
Mill Chen
1b2e778a91 Make collapsing toolbar load font synchronously
Since collapsing toolbar might load the font asynchronously, it caused
that some settings pages are seeing a flicker on its title. This change
is using TextAppearanceConfig.setShouldLoadFontSynchronously(true)
method to have title font load synchronously, which would remove the
flicker problem.

Bug: 182232144
Test: visual verified
1) Settings > Notifications > Notification history
2) See if there's a flicker on title

Change-Id: I80f5c5862ea6408bfb372d61a11122fb0240e45d
2021-04-28 11:52:54 +08:00
Yi-Ling Chuang
ee0975a71b Enable settings transition
As the framework bug is fixed, re-enable the transition by correcting
the conditions.

Bug: 177480673
Test: rebuild and test on the NotificaitonHistory page
Change-Id: Icb62dad12ba5889f750d0ea2765ae76186fc79e7
2021-04-22 20:01:45 +08:00
Mill Chen
1d07de9e9c Update the new animation for collapsing toolbar
Bug: 183496853
Test: visual verified
1) Settings -> Notifications -> Notification history
2) Observe and see if the new animation is applied

Change-Id: Ic4b584b10a27c8e17075b044e659b5dc3e3fec87
2021-04-20 11:58:21 +08:00
Yi-Ling Chuang
c9cd83a193 Create SettingsTransitionActivity
SettingsTransitionActivity is an abstract activity being in charge of
the transition feature. Activities extending it will get settings
transition applied.

We make CollapsingToolbarBaseActivity extend this activity. Clients
extending CollapsingToolbarBaseActivity will have both app bar behaviour
and the transition applied.

Also add android:transitionName into the collapsing layout, so the
transition would start from the back arrow on the action bar.

And bump the min_sdk to 29 to relevant dependencies.

Bug: 177480673
Test: rebuild and apply it on NotificationHistoryActivity
Change-Id: I8e070a0f07080d027fec7b944bdcdbb758ae44b7
2021-04-09 11:09:52 +08:00
TreeHugger Robot
c374ad5d3c Merge "Add CollapsingToolbarBaseFragment for implementing collapsing toolbar." into sc-dev 2021-03-24 19:00:17 +00:00
Jason Chiu
731f73bec9 Update font family for collapsing toolbar title
Bug: 178068045
Test: visual, robotest
Change-Id: Icc30d35cc564ffd845ef2e60530bd367c5a7645b
2021-03-24 12:56:40 +08:00
Hai Zhang
e1f6cb431e Add CollapsingToolbarBaseFragment for implementing collapsing toolbar.
In apps following the pattern to do all the things in fragments, and
possibly loading different fragments for different form factors, their
activity would need to remain a stub and can't contain phone-only
layout, making CollapsingToolbarBaseActivity unsuitable for them. So
add a CollapsingToolbarBaseFragment for integrating the same
functionality in fragments.

The layout files are also moved to be under the same name, but
different content depending on the platform version, to simplify the
logic loading them.

Bug: 177638625
Test: manual
Change-Id: Ie9e2a147dd4bd2c1ee3924b1afc4c10a6f735e59
2021-03-11 18:34:14 -08:00
Chen Xu
4427bd88f1 Merge "Wireless emergency alerts Widget library changes" into sc-dev 2021-03-11 04:51:40 +00:00