From d12e33cdf70fe3356676d0cfa97a7d39eb7fb3e1 Mon Sep 17 00:00:00 2001 From: dgngulcan Date: Sun, 3 Mar 2019 16:53:17 -0500 Subject: [PATCH] fix toolbar menu item visibilities --- .../main/java/com/droidfeed/ui/module/main/MainViewModel.kt | 2 +- app/src/main/res/layout/activity_main_app_bar.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/droidfeed/ui/module/main/MainViewModel.kt b/app/src/main/java/com/droidfeed/ui/module/main/MainViewModel.kt index d000730..de6f8b9 100644 --- a/app/src/main/java/com/droidfeed/ui/module/main/MainViewModel.kt +++ b/app/src/main/java/com/droidfeed/ui/module/main/MainViewModel.kt @@ -122,13 +122,13 @@ class MainViewModel @Inject constructor( fun onMenuClicked() { val isCurrentlyVisible = isMenuVisible.value ?: false isMenuVisible.postValue(!isCurrentlyVisible) - isBookmarksButtonVisible.postValue(!isCurrentlyVisible) } fun onBookmarksEvent() { val isCurrentlySelected = (isBookmarksButtonSelected.value ?: false) isBookmarksShown.postValue(!isCurrentlySelected) isBookmarksButtonSelected.postValue(!isCurrentlySelected) + isFilterButtonVisible.postValue(isCurrentlySelected) } fun onToolbarTitleClicked() { diff --git a/app/src/main/res/layout/activity_main_app_bar.xml b/app/src/main/res/layout/activity_main_app_bar.xml index 0f325a2..3634064 100644 --- a/app/src/main/res/layout/activity_main_app_bar.xml +++ b/app/src/main/res/layout/activity_main_app_bar.xml @@ -76,7 +76,7 @@ android:onClick="@{(v)->viewModel.onBookmarksEvent()}" android:src="@drawable/sl_menu_bookmark_drawable" app:isSelected="@{viewModel.isBookmarksButtonSelected}" - app:isVisible="@{viewModel.isBookmarksButtonVisible}" + app:isVisible="@{viewModel.isBookmarksButtonVisible && !viewModel.isMenuVisible()}" app:layout_constraintBottom_toBottomOf="@+id/btnFilter" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="@+id/btnFilter" /> @@ -87,7 +87,7 @@ android:layout_marginEnd="@dimen/spacing_small" android:onClick="@{(v)->viewModel.onSourceFilterClicked()}" android:src="@drawable/ic_filter_list_accent_24dp" - app:isVisible="@{viewModel.isFilterButtonVisible}" + app:isVisible="@{viewModel.isFilterButtonVisible && !viewModel.isMenuVisible()}" app:layout_constraintBottom_toBottomOf="@+id/txtToolbarTitle" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="@+id/txtToolbarTitle" />