Skip to content

Commit

Permalink
Merge pull request #35 from dgngulcan/bookmark-icon-dissaperance
Browse files Browse the repository at this point in the history
fix toolbar menu item visibilities
  • Loading branch information
dgngulcan authored Mar 3, 2019
2 parents e442882 + d12e33c commit 1d2221a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_main_app_bar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand All @@ -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" />
Expand Down

0 comments on commit 1d2221a

Please sign in to comment.