Ejemplo n.º 1
0
        /// <summary>
        /// Add fragment specific menu items to the main toolbar
        /// </summary>
        /// <param name="menu"></param>
        /// <param name="inflater"></param>
        public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
        {
            // Inflate the menu for this fragment
            inflater.Inflate(Menu, menu);

            // Show or hide the collapse icon
            collapseItem = menu.FindItem(Resource.Id.action_collapse);
            collapseItem?.SetVisible(expandedGroupCount > 0);

            // If there is a filter selector then bind to it
            FilterSelector?.BindToMenu(menu.FindItem(Resource.Id.filter));

            // Bind the SortSelector
            BaseModel.SortSelector.BindToMenu(menu.FindItem(Resource.Id.sort), Context, this);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Called when the fragment is destroyed
        /// Release any resources help by the fragment
        /// </summary>
        public sealed override void OnDestroyView()
        {
            FragmentView             = null;
            commandCallback.Callback = null;
            FilterSelector?.BindToMenu(null);

            // Turn off the timer
            userInteractionTimer.Change(Timeout.Infinite, Timeout.Infinite);

            // Some BaseModel resources

            // Remove this object from the sort selector
            BaseModel.SortSelector.Reporter = null;

            // Save the scroll position
            BaseModel.ListViewState = ListView.OnSaveInstanceState();

            // Allow derived fragments to release their own resources
            ReleaseResources();
            base.OnDestroyView();
        }