protected override void Dispose(bool disposing) { if (disposing) { if (Tracker != null) { Tracker.Dispose(); Tracker = null; } if (_detailLayout != null) { _detailLayout.Dispose(); _detailLayout = null; } if (_masterLayout != null) { _masterLayout.Dispose(); _masterLayout = null; } //Device.Info.PropertyChanged -= DeviceInfoPropertyChanged; if (_page != null) { MasterDetailPageController.BackButtonPressed -= OnBackButtonPressed; _page.PropertyChanged -= HandlePropertyChanged; _page.Appearing -= MasterDetailPageAppearing; _page.Disappearing -= MasterDetailPageDisappearing; //_page.ClearValue(Platform.RendererProperty); _page = null; } } base.Dispose(disposing); }
public void SetElement(VisualElement element) { MasterDetailPage oldElement = _page; _page = element as MasterDetailPage; _detailLayout = new MasterDetailContainer(_page, false, Context) { LayoutParameters = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent) }; var parameters = new CoordinatorLayout.LayoutParams(new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent) { Gravity = (int)GravityFlags.Start }); parameters.Behavior = new AnchorBottomSheetBehavior(); _masterLayout = new MasterDetailContainer(_page, true, Context) { LayoutParameters = parameters, }; _masterLayout.RequestLayout(); AddView(_detailLayout); AddView(_masterLayout); behaviour = AnchorBottomSheetBehavior.From(_masterLayout); behaviour.PeekHeight = (int)(NowPlayingPage.TotalMiniBarHeight * Android.NGraphicsExtensions.Scale); behaviour.DragChanged = (percent) => { var panel = _page as SlideUpPanel; if (panel != null) { panel.PercentVisible = (float)percent; } }; var activity = Context as Activity; //activity.ActionBar.SetDisplayShowHomeEnabled(true); //activity.ActionBar.SetHomeButtonEnabled(true); UpdateBackgroundColor(_page); UpdateBackgroundImage(_page); OnElementChanged(oldElement, element); if (oldElement != null) { ((IMasterDetailPageController)oldElement).BackButtonPressed -= OnBackButtonPressed; } if (_page != null) { MasterDetailPageController.BackButtonPressed += OnBackButtonPressed; } if (Tracker == null) { Tracker = new VisualElementTracker(this); } _page.PropertyChanged += HandlePropertyChanged; _page.Appearing += MasterDetailPageAppearing; _page.Disappearing += MasterDetailPageDisappearing; UpdateMaster(); UpdateDetail(); //Device.Info.PropertyChanged += DeviceInfoPropertyChanged; SetGestureState(); Presented = _page.IsPresented; //AddDrawerListener(this); //if (element != null) // element.SendViewInitialized(this); if (element != null && !string.IsNullOrEmpty(element.AutomationId)) { ContentDescription = element.AutomationId; } }