Skip to content

Commit

Permalink
Bottom navbar items now toggle drawers instead of just opening them
Browse files Browse the repository at this point in the history
  • Loading branch information
CookieJarApps committed Jan 22, 2022
1 parent 75941b3 commit 913c81e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -812,12 +812,12 @@ abstract class BrowserActivity : ThemableBrowserActivity(), BrowserView, UIContr
when(item.itemId) {
R.id.tabs -> {
drawer_layout.closeDrawer(getBookmarkDrawer())
drawer_layout.openDrawer(getTabDrawer())
toggleDrawer(drawer_layout, getTabDrawer())
true
}
R.id.bookmarks -> {
drawer_layout.closeDrawer(getTabDrawer())
drawer_layout.openDrawer(getBookmarkDrawer())
toggleDrawer(drawer_layout, getBookmarkDrawer())
true
}
R.id.forward -> {
Expand All @@ -838,6 +838,15 @@ abstract class BrowserActivity : ThemableBrowserActivity(), BrowserView, UIContr
}
}

private fun toggleDrawer(layout: DrawerLayout, drawer: View) {
if(layout.isDrawerOpen(drawer)){
layout.closeDrawer(drawer)
}
else{
layout.openDrawer(drawer)
}
}

public override fun onWindowVisibleToUserAfterResume() {
super.onWindowVisibleToUserAfterResume()
toolbar_layout.translationY = 0f
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class PopUpClass {
when(userPreferences.useTheme){
AppTheme.DARK -> popupView.findViewById<ConstraintLayout>(R.id.transparent_container).setBackgroundResource(R.drawable.toolbar_dark)
AppTheme.BLACK -> popupView.findViewById<ConstraintLayout>(R.id.transparent_container).setBackgroundResource(R.drawable.toolbar_black)
else -> {}
}
}

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/cookiegames/smartcookie/utils/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ object Utils {
var reloadButtonCode = "<button onclick=\"reload();\" id=\"reload-button\" class=\"blue-button text-button reload\">$reload</button>"
when(showButton){
false -> reloadButtonCode = ""
else -> {}
}

return "<html>" +
Expand Down Expand Up @@ -209,6 +210,7 @@ object Utils {
val goBackButton = "<button onclick=\"window.history.back();\" id=\"reload-button\" class=\"blue-button text-button reload\">$goBackString</button>"
when(showProceedButton){
false -> proceedButton = ""
else -> {}
}

return "<html>" +
Expand Down

0 comments on commit 913c81e

Please sign in to comment.