summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.ControlGallery.Android
diff options
context:
space:
mode:
authorE.Z. Hart <hartez@users.noreply.github.com>2016-05-10 11:15:47 -0600
committerJason Smith <jason.smith@xamarin.com>2016-05-10 10:15:47 -0700
commit5acafedb8e3e2ace8e66f9ff20655d5d96e8ed97 (patch)
treec816ea1127275953bcc458315e1714fd0cb17003 /Xamarin.Forms.ControlGallery.Android
parentd4a5bb8dfcb39949451fe0e5390a684f116cc288 (diff)
downloadxamarin-forms-5acafedb8e3e2ace8e66f9ff20655d5d96e8ed97.tar.gz
xamarin-forms-5acafedb8e3e2ace8e66f9ff20655d5d96e8ed97.tar.bz2
xamarin-forms-5acafedb8e3e2ace8e66f9ff20655d5d96e8ed97.zip
[Android] Isolate fragment management for children of MasterDetailPage (#136)
* Isolate fragment management for children of MasterDetailPage in AppCompat If a MasterDetailPage hosts NavigationPages or TabbedPages in either the Master or Detail sections, wrap those pages in their own Fragment (and ChildFragmentManager) to isolate their Fragment management operations and avoid recursive entry into the executePendingTransactions method Also fix a disposal bug in the custom MDP renderer in Control Gallery * Remove MDP Split setting that breaks test on iPad
Diffstat (limited to 'Xamarin.Forms.ControlGallery.Android')
-rw-r--r--Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs28
-rw-r--r--Xamarin.Forms.ControlGallery.Android/Properties/AndroidManifest.xml2
2 files changed, 24 insertions, 6 deletions
diff --git a/Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs b/Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs
index b1bf1fe8..1faa7a98 100644
--- a/Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs
+++ b/Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs
@@ -4,6 +4,7 @@ using Android.App;
using System.Collections.Generic;
using Android.Views;
using System.Collections;
+using System.ComponentModel;
using System.Linq;
using Xamarin.Forms.Controls;
using Xamarin.Forms.Platform.Android;
@@ -29,9 +30,10 @@ using System.Reflection;
#endif
namespace Xamarin.Forms.ControlGallery.Android
{
-
public class NativeDroidMasterDetail : Xamarin.Forms.Platform.Android.AppCompat.MasterDetailPageRenderer
{
+ MasterDetailPage _page;
+
protected override void OnElementChanged(VisualElement oldElement, VisualElement newElement)
{
base.OnElementChanged(oldElement, newElement);
@@ -41,16 +43,32 @@ namespace Xamarin.Forms.ControlGallery.Android
return;
}
- MasterDetailPage page = newElement as MasterDetailPage;
- page.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) => pChange();
- page.LayoutChanged += Page_LayoutChanged;
+ _page = newElement as MasterDetailPage;
+ _page.PropertyChanged += Page_PropertyChanged;
+ _page.LayoutChanged += Page_LayoutChanged;
+ }
+
+ void Page_PropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs)
+ {
+ pChange();
}
- private void Page_LayoutChanged(object sender, EventArgs e)
+ void Page_LayoutChanged(object sender, EventArgs e)
{
pChange();
}
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && _page != null)
+ {
+ _page.LayoutChanged -= Page_LayoutChanged;
+ _page.PropertyChanged -= Page_PropertyChanged;
+ }
+
+ base.Dispose(disposing);
+ }
+
public void pChange()
{
if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
diff --git a/Xamarin.Forms.ControlGallery.Android/Properties/AndroidManifest.xml b/Xamarin.Forms.ControlGallery.Android/Properties/AndroidManifest.xml
index 693419a7..512c737a 100644
--- a/Xamarin.Forms.ControlGallery.Android/Properties/AndroidManifest.xml
+++ b/Xamarin.Forms.ControlGallery.Android/Properties/AndroidManifest.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="AndroidControlGallery.AndroidControlGallery" android:installLocation="auto">
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="23" />
<uses-permission android:name="android.permission.INTERNET" />