From 15254b961825068c73b38eccfb12967e97b7317f Mon Sep 17 00:00:00 2001 From: Saptak Manna Date: Tue, 19 Dec 2023 13:28:16 +0530 Subject: [PATCH] Call setUpDrawer if binding is already initialized --- .../drawer/NavigationDrawerFragmentPresenter.kt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/src/main/java/org/oppia/android/app/drawer/NavigationDrawerFragmentPresenter.kt b/app/src/main/java/org/oppia/android/app/drawer/NavigationDrawerFragmentPresenter.kt index ecfa05f3782..daddc7a8023 100644 --- a/app/src/main/java/org/oppia/android/app/drawer/NavigationDrawerFragmentPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/drawer/NavigationDrawerFragmentPresenter.kt @@ -374,6 +374,21 @@ class NavigationDrawerFragmentPresenter @Inject constructor( this.drawerLayout = drawerLayout this.toolbar = toolbar this.menuItemId = menuItemId + + /** + * [setUpDrawer] is called directly if binding is already initialized. + * Otherwise, [setUpDrawer] is called from [handleCreateView]. + * + * Note: [binding] is already initialized when [initializeDrawer] is called via [onRestart] + * and [handleCreateView] will not be called in that case. + */ + if (this::binding.isInitialized) { + setUpDrawer( + this.drawerLayout, + this.toolbar, + this.menuItemId + ) + } } /**