For #6523 - Remove close button in library
parent
3e436f59e2
commit
0a86676563
|
@ -236,15 +236,4 @@ class HistoryTest {
|
|||
verifyHomeScreen()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("Test will be included after back navigation from History Fragment is sorted")
|
||||
fun verifyCloseMenu() {
|
||||
homeScreen {
|
||||
}.openThreeDotMenu {
|
||||
}.openHistory {
|
||||
}.closeMenu {
|
||||
verifyHomeScreen()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,17 +47,6 @@ class LibraryMenuTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun closeMenuButtonTest() {
|
||||
navigationToolbar {
|
||||
}.enterURLAndEnterToBrowser(defaultWebPage.url) {
|
||||
}.openThreeDotMenu {
|
||||
}.openLibrary {
|
||||
}.closeMenu {
|
||||
verifyBrowserScreen()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun backButtonTest() {
|
||||
navigationToolbar {
|
||||
|
|
|
@ -92,13 +92,6 @@ class HistoryRobot {
|
|||
HistoryRobot().interact()
|
||||
return Transition()
|
||||
}
|
||||
|
||||
fun closeMenu(interact: HistoryRobot.() -> Unit): Transition {
|
||||
closeButton().click()
|
||||
|
||||
HistoryRobot().interact()
|
||||
return Transition()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,5 +138,3 @@ private fun assertDeleteConfirmationMessage() =
|
|||
onView(withText("This will delete all of your browsing data."))
|
||||
.inRoot(isDialog())
|
||||
.check(matches(isDisplayed()))
|
||||
|
||||
private fun closeButton() = onView(withId(R.id.libraryClose))
|
||||
|
|
|
@ -13,9 +13,9 @@ import androidx.test.espresso.matcher.ViewMatchers
|
|||
import androidx.test.espresso.matcher.ViewMatchers.withContentDescription
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withText
|
||||
import androidx.test.uiautomator.UiDevice
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.uiautomator.By
|
||||
import androidx.test.uiautomator.UiDevice
|
||||
import androidx.test.uiautomator.Until
|
||||
import org.hamcrest.CoreMatchers.allOf
|
||||
import org.mozilla.fenix.R
|
||||
|
@ -44,13 +44,6 @@ class LibraryRobot {
|
|||
return BrowserRobot.Transition()
|
||||
}
|
||||
|
||||
fun closeMenu(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
||||
closeButton().click()
|
||||
|
||||
BrowserRobot().interact()
|
||||
return BrowserRobot.Transition()
|
||||
}
|
||||
|
||||
fun openBookmarks(interact: BookmarksRobot.() -> Unit): BookmarksRobot.Transition {
|
||||
mDevice.waitNotNull(Until.findObject(By.text("Bookmarks")), TestAssetHelper.waitingTime)
|
||||
bookmarksButton().click()
|
||||
|
@ -70,7 +63,6 @@ class LibraryRobot {
|
|||
}
|
||||
|
||||
private fun goBackButton() = onView(allOf(withContentDescription("Navigate up")))
|
||||
private fun closeButton() = onView(withId(R.id.libraryClose))
|
||||
private fun bookmarksButton() = onView(allOf(withText("Bookmarks")))
|
||||
private fun historyButton() = onView(allOf(withText("History")))
|
||||
|
||||
|
|
|
@ -7,12 +7,10 @@ package org.mozilla.fenix.library
|
|||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
import android.view.MenuInflater
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.navigation.Navigation
|
||||
import kotlinx.android.synthetic.main.fragment_library.*
|
||||
import mozilla.appservices.places.BookmarkRoot
|
||||
import mozilla.components.support.ktx.android.content.getColorFromAttr
|
||||
|
@ -65,16 +63,6 @@ class LibraryFragment : Fragment(R.layout.fragment_library) {
|
|||
inflater.inflate(R.menu.library_menu, menu)
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
return when (item.itemId) {
|
||||
R.id.libraryClose -> {
|
||||
Navigation.findNavController(requireActivity(), R.id.container).navigateUp()
|
||||
true
|
||||
}
|
||||
else -> super.onOptionsItemSelected(item)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
requireComponents.analytics.metrics.track(Event.LibraryClosed)
|
||||
|
|
|
@ -5,22 +5,14 @@
|
|||
package org.mozilla.fenix.library
|
||||
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
|
||||
import org.mozilla.fenix.HomeActivity
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
|
||||
import org.mozilla.fenix.ext.components
|
||||
|
||||
abstract class LibraryPageFragment<T> : Fragment() {
|
||||
|
||||
abstract val selectedItems: Set<T>
|
||||
|
||||
protected fun close() {
|
||||
if (!findNavController().popBackStack(R.id.libraryFragment, true)) {
|
||||
findNavController().popBackStack(R.id.homeFragment, false)
|
||||
}
|
||||
}
|
||||
|
||||
protected fun openItemsInNewTab(private: Boolean = false, toUrl: (T) -> String?) {
|
||||
context?.components?.useCases?.tabsUseCases?.let { tabsUseCases ->
|
||||
val addTab = if (private) tabsUseCases.addPrivateTab else tabsUseCases.addTab
|
||||
|
|
|
@ -171,11 +171,6 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), BackHandler {
|
|||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
return when (item.itemId) {
|
||||
R.id.libraryClose -> {
|
||||
invokePendingDeletion()
|
||||
close()
|
||||
true
|
||||
}
|
||||
R.id.add_bookmark_folder -> {
|
||||
navigate(
|
||||
BookmarkFragmentDirections
|
||||
|
|
|
@ -157,15 +157,9 @@ class HistoryFragment : LibraryPageFragment<HistoryItem>(), BackHandler {
|
|||
}
|
||||
true
|
||||
}
|
||||
R.id.libraryClose -> {
|
||||
close()
|
||||
true
|
||||
}
|
||||
R.id.delete_history_multi_select -> {
|
||||
val components = context?.components!!
|
||||
|
||||
lifecycleScope.launch(Main) {
|
||||
deleteSelectedHistory(historyStore.state.mode.selectedItems, components)
|
||||
deleteSelectedHistory(historyStore.state.mode.selectedItems, requireComponents)
|
||||
viewModel.invalidate()
|
||||
historyStore.dispatch(HistoryFragmentAction.ExitDeletionMode)
|
||||
}
|
||||
|
|
|
@ -10,10 +10,4 @@
|
|||
app:iconTint="?primaryText"
|
||||
android:title="@string/bookmark_add_folder"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/libraryClose"
|
||||
android:icon="@drawable/ic_close"
|
||||
app:iconTint="?primaryText"
|
||||
android:title="@string/content_description_close_button"
|
||||
app:showAsAction="ifRoom" />
|
||||
</menu>
|
||||
|
|
|
@ -2,12 +2,4 @@
|
|||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/libraryClose"
|
||||
android:icon="@drawable/ic_close"
|
||||
app:iconTint="?primaryText"
|
||||
android:title="@string/content_description_close_button"
|
||||
app:showAsAction="ifRoom" />
|
||||
</menu>
|
||||
<menu />
|
||||
|
|
Loading…
Reference in New Issue