*Summary:*
When applying a custom theme to an Android app or activity, the theme applied to an
ActionBar
or
Toolbar
title is lost when changing app orientation. It ends up resetting back to the default theme.
This bug was introduced into 7.5.0.RC.
*Steps to reproduce:*
Set up project to build with 7.5.0.RC.
Build and run to an Android device.
Clear the alert dialog displayed on app startup.
Notice that the top ActionBar title has white text.
Rotate the device from portrait to landscape.
Notice that the top ActionBar title now has black text. (This is the bug.)
*Result:*
Before rotating device. Notice the title text is white.
!Good.png|thumbnail!
After rotating, notice the title is now black. This is the bug.
_(The white gap on left side is an Android P notch, which can't be captured. This is not an issue.)_
!Bad.png|thumbnail!
*Cause:*
The new [TiToolbarStyleHandler.java](
https://github.com/appcelerator/titanium_mobile/blob/master/android/titanium/src/java/org/appcelerator/titanium/view/TiToolbarStyleHandler.java) class added to 7.5.0.RC is hard-coded to use the "style.Widget_AppCompat_Toolbar" theme. We need to find a way to acquire the theme resource ID applied to the activity and use that instead. This will solve it for the
ActionBar
as well since it's internally implemented as a
Toolbar
on Google's end.
PR (master): https://github.com/appcelerator/titanium_mobile/pull/10431 PR (7.5.x): https://github.com/appcelerator/titanium_mobile/pull/10432
FR Passed. PR Merged.
Verified the fix in SDK 7.5.0.v20181107142952. Closing.