mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-13 07:10:28 +00:00
Dismisses search dialog if active in (RecentTabsHeaderViewHolder, RecentBookmarksViewHolderTest) and adapts test for the changes.
This commit is contained in:
parent
cc380695b8
commit
5093e7a5d6
@ -5,6 +5,7 @@
|
||||
package org.mozilla.fenix.home.recentbookmarks.view
|
||||
|
||||
import android.view.View
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager.HORIZONTAL
|
||||
import kotlinx.android.synthetic.main.component_recent_bookmarks.view.*
|
||||
@ -31,6 +32,7 @@ class RecentBookmarksViewHolder(
|
||||
}
|
||||
|
||||
showAllBookmarksButton.setOnClickListener {
|
||||
dismissSearchDialogIfDisplayed()
|
||||
interactor.onShowAllBookmarksClicked()
|
||||
}
|
||||
}
|
||||
@ -39,6 +41,13 @@ class RecentBookmarksViewHolder(
|
||||
recentBookmarksAdapter.submitList(bookmarks)
|
||||
}
|
||||
|
||||
private fun dismissSearchDialogIfDisplayed() {
|
||||
val navController = itemView.findNavController()
|
||||
if (navController.currentDestination?.id == R.id.searchDialogFragment) {
|
||||
navController.navigateUp()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val LAYOUT_ID = R.layout.component_recent_bookmarks
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
package org.mozilla.fenix.home.recenttabs.view
|
||||
|
||||
import android.view.View
|
||||
import androidx.navigation.findNavController
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.databinding.RecentTabsHeaderBinding
|
||||
import org.mozilla.fenix.home.recenttabs.interactor.RecentTabInteractor
|
||||
@ -24,10 +25,18 @@ class RecentTabsHeaderViewHolder(
|
||||
|
||||
val binding = RecentTabsHeaderBinding.bind(view)
|
||||
binding.showAllButton.setOnClickListener {
|
||||
dismissSearchDialogIfDisplayed()
|
||||
interactor.onRecentTabShowAllClicked()
|
||||
}
|
||||
}
|
||||
|
||||
private fun dismissSearchDialogIfDisplayed() {
|
||||
val navController = itemView.findNavController()
|
||||
if (navController.currentDestination?.id == R.id.searchDialogFragment) {
|
||||
navController.navigateUp()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val LAYOUT_ID = R.layout.recent_tabs_header
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ package org.mozilla.fenix.home.recentbookmarks.view
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.navigation.Navigation
|
||||
import io.mockk.mockk
|
||||
import io.mockk.verify
|
||||
import kotlinx.android.synthetic.main.recent_bookmarks_header.view.*
|
||||
@ -39,7 +40,7 @@ class RecentBookmarksViewHolderTest {
|
||||
fun setup() {
|
||||
view = LayoutInflater.from(testContext)
|
||||
.inflate(RecentBookmarksViewHolder.LAYOUT_ID, null)
|
||||
|
||||
Navigation.setViewNavController(view, mockk(relaxed = true))
|
||||
interactor = mockk(relaxed = true)
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ package org.mozilla.fenix.home.recenttabs.view
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.navigation.Navigation
|
||||
import io.mockk.mockk
|
||||
import io.mockk.verify
|
||||
import kotlinx.android.synthetic.main.recent_tabs_header.view.*
|
||||
@ -24,7 +25,9 @@ class RecentTabsHeaderViewHolderTest {
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
view = LayoutInflater.from(testContext).inflate(RecentTabsHeaderViewHolder.LAYOUT_ID, null)
|
||||
view = LayoutInflater.from(testContext)
|
||||
.inflate(RecentTabsHeaderViewHolder.LAYOUT_ID, null)
|
||||
Navigation.setViewNavController(view, mockk(relaxed = true))
|
||||
interactor = mockk(relaxed = true)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user