diff options
author | adrianknight89 <adrianknight89@outlook.com> | 2016-11-16 14:45:58 -0600 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2016-11-16 12:45:58 -0800 |
commit | 9bf923a3dd893b4629bc0c59acf1e84298e60b2b (patch) | |
tree | a5a76d62816c86f4f7b09efdf91e78f799fd83d2 | |
parent | 243d9e0c6727a6610a6e1034775cf336ccfbf1e2 (diff) | |
download | xamarin-forms-9bf923a3dd893b4629bc0c59acf1e84298e60b2b.tar.gz xamarin-forms-9bf923a3dd893b4629bc0c59acf1e84298e60b2b.tar.bz2 xamarin-forms-9bf923a3dd893b4629bc0c59acf1e84298e60b2b.zip |
[Android] Preserve Toolbar Subtitle on page orientation change (#528)
* add ability to preserve toolbar values
* added null check
* better fix
* fix indentation
* fixed comment
-rw-r--r-- | Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs b/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs index 0b7ed763..518e983d 100644 --- a/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs +++ b/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs @@ -541,6 +541,8 @@ namespace Xamarin.Forms.Platform.Android.AppCompat void ResetToolbar() { + AToolbar oldToolbar = _toolbar; + _toolbar.RemoveFromParent(); _toolbar.NavigationClick -= BarOnNavigationClick; _toolbar = null; @@ -549,6 +551,10 @@ namespace Xamarin.Forms.Platform.Android.AppCompat RegisterToolbar(); UpdateToolbar(); UpdateMenu(); + + // Preserve old values that can't be replicated by calling methods above + if (_toolbar != null) + _toolbar.Subtitle = oldToolbar.Subtitle; } void SetupToolbar() @@ -838,4 +844,4 @@ namespace Xamarin.Forms.Platform.Android.AppCompat } } } -} +}
\ No newline at end of file |