New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Preserve Toolbar Subtitle on page orientation change #528

Merged
merged 5 commits into from Nov 16, 2016

Conversation

Projects
None yet
4 participants
@adrianknight89
Contributor

adrianknight89 commented Nov 14, 2016

Description of Change

When page orientation is changing, AppCompat Toolbar is being destroyed and rebuilt. However, this results in old values not being preserved if they cannot be replicated from other elements.

Bugs Fixed

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of master at time of PR
  • Changes adhere to coding standard
  • Consolidate commits as makes sense
@@ -541,6 +541,8 @@ void RemovePage(Page page)
void ResetToolbar()
{
AToolbar oldToolbar = _toolbar;

This comment has been minimized.

@adrianknight89

adrianknight89 Nov 14, 2016

Contributor

Since this is a local variable, it should go out of scope and not cause a memory leak. _toolbar will represent a different object in memory after it's set to null (a few lines below) and new-ed up.

@adrianknight89

adrianknight89 Nov 14, 2016

Contributor

Since this is a local variable, it should go out of scope and not cause a memory leak. _toolbar will represent a different object in memory after it's set to null (a few lines below) and new-ed up.

// Preserve old values that can't be replicated by calling methods above
if (_toolbar != null)
_toolbar.Subtitle = oldToolbar.Subtitle;

This comment has been minimized.

@adrianknight89

adrianknight89 Nov 14, 2016

Contributor

This can be expanded in the future if other properties need to be preserved as well.

@adrianknight89

adrianknight89 Nov 14, 2016

Contributor

This can be expanded in the future if other properties need to be preserved as well.

@jassmith jassmith merged commit 9bf923a into xamarin:master Nov 16, 2016

3 checks passed

OSX-Debug-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: OSX Debug : Running
Details
Windows-Debug-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: Windows Debug : Tests passed: 3461, ignored: 8
Details
iOS10-UITests Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: UI Tests :: OSX Test Cloud Package - Run iOS Unified iOS10 : Running
Details

@samhouts samhouts added this to the 2.3.4 milestone Jun 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment