From 953c9988813d2a4fd3021aee7437b3ef94e7c859 Mon Sep 17 00:00:00 2001 From: Ivan Vlasov Date: Fri, 22 Mar 2019 00:13:45 +0300 Subject: [PATCH] Added onPrepareOptionsMenu method to ViewController --- .../navigation/fragments/ViewControllerFragment.kt | 4 ++++ .../navigation/viewcontrollers/ViewController.kt | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/navigation/src/main/java/ru/touchin/roboswag/components/navigation/fragments/ViewControllerFragment.kt b/navigation/src/main/java/ru/touchin/roboswag/components/navigation/fragments/ViewControllerFragment.kt index 314a8a6..22a70d7 100644 --- a/navigation/src/main/java/ru/touchin/roboswag/components/navigation/fragments/ViewControllerFragment.kt +++ b/navigation/src/main/java/ru/touchin/roboswag/components/navigation/fragments/ViewControllerFragment.kt @@ -171,6 +171,10 @@ open class ViewControllerFragment( */ open fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) = Unit + /** + * Prepare the standard options menu to be displayed. This is + * called right before the menu is shown, every time it is shown. + * You can use this method to efficiently enable/disable items or otherwise + * dynamically modify the contents. + * + * @param menu The options menu as last shown or first initialized by onCreateOptionsMenu(). + * + * @see [Fragment.hasOptionsMenu] + * @see [onCreateOptionsMenu] + */ + open fun onPrepareOptionsMenu(menu: Menu?) = Unit + /** * Calls right after construction of [ViewController]. * Happens at [ViewControllerFragment.onActivityCreated].