You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a toolbar whose subtitle is set programmatically based on arguments supplied to the fragment. If I use Calligraphy, the subtitle is cleared after it is set. The culprit is Calligraphy.
Calligraphy sets a ToolbarLayoutListener whenever a layout is inflated that contained a Toolbar. When this listener is registered, it immediately takes a snapshot of the value of the subtitle. On global layout, it then restores the value of the subtitle to the value it snapshotted. The issue is, if I set the subtitle of the Toolbar between these events (eg. in onViewCreated()), then that value is discarded.
I'm not certain why Calligraphy needs to snapshot the subtitle but this behavior is unintuitive and the only fix I can think of is registering my own GlobalLayoutListener and setting the subtitle after Calligraphy is done restoring the snapshotted subtitle.
I have a toolbar whose subtitle is set programmatically based on arguments supplied to the fragment. If I use
Calligraphy
, the subtitle is cleared after it is set. The culprit isCalligraphy
.Calligraphy sets a
ToolbarLayoutListener
whenever a layout is inflated that contained aToolbar
. When this listener is registered, it immediately takes a snapshot of the value of the subtitle. On global layout, it then restores the value of the subtitle to the value it snapshotted. The issue is, if I set the subtitle of theToolbar
between these events (eg. inonViewCreated()
), then that value is discarded.I'm not certain why
Calligraphy
needs to snapshot the subtitle but this behavior is unintuitive and the only fix I can think of is registering my own GlobalLayoutListener and setting the subtitle afterCalligraphy
is done restoring the snapshotted subtitle.Code where caligraphy registers the global layout listener: https://github.com/InflationX/Calligraphy/blob/master/calligraphy/src/main/java/io/github/inflationx/calligraphy3/Calligraphy.java#L158
Code where caligraphy is snapshotting the value of the subtitle: https://github.com/InflationX/Calligraphy/blob/master/calligraphy/src/main/java/io/github/inflationx/calligraphy3/Calligraphy.java#L230
Code where caligraphy restores the value of the subtitle: https://github.com/InflationX/Calligraphy/blob/master/calligraphy/src/main/java/io/github/inflationx/calligraphy3/Calligraphy.java#L253
The text was updated successfully, but these errors were encountered: