1
0
Fork 0

For #11892: Remove dynamic calls to setupNavigationToolbar

This is a speculative fix for 11892 crash.
The side effect is that the back button will be visible in bookmarks root.
master
ValentinTimisica 2020-06-26 14:08:50 +03:00 committed by Emily Kager
parent 93247e0b2f
commit 9f5c8819d3
3 changed files with 1 additions and 13 deletions

View File

@ -367,11 +367,11 @@ open class HomeActivity : LocaleAwareAppCompatActivity() {
* Everyone should call this instead of supportActionBar. * Everyone should call this instead of supportActionBar.
*/ */
fun getSupportActionBarAndInflateIfNecessary(): ActionBar { fun getSupportActionBarAndInflateIfNecessary(): ActionBar {
// Add ids to this that we don't want to have a toolbar back button
if (!isToolbarInflated) { if (!isToolbarInflated) {
navigationToolbar = navigationToolbarStub.inflate() as Toolbar navigationToolbar = navigationToolbarStub.inflate() as Toolbar
setSupportActionBar(navigationToolbar) setSupportActionBar(navigationToolbar)
// Add ids to this that we don't want to have a toolbar back button
setupNavigationToolbar() setupNavigationToolbar()
isToolbarInflated = true isToolbarInflated = true

View File

@ -13,7 +13,6 @@ import kotlinx.android.synthetic.main.component_bookmark.view.*
import mozilla.appservices.places.BookmarkRoot import mozilla.appservices.places.BookmarkRoot
import mozilla.components.concept.storage.BookmarkNode import mozilla.components.concept.storage.BookmarkNode
import mozilla.components.support.base.feature.UserInteractionHandler import mozilla.components.support.base.feature.UserInteractionHandler
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.NavGraphDirections import org.mozilla.fenix.NavGraphDirections
import org.mozilla.fenix.library.LibraryPageView import org.mozilla.fenix.library.LibraryPageView
@ -140,17 +139,9 @@ class BookmarkView(
bookmarkAdapter.updateData(state.tree, mode) bookmarkAdapter.updateData(state.tree, mode)
when (mode) { when (mode) {
is BookmarkFragmentState.Mode.Normal -> { is BookmarkFragmentState.Mode.Normal -> {
if (tree != null) {
if (BookmarkRoot.Mobile.id == tree?.guid) {
(activity as HomeActivity).setupNavigationToolbar(R.id.bookmarkFragment)
} else {
(activity as HomeActivity).setupNavigationToolbar()
}
}
setUiForNormalMode(state.tree) setUiForNormalMode(state.tree)
} }
is BookmarkFragmentState.Mode.Selecting -> { is BookmarkFragmentState.Mode.Selecting -> {
(activity as HomeActivity).setupNavigationToolbar()
setUiForSelectingMode( setUiForSelectingMode(
context.getString( context.getString(
R.string.bookmarks_multi_select_title, R.string.bookmarks_multi_select_title,

View File

@ -13,7 +13,6 @@ import androidx.recyclerview.widget.SimpleItemAnimator
import kotlinx.android.synthetic.main.component_history.* import kotlinx.android.synthetic.main.component_history.*
import kotlinx.android.synthetic.main.component_history.view.* import kotlinx.android.synthetic.main.component_history.view.*
import mozilla.components.support.base.feature.UserInteractionHandler import mozilla.components.support.base.feature.UserInteractionHandler
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.library.LibraryPageView import org.mozilla.fenix.library.LibraryPageView
import org.mozilla.fenix.library.SelectionInteractor import org.mozilla.fenix.library.SelectionInteractor
@ -143,13 +142,11 @@ class HistoryView(
when (val mode = state.mode) { when (val mode = state.mode) {
is HistoryFragmentState.Mode.Normal -> { is HistoryFragmentState.Mode.Normal -> {
(activity as HomeActivity).setupNavigationToolbar(R.id.historyFragment)
setUiForNormalMode( setUiForNormalMode(
context.getString(R.string.library_history) context.getString(R.string.library_history)
) )
} }
is HistoryFragmentState.Mode.Editing -> { is HistoryFragmentState.Mode.Editing -> {
(activity as HomeActivity).setupNavigationToolbar()
setUiForSelectingMode( setUiForSelectingMode(
context.getString(R.string.history_multi_select_title, mode.selectedItems.size) context.getString(R.string.history_multi_select_title, mode.selectedItems.size)
) )