mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-23 04:33:54 -04:00
Fixed: Many UI test cases to work with the new Compose-based UI in MainActivity.
* Removed `kiwix_nav_graph` and `custom_nav_graph`, and refactored the remaining code that depended on them. * Refactored `HotspotNotificationManager` to use the Compose-based navigation graph instead of the XML one.
This commit is contained in:
parent
23e1dcdbdc
commit
08880afa17
@ -43,7 +43,6 @@ import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.jupiter.api.fail
|
||||
import org.kiwix.kiwixmobile.BaseActivityTest
|
||||
import org.kiwix.kiwixmobile.R
|
||||
import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil
|
||||
import org.kiwix.kiwixmobile.core.utils.TestingUtils.COMPOSE_TEST_RULE_ORDER
|
||||
import org.kiwix.kiwixmobile.core.utils.TestingUtils.RETRY_RULE_ORDER
|
||||
@ -110,7 +109,7 @@ class DeepLinksTest : BaseActivityTest() {
|
||||
ActivityScenario.launch<KiwixMainActivity>(createDeepLinkIntent(it)).onActivity {}
|
||||
clickOnCopy(composeTestRule)
|
||||
navigationHistory {
|
||||
checkZimFileLoadedSuccessful(R.id.readerFragment)
|
||||
checkZimFileLoadedSuccessful(composeTestRule)
|
||||
assertZimFileLoaded() // check if the zim file successfully loaded
|
||||
clickOnAndroidArticle()
|
||||
}
|
||||
@ -138,7 +137,7 @@ class DeepLinksTest : BaseActivityTest() {
|
||||
ActivityScenario.launch<KiwixMainActivity>(createDeepLinkIntent(it)).onActivity {}
|
||||
clickOnCopy(composeTestRule)
|
||||
navigationHistory {
|
||||
checkZimFileLoadedSuccessful(R.id.readerFragment)
|
||||
checkZimFileLoadedSuccessful(composeTestRule)
|
||||
assertZimFileLoaded() // check if the zim file successfully loaded
|
||||
clickOnAndroidArticle()
|
||||
}
|
||||
|
@ -29,8 +29,6 @@ import androidx.compose.ui.test.performClick
|
||||
import androidx.compose.ui.test.performTextInput
|
||||
import applyWithViewHierarchyPrinting
|
||||
import org.kiwix.kiwixmobile.BaseRobot
|
||||
import org.kiwix.kiwixmobile.Findable.ViewId
|
||||
import org.kiwix.kiwixmobile.R
|
||||
import org.kiwix.kiwixmobile.core.R.string
|
||||
import org.kiwix.kiwixmobile.core.page.SEARCH_ICON_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.core.ui.components.TOOLBAR_TITLE_TESTING_TAG
|
||||
@ -38,6 +36,8 @@ import org.kiwix.kiwixmobile.core.utils.dialog.ALERT_DIALOG_CONFIRM_BUTTON_TESTI
|
||||
import org.kiwix.kiwixmobile.core.utils.dialog.ALERT_DIALOG_TITLE_TEXT_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import org.kiwix.kiwixmobile.download.DownloadTest.Companion.KIWIX_DOWNLOAD_TEST
|
||||
import org.kiwix.kiwixmobile.main.BOTTOM_NAV_DOWNLOADS_ITEM_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.main.BOTTOM_NAV_LIBRARY_ITEM_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.nav.destination.library.local.NO_FILE_TEXT_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.nav.destination.library.online.DOWNLOADING_PAUSE_BUTTON_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.nav.destination.library.online.DOWNLOADING_STATE_TEXT_TESTING_TAG
|
||||
@ -57,12 +57,18 @@ fun downloadRobot(func: DownloadRobot.() -> Unit) =
|
||||
DownloadRobot().applyWithViewHierarchyPrinting(func)
|
||||
|
||||
class DownloadRobot : BaseRobot() {
|
||||
fun clickLibraryOnBottomNav() {
|
||||
clickOn(ViewId(R.id.libraryFragment))
|
||||
fun clickLibraryOnBottomNav(composeTestRule: ComposeContentTestRule) {
|
||||
composeTestRule.apply {
|
||||
waitUntilTimeout()
|
||||
onNodeWithTag(BOTTOM_NAV_LIBRARY_ITEM_TESTING_TAG).performClick()
|
||||
}
|
||||
}
|
||||
|
||||
fun clickDownloadOnBottomNav() {
|
||||
clickOn(ViewId(R.id.downloadsFragment))
|
||||
fun clickDownloadOnBottomNav(composeTestRule: ComposeContentTestRule) {
|
||||
composeTestRule.apply {
|
||||
waitUntilTimeout()
|
||||
onNodeWithTag(BOTTOM_NAV_DOWNLOADS_ITEM_TESTING_TAG).performClick()
|
||||
}
|
||||
}
|
||||
|
||||
// Increasing the default timeout for data loading because, on the Android 16 Emulator,
|
||||
|
@ -140,7 +140,7 @@ class DownloadTest : BaseActivityTest() {
|
||||
deleteZimIfExists(composeTestRule)
|
||||
}
|
||||
downloadRobot {
|
||||
clickDownloadOnBottomNav()
|
||||
clickDownloadOnBottomNav(composeTestRule)
|
||||
waitForDataToLoad(composeTestRule = composeTestRule)
|
||||
stopDownloadIfAlreadyStarted(composeTestRule)
|
||||
downloadZimFile(composeTestRule)
|
||||
@ -202,7 +202,7 @@ class DownloadTest : BaseActivityTest() {
|
||||
selectAlbanianLanguage(composeTestRule)
|
||||
}
|
||||
}
|
||||
clickDownloadOnBottomNav()
|
||||
clickDownloadOnBottomNav(composeTestRule)
|
||||
waitForDataToLoad(composeTestRule = composeTestRule)
|
||||
stopDownloadIfAlreadyStarted(composeTestRule)
|
||||
downloadZimFile(composeTestRule)
|
||||
|
@ -26,22 +26,24 @@ import androidx.compose.ui.test.performClick
|
||||
import applyWithViewHierarchyPrinting
|
||||
import com.adevinta.android.barista.interaction.BaristaSleepInteractions
|
||||
import org.kiwix.kiwixmobile.BaseRobot
|
||||
import org.kiwix.kiwixmobile.Findable.ViewId
|
||||
import org.kiwix.kiwixmobile.R
|
||||
import org.kiwix.kiwixmobile.core.R.string
|
||||
import org.kiwix.kiwixmobile.core.ui.components.STORAGE_DEVICE_ITEM_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.main.BOTTOM_NAV_DOWNLOADS_ITEM_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.nav.destination.library.online.DOWNLOADING_STOP_BUTTON_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.storage.STORAGE_SELECTION_DIALOG_TITLE_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils.testFlakyView
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils.waitUntilTimeout
|
||||
import org.kiwix.kiwixmobile.core.ui.components.STORAGE_DEVICE_ITEM_TESTING_TAG
|
||||
|
||||
fun initialDownload(func: InitialDownloadRobot.() -> Unit) =
|
||||
InitialDownloadRobot().applyWithViewHierarchyPrinting(func)
|
||||
|
||||
class InitialDownloadRobot : BaseRobot() {
|
||||
fun clickDownloadOnBottomNav() {
|
||||
clickOn(ViewId(R.id.downloadsFragment))
|
||||
fun clickDownloadOnBottomNav(composeTestRule: ComposeContentTestRule) {
|
||||
composeTestRule.apply {
|
||||
waitUntilTimeout()
|
||||
onNodeWithTag(BOTTOM_NAV_DOWNLOADS_ITEM_TESTING_TAG).performClick()
|
||||
}
|
||||
}
|
||||
|
||||
fun assertStorageConfigureDialogDisplayed(composeTestRule: ComposeContentTestRule) {
|
||||
|
@ -125,7 +125,7 @@ class InitialDownloadTest : BaseActivityTest() {
|
||||
deleteZimIfExists(composeTestRule)
|
||||
}
|
||||
downloadRobot {
|
||||
clickDownloadOnBottomNav()
|
||||
clickDownloadOnBottomNav(composeTestRule)
|
||||
waitForDataToLoad(composeTestRule = composeTestRule)
|
||||
stopDownloadIfAlreadyStarted(composeTestRule)
|
||||
downloadZimFile(composeTestRule)
|
||||
|
@ -132,7 +132,7 @@ class LanguageFragmentTest {
|
||||
fun testLanguageFragment() {
|
||||
StandardActions.closeDrawer(kiwixMainActivity as CoreMainActivity) // close the drawer if open before running the test cases.
|
||||
downloadRobot {
|
||||
clickDownloadOnBottomNav()
|
||||
clickDownloadOnBottomNav(composeTestRule)
|
||||
waitForDataToLoad(composeTestRule = composeTestRule)
|
||||
}
|
||||
language {
|
||||
|
@ -28,11 +28,10 @@ import androidx.compose.ui.test.performClick
|
||||
import androidx.compose.ui.test.performTextInput
|
||||
import applyWithViewHierarchyPrinting
|
||||
import org.kiwix.kiwixmobile.BaseRobot
|
||||
import org.kiwix.kiwixmobile.Findable.ViewId
|
||||
import org.kiwix.kiwixmobile.R
|
||||
import org.kiwix.kiwixmobile.core.R.string
|
||||
import org.kiwix.kiwixmobile.core.page.SEARCH_ICON_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.core.search.SEARCH_FIELD_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.main.BOTTOM_NAV_DOWNLOADS_ITEM_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.nav.destination.library.online.LANGUAGE_MENU_ICON_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils.waitUntilTimeout
|
||||
@ -40,8 +39,11 @@ import org.kiwix.kiwixmobile.testutils.TestUtils.waitUntilTimeout
|
||||
fun language(func: LanguageRobot.() -> Unit) = LanguageRobot().applyWithViewHierarchyPrinting(func)
|
||||
|
||||
class LanguageRobot : BaseRobot() {
|
||||
fun clickDownloadOnBottomNav() {
|
||||
clickOn(ViewId(R.id.downloadsFragment))
|
||||
fun clickDownloadOnBottomNav(composeTestRule: ComposeContentTestRule) {
|
||||
composeTestRule.apply {
|
||||
waitUntilTimeout()
|
||||
onNodeWithTag(BOTTOM_NAV_DOWNLOADS_ITEM_TESTING_TAG).performClick()
|
||||
}
|
||||
}
|
||||
|
||||
fun clickOnLanguageIcon(composeTestRule: ComposeContentTestRule) {
|
||||
|
@ -29,18 +29,17 @@ import androidx.test.espresso.web.webdriver.DriverAtoms
|
||||
import androidx.test.espresso.web.webdriver.Locator
|
||||
import applyWithViewHierarchyPrinting
|
||||
import org.kiwix.kiwixmobile.BaseRobot
|
||||
import org.kiwix.kiwixmobile.Findable
|
||||
import org.kiwix.kiwixmobile.R.id
|
||||
import org.kiwix.kiwixmobile.core.R
|
||||
import org.kiwix.kiwixmobile.core.ui.components.STORAGE_DEVICE_ITEM_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.core.utils.dialog.ALERT_DIALOG_CONFIRM_BUTTON_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.core.utils.dialog.ALERT_DIALOG_DISMISS_BUTTON_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.core.utils.dialog.ALERT_DIALOG_MESSAGE_TEXT_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.core.utils.dialog.ALERT_DIALOG_NATURAL_BUTTON_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.main.BOTTOM_NAV_READER_ITEM_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.nav.destination.library.local.NO_FILE_TEXT_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.storage.STORAGE_SELECTION_DIALOG_TITLE_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils.testFlakyView
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils.waitUntilTimeout
|
||||
import org.kiwix.kiwixmobile.core.ui.components.STORAGE_DEVICE_ITEM_TESTING_TAG
|
||||
|
||||
fun copyMoveFileHandler(func: CopyMoveFileHandlerRobot.() -> Unit) =
|
||||
CopyMoveFileHandlerRobot().applyWithViewHierarchyPrinting(func)
|
||||
@ -117,8 +116,13 @@ class CopyMoveFileHandlerRobot : BaseRobot() {
|
||||
}
|
||||
|
||||
fun assertZimFileCopiedAndShowingIntoTheReader(composeTestRule: ComposeContentTestRule) {
|
||||
composeTestRule.waitUntilTimeout()
|
||||
isVisible(Findable.ViewId(id.readerFragment))
|
||||
composeTestRule.apply {
|
||||
waitUntilTimeout()
|
||||
composeTestRule.apply {
|
||||
waitUntilTimeout()
|
||||
onNodeWithTag(BOTTOM_NAV_READER_ITEM_TESTING_TAG).performClick()
|
||||
}
|
||||
}
|
||||
testFlakyView({
|
||||
Web.onWebView()
|
||||
.withElement(
|
||||
|
@ -40,9 +40,9 @@ fun darkModeViewPainter(func: DarkModeViewPainterRobot.() -> Unit) =
|
||||
DarkModeViewPainterRobot().applyWithViewHierarchyPrinting(func)
|
||||
|
||||
class DarkModeViewPainterRobot : BaseRobot() {
|
||||
fun openSettings(coreMainActivity: CoreMainActivity) {
|
||||
fun openSettings(coreMainActivity: CoreMainActivity, composeContentTest: ComposeContentTestRule) {
|
||||
openDrawer(coreMainActivity)
|
||||
enterSettings()
|
||||
enterSettings(composeContentTest)
|
||||
}
|
||||
|
||||
fun enableTheDarkMode(composeContentTest: ComposeContentTestRule) {
|
||||
|
@ -22,6 +22,7 @@ import androidx.compose.ui.test.junit4.createComposeRule
|
||||
import androidx.core.content.edit
|
||||
import androidx.core.net.toUri
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.navigation.NavOptions
|
||||
import androidx.preference.PreferenceManager
|
||||
import androidx.test.core.app.ActivityScenario
|
||||
import androidx.test.espresso.accessibility.AccessibilityChecks
|
||||
@ -45,7 +46,6 @@ import org.kiwix.kiwixmobile.core.utils.LanguageUtils
|
||||
import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil
|
||||
import org.kiwix.kiwixmobile.core.utils.TestingUtils.COMPOSE_TEST_RULE_ORDER
|
||||
import org.kiwix.kiwixmobile.core.utils.TestingUtils.RETRY_RULE_ORDER
|
||||
import org.kiwix.kiwixmobile.nav.destination.library.local.LocalLibraryFragmentDirections
|
||||
import org.kiwix.kiwixmobile.settings.settingsRobo
|
||||
import org.kiwix.kiwixmobile.testutils.RetryRule
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils
|
||||
@ -186,9 +186,12 @@ class DarkModeViewPainterTest : BaseActivityTest() {
|
||||
}
|
||||
}
|
||||
UiThreadStatement.runOnUiThread {
|
||||
val navOptions = NavOptions.Builder()
|
||||
.setPopUpTo(KiwixDestination.Reader.route, false)
|
||||
.build()
|
||||
kiwixMainActivity.navigate(
|
||||
LocalLibraryFragmentDirections.actionNavigationLibraryToNavigationReader()
|
||||
.apply { zimFileUri = zimFile.toUri().toString() }
|
||||
KiwixDestination.Reader.createRoute(zimFileUri = zimFile.toUri().toString()),
|
||||
navOptions
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -17,16 +17,16 @@
|
||||
*/
|
||||
package org.kiwix.kiwixmobile.main
|
||||
|
||||
import androidx.compose.ui.test.junit4.ComposeContentTestRule
|
||||
import androidx.compose.ui.test.onNodeWithTag
|
||||
import androidx.compose.ui.test.performClick
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.action.ViewActions.click
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withText
|
||||
import applyWithViewHierarchyPrinting
|
||||
import com.adevinta.android.barista.interaction.BaristaSleepInteractions
|
||||
import org.kiwix.kiwixmobile.BaseRobot
|
||||
import org.kiwix.kiwixmobile.Findable.StringId.TextId
|
||||
import org.kiwix.kiwixmobile.Findable.ViewId
|
||||
import org.kiwix.kiwixmobile.R
|
||||
import org.kiwix.kiwixmobile.core.R.string
|
||||
import org.kiwix.kiwixmobile.core.main.CoreMainActivity
|
||||
import org.kiwix.kiwixmobile.help.HelpRobot
|
||||
@ -45,6 +45,7 @@ import org.kiwix.kiwixmobile.settings.SettingsRobot
|
||||
import org.kiwix.kiwixmobile.settings.settingsRobo
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils.testFlakyView
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils.waitUntilTimeout
|
||||
import org.kiwix.kiwixmobile.utils.StandardActions.openDrawer
|
||||
import org.kiwix.kiwixmobile.webserver.ZimHostRobot
|
||||
import org.kiwix.kiwixmobile.webserver.zimHost
|
||||
@ -53,20 +54,40 @@ fun topLevel(func: TopLevelDestinationRobot.() -> Unit) =
|
||||
TopLevelDestinationRobot().applyWithViewHierarchyPrinting(func)
|
||||
|
||||
class TopLevelDestinationRobot : BaseRobot() {
|
||||
fun clickReaderOnBottomNav(func: ReaderRobot.() -> Unit) {
|
||||
fun clickReaderOnBottomNav(
|
||||
composeTestRule: ComposeContentTestRule,
|
||||
func: ReaderRobot.() -> Unit
|
||||
) {
|
||||
BaristaSleepInteractions.sleep(TestUtils.TEST_PAUSE_MS.toLong())
|
||||
testFlakyView({ onView(withId(R.id.readerFragment)).perform(click()) })
|
||||
testFlakyView({
|
||||
composeTestRule.apply {
|
||||
waitUntilTimeout()
|
||||
onNodeWithTag(BOTTOM_NAV_READER_ITEM_TESTING_TAG).performClick()
|
||||
}
|
||||
})
|
||||
reader(func)
|
||||
}
|
||||
|
||||
fun clickLibraryOnBottomNav(func: LibraryRobot.() -> Unit) {
|
||||
clickOn(ViewId(R.id.libraryFragment))
|
||||
fun clickLibraryOnBottomNav(
|
||||
composeTestRule: ComposeContentTestRule,
|
||||
func: LibraryRobot.() -> Unit
|
||||
) {
|
||||
composeTestRule.apply {
|
||||
waitUntilTimeout()
|
||||
onNodeWithTag(BOTTOM_NAV_LIBRARY_ITEM_TESTING_TAG).performClick()
|
||||
}
|
||||
library(func)
|
||||
pressBack()
|
||||
}
|
||||
|
||||
fun clickDownloadOnBottomNav(func: OnlineLibraryRobot.() -> Unit) {
|
||||
clickOn(ViewId(R.id.downloadsFragment))
|
||||
fun clickDownloadOnBottomNav(
|
||||
composeTestRule: ComposeContentTestRule,
|
||||
func: OnlineLibraryRobot.() -> Unit
|
||||
) {
|
||||
composeTestRule.apply {
|
||||
waitUntilTimeout()
|
||||
onNodeWithTag(BOTTOM_NAV_DOWNLOADS_ITEM_TESTING_TAG).performClick()
|
||||
}
|
||||
onlineLibrary(func)
|
||||
}
|
||||
|
||||
|
@ -112,15 +112,15 @@ class TopLevelDestinationTest : BaseActivityTest() {
|
||||
@Test
|
||||
fun testTopLevelDestination() {
|
||||
topLevel {
|
||||
clickReaderOnBottomNav {
|
||||
clickReaderOnBottomNav(composeTestRule) {
|
||||
assertReaderScreenDisplayed(composeTestRule)
|
||||
}
|
||||
clickDownloadOnBottomNav {
|
||||
clickDownloadOnBottomNav(composeTestRule) {
|
||||
onlineLibrary {
|
||||
assertOnlineLibraryFragmentDisplayed(composeTestRule)
|
||||
}
|
||||
}
|
||||
clickLibraryOnBottomNav {
|
||||
clickLibraryOnBottomNav(composeTestRule) {
|
||||
assertGetZimNearbyDeviceDisplayed(composeTestRule)
|
||||
clickFileTransferIcon(composeTestRule) {
|
||||
assertReceiveFileTitleVisible(composeTestRule)
|
||||
|
@ -99,8 +99,8 @@ class OnlineLibraryFragmentTest : BaseActivityTest() {
|
||||
clickOnSearchIcon(composeTestRule)
|
||||
searchWikipediaZIMFiles(composeTestRule)
|
||||
pressBack()
|
||||
clickLibraryOnBottomNav()
|
||||
clickDownloadOnBottomNav()
|
||||
clickLibraryOnBottomNav(composeTestRule)
|
||||
clickDownloadOnBottomNav(composeTestRule)
|
||||
assertPreviousSearchRemainsActive(composeTestRule)
|
||||
}
|
||||
}
|
||||
@ -118,8 +118,8 @@ class OnlineLibraryFragmentTest : BaseActivityTest() {
|
||||
searchWikipediaZIMFiles(composeTestRule)
|
||||
clickOnClearSearchIcon(composeTestRule)
|
||||
pressBack()
|
||||
clickLibraryOnBottomNav()
|
||||
clickDownloadOnBottomNav()
|
||||
clickLibraryOnBottomNav(composeTestRule)
|
||||
clickDownloadOnBottomNav(composeTestRule)
|
||||
assertSearchViewIsNotActive(composeTestRule)
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import androidx.compose.ui.test.junit4.createComposeRule
|
||||
import androidx.core.content.edit
|
||||
import androidx.core.net.toUri
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.navigation.NavOptions
|
||||
import androidx.preference.PreferenceManager
|
||||
import androidx.test.core.app.ActivityScenario
|
||||
import androidx.test.espresso.accessibility.AccessibilityChecks
|
||||
@ -49,7 +50,6 @@ import org.kiwix.kiwixmobile.core.utils.TestingUtils.COMPOSE_TEST_RULE_ORDER
|
||||
import org.kiwix.kiwixmobile.core.utils.TestingUtils.RETRY_RULE_ORDER
|
||||
import org.kiwix.kiwixmobile.main.KiwixMainActivity
|
||||
import org.kiwix.kiwixmobile.nav.destination.library.library
|
||||
import org.kiwix.kiwixmobile.nav.destination.library.local.LocalLibraryFragmentDirections
|
||||
import org.kiwix.kiwixmobile.testutils.RetryRule
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils.closeSystemDialogs
|
||||
@ -279,9 +279,12 @@ class NoteFragmentTest : BaseActivityTest() {
|
||||
}
|
||||
}
|
||||
UiThreadStatement.runOnUiThread {
|
||||
val navOptions = NavOptions.Builder()
|
||||
.setPopUpTo(KiwixDestination.Reader.route, false)
|
||||
.build()
|
||||
kiwixMainActivity.navigate(
|
||||
LocalLibraryFragmentDirections.actionNavigationLibraryToNavigationReader()
|
||||
.apply { zimFileUri = zimFile.toUri().toString() }
|
||||
KiwixDestination.Reader.createRoute(zimFileUri = zimFile.toUri().toString()),
|
||||
navOptions
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,6 @@ import org.kiwix.kiwixmobile.core.utils.TestingUtils.COMPOSE_TEST_RULE_ORDER
|
||||
import org.kiwix.kiwixmobile.core.utils.TestingUtils.RETRY_RULE_ORDER
|
||||
import org.kiwix.kiwixmobile.main.KiwixMainActivity
|
||||
import org.kiwix.kiwixmobile.main.topLevel
|
||||
import org.kiwix.kiwixmobile.nav.destination.library.local.LocalLibraryFragmentDirections
|
||||
import org.kiwix.kiwixmobile.testutils.RetryRule
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils.TEST_PAUSE_MS_FOR_DOWNLOAD_TEST
|
||||
@ -117,9 +116,12 @@ class LibkiwixBookmarkTest : BaseActivityTest() {
|
||||
activityScenario.onActivity {
|
||||
kiwixMainActivity = it
|
||||
kiwixMainActivity.navigate(KiwixDestination.Library.route)
|
||||
val navOptions = NavOptions.Builder()
|
||||
.setPopUpTo(KiwixDestination.Reader.route, false)
|
||||
.build()
|
||||
kiwixMainActivity.navigate(
|
||||
LocalLibraryFragmentDirections.actionNavigationLibraryToNavigationReader()
|
||||
.apply { zimFileUri = getZimFile().toUri().toString() }
|
||||
KiwixDestination.Reader.createRoute(zimFileUri = getZimFile().toUri().toString()),
|
||||
navOptions
|
||||
)
|
||||
}
|
||||
bookmarks {
|
||||
|
@ -25,9 +25,6 @@ import androidx.compose.ui.test.onNodeWithContentDescription
|
||||
import androidx.compose.ui.test.onNodeWithTag
|
||||
import androidx.compose.ui.test.performClick
|
||||
import androidx.compose.ui.test.performTouchInput
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.action.ViewActions.click
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
import androidx.test.espresso.web.sugar.Web.onWebView
|
||||
import androidx.test.espresso.web.webdriver.DriverAtoms.findElement
|
||||
import androidx.test.espresso.web.webdriver.DriverAtoms.webClick
|
||||
@ -36,12 +33,13 @@ import applyWithViewHierarchyPrinting
|
||||
import com.adevinta.android.barista.interaction.BaristaSleepInteractions
|
||||
import junit.framework.AssertionFailedError
|
||||
import org.kiwix.kiwixmobile.BaseRobot
|
||||
import org.kiwix.kiwixmobile.Findable.ViewId
|
||||
import org.kiwix.kiwixmobile.core.R
|
||||
import org.kiwix.kiwixmobile.core.main.reader.READER_SCREEN_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.core.main.reader.TAB_SWITCHER_VIEW_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.core.page.DELETE_MENU_ICON_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.core.ui.components.TOOLBAR_TITLE_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.core.utils.dialog.ALERT_DIALOG_TITLE_TEXT_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.main.BOTTOM_NAV_READER_ITEM_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils.testFlakyView
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils.waitUntilTimeout
|
||||
@ -54,9 +52,11 @@ class NavigationHistoryRobot : BaseRobot() {
|
||||
private var retryCountForBackwardNavigationHistory = 5
|
||||
private var retryCountForForwardNavigationHistory = 5
|
||||
|
||||
fun checkZimFileLoadedSuccessful(readerFragment: Int) {
|
||||
pauseForBetterTestPerformance()
|
||||
isVisible(ViewId(readerFragment))
|
||||
fun checkZimFileLoadedSuccessful(composeTestRule: ComposeContentTestRule) {
|
||||
composeTestRule.apply {
|
||||
waitUntilTimeout()
|
||||
onNodeWithTag(READER_SCREEN_TESTING_TAG).assertExists()
|
||||
}
|
||||
}
|
||||
|
||||
fun closeTabSwitcherIfVisible(composeTestRule: ComposeContentTestRule) {
|
||||
@ -189,7 +189,12 @@ class NavigationHistoryRobot : BaseRobot() {
|
||||
BaristaSleepInteractions.sleep(TestUtils.TEST_PAUSE_MS_FOR_SEARCH_TEST.toLong())
|
||||
}
|
||||
|
||||
fun clickOnReaderFragment() {
|
||||
testFlakyView({ onView(withId(org.kiwix.kiwixmobile.R.id.readerFragment)).perform(click()) })
|
||||
fun clickOnReaderFragment(composeTestRule: ComposeContentTestRule) {
|
||||
testFlakyView({
|
||||
composeTestRule.apply {
|
||||
waitUntilTimeout()
|
||||
onNodeWithTag(BOTTOM_NAV_READER_ITEM_TESTING_TAG).performClick()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,6 @@ import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.kiwix.kiwixmobile.BaseActivityTest
|
||||
import org.kiwix.kiwixmobile.R
|
||||
import org.kiwix.kiwixmobile.core.main.CoreMainActivity
|
||||
import org.kiwix.kiwixmobile.core.utils.LanguageUtils.Companion.handleLocaleChange
|
||||
import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil
|
||||
@ -153,7 +152,7 @@ class NavigationHistoryTest : BaseActivityTest() {
|
||||
StandardActions.closeDrawer(kiwixMainActivity as CoreMainActivity) // close the drawer if open before running the test cases.
|
||||
navigationHistory {
|
||||
closeTabSwitcherIfVisible(composeTestRule)
|
||||
checkZimFileLoadedSuccessful(R.id.readerFragment)
|
||||
checkZimFileLoadedSuccessful(composeTestRule)
|
||||
clickOnAndroidArticle()
|
||||
longClickOnBackwardButton(composeTestRule)
|
||||
assertBackwardNavigationHistoryDialogDisplayed(composeTestRule)
|
||||
|
@ -23,6 +23,7 @@ import androidx.compose.ui.test.junit4.createComposeRule
|
||||
import androidx.core.content.edit
|
||||
import androidx.core.net.toUri
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.navigation.NavOptions
|
||||
import androidx.preference.PreferenceManager
|
||||
import androidx.test.core.app.ActivityScenario
|
||||
import androidx.test.espresso.accessibility.AccessibilityChecks
|
||||
@ -44,13 +45,11 @@ import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.kiwix.kiwixmobile.BaseActivityTest
|
||||
import org.kiwix.kiwixmobile.R
|
||||
import org.kiwix.kiwixmobile.core.utils.LanguageUtils.Companion.handleLocaleChange
|
||||
import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil
|
||||
import org.kiwix.kiwixmobile.core.utils.TestingUtils.COMPOSE_TEST_RULE_ORDER
|
||||
import org.kiwix.kiwixmobile.core.utils.TestingUtils.RETRY_RULE_ORDER
|
||||
import org.kiwix.kiwixmobile.main.KiwixMainActivity
|
||||
import org.kiwix.kiwixmobile.nav.destination.library.local.LocalLibraryFragmentDirections
|
||||
import org.kiwix.kiwixmobile.testutils.RetryRule
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils.closeSystemDialogs
|
||||
@ -141,13 +140,13 @@ class KiwixReaderFragmentTest : BaseActivityTest() {
|
||||
}
|
||||
openKiwixReaderFragmentWithFile(zimFile)
|
||||
reader {
|
||||
checkZimFileLoadedSuccessful(R.id.readerFragment)
|
||||
checkZimFileLoadedSuccessful(composeTestRule)
|
||||
clickOnTabIcon(composeTestRule)
|
||||
clickOnClosedAllTabsButton(composeTestRule)
|
||||
clickOnUndoButton(composeTestRule)
|
||||
assertTabRestored(composeTestRule)
|
||||
pressBack()
|
||||
checkZimFileLoadedSuccessful(R.id.readerFragment)
|
||||
checkZimFileLoadedSuccessful(composeTestRule)
|
||||
}
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1) {
|
||||
// temporary disabled on Android 25
|
||||
@ -176,7 +175,7 @@ class KiwixReaderFragmentTest : BaseActivityTest() {
|
||||
}
|
||||
openKiwixReaderFragmentWithFile(downloadingZimFile)
|
||||
reader {
|
||||
checkZimFileLoadedSuccessful(R.id.readerFragment)
|
||||
checkZimFileLoadedSuccessful(composeTestRule)
|
||||
clickOnTabIcon(composeTestRule)
|
||||
clickOnTabIcon(composeTestRule)
|
||||
// test the whole welcome page is loaded or not
|
||||
@ -260,9 +259,12 @@ class KiwixReaderFragmentTest : BaseActivityTest() {
|
||||
|
||||
private fun openKiwixReaderFragmentWithFile(zimFile: File) {
|
||||
UiThreadStatement.runOnUiThread {
|
||||
val navOptions = NavOptions.Builder()
|
||||
.setPopUpTo(KiwixDestination.Reader.route, false)
|
||||
.build()
|
||||
kiwixMainActivity.navigate(
|
||||
LocalLibraryFragmentDirections.actionNavigationLibraryToNavigationReader()
|
||||
.apply { zimFileUri = zimFile.toUri().toString() }
|
||||
KiwixDestination.Reader.createRoute(zimFileUri = zimFile.toUri().toString()),
|
||||
navOptions
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -31,8 +31,8 @@ import androidx.test.espresso.web.webdriver.Locator
|
||||
import applyWithViewHierarchyPrinting
|
||||
import com.adevinta.android.barista.interaction.BaristaSleepInteractions
|
||||
import org.kiwix.kiwixmobile.BaseRobot
|
||||
import org.kiwix.kiwixmobile.Findable.ViewId
|
||||
import org.kiwix.kiwixmobile.core.main.reader.CLOSE_ALL_TABS_BUTTON_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.core.main.reader.READER_SCREEN_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.core.main.reader.TAB_MENU_ITEM_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.core.main.reader.TAB_TITLE_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils
|
||||
@ -44,9 +44,11 @@ fun reader(func: ReaderRobot.() -> Unit) = ReaderRobot().applyWithViewHierarchyP
|
||||
class ReaderRobot : BaseRobot() {
|
||||
private var retryCountForClickOnUndoButton = 5
|
||||
|
||||
fun checkZimFileLoadedSuccessful(readerFragment: Int) {
|
||||
pauseForBetterTestPerformance()
|
||||
isVisible(ViewId(readerFragment))
|
||||
fun checkZimFileLoadedSuccessful(composeTestRule: ComposeContentTestRule) {
|
||||
composeTestRule.apply {
|
||||
waitUntilTimeout()
|
||||
onNodeWithTag(READER_SCREEN_TESTING_TAG).assertExists()
|
||||
}
|
||||
}
|
||||
|
||||
fun clickOnTabIcon(composeTestRule: ComposeContentTestRule) {
|
||||
@ -88,10 +90,6 @@ class ReaderRobot : BaseRobot() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun pauseForBetterTestPerformance() {
|
||||
BaristaSleepInteractions.sleep(TestUtils.TEST_PAUSE_MS_FOR_SEARCH_TEST.toLong())
|
||||
}
|
||||
|
||||
fun clickOnArticle(articleTitle: String) {
|
||||
BaristaSleepInteractions.sleep(TestUtils.TEST_PAUSE_MS.toLong())
|
||||
testFlakyView({
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
package org.kiwix.kiwixmobile.reader
|
||||
|
||||
import androidx.compose.ui.test.junit4.createComposeRule
|
||||
import androidx.core.content.edit
|
||||
import androidx.core.net.toUri
|
||||
import androidx.lifecycle.Lifecycle
|
||||
@ -43,12 +44,12 @@ import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.jupiter.api.fail
|
||||
import org.kiwix.kiwixmobile.BaseActivityTest
|
||||
import org.kiwix.kiwixmobile.R
|
||||
import org.kiwix.kiwixmobile.core.DarkModeConfig
|
||||
import org.kiwix.kiwixmobile.core.reader.ZimFileReader
|
||||
import org.kiwix.kiwixmobile.core.reader.ZimReaderSource
|
||||
import org.kiwix.kiwixmobile.core.utils.LanguageUtils.Companion.handleLocaleChange
|
||||
import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil
|
||||
import org.kiwix.kiwixmobile.core.utils.TestingUtils.COMPOSE_TEST_RULE_ORDER
|
||||
import org.kiwix.kiwixmobile.core.utils.TestingUtils.RETRY_RULE_ORDER
|
||||
import org.kiwix.kiwixmobile.main.KiwixMainActivity
|
||||
import org.kiwix.kiwixmobile.page.history.navigationHistory
|
||||
@ -65,6 +66,9 @@ class ZimFileReaderWithSplittedZimFileTest : BaseActivityTest() {
|
||||
@JvmField
|
||||
val retryRule = RetryRule()
|
||||
|
||||
@get:Rule(order = COMPOSE_TEST_RULE_ORDER)
|
||||
val composeTestRule = createComposeRule()
|
||||
|
||||
private lateinit var kiwixMainActivity: KiwixMainActivity
|
||||
|
||||
@Before
|
||||
@ -127,8 +131,8 @@ class ZimFileReaderWithSplittedZimFileTest : BaseActivityTest() {
|
||||
}
|
||||
|
||||
navigationHistory {
|
||||
checkZimFileLoadedSuccessful(R.id.readerFragment)
|
||||
clickOnReaderFragment() // activate the accessibility check to check the issues.
|
||||
checkZimFileLoadedSuccessful(composeTestRule)
|
||||
clickOnReaderFragment(composeTestRule) // activate the accessibility check to check the issues.
|
||||
assertZimFileLoaded() // check if the zim file successfully loaded
|
||||
clickOnAndroidArticle()
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import androidx.compose.ui.test.junit4.createComposeRule
|
||||
import androidx.core.content.edit
|
||||
import androidx.core.net.toUri
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.navigation.NavOptions
|
||||
import androidx.preference.PreferenceManager
|
||||
import androidx.test.core.app.ActivityScenario
|
||||
import androidx.test.espresso.accessibility.AccessibilityChecks
|
||||
@ -45,13 +46,11 @@ import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.kiwix.kiwixmobile.BaseActivityTest
|
||||
import org.kiwix.kiwixmobile.R
|
||||
import org.kiwix.kiwixmobile.core.utils.LanguageUtils.Companion.handleLocaleChange
|
||||
import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil
|
||||
import org.kiwix.kiwixmobile.core.utils.TestingUtils.COMPOSE_TEST_RULE_ORDER
|
||||
import org.kiwix.kiwixmobile.core.utils.TestingUtils.RETRY_RULE_ORDER
|
||||
import org.kiwix.kiwixmobile.main.KiwixMainActivity
|
||||
import org.kiwix.kiwixmobile.nav.destination.library.local.LocalLibraryFragmentDirections.actionNavigationLibraryToNavigationReader
|
||||
import org.kiwix.kiwixmobile.testutils.RetryRule
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils.closeSystemDialogs
|
||||
@ -136,11 +135,11 @@ class SearchFragmentTest : BaseActivityTest() {
|
||||
}
|
||||
testZimFile = getTestZimFile()
|
||||
openKiwixReaderFragmentWithFile(testZimFile)
|
||||
search { checkZimFileSearchSuccessful(R.id.readerFragment) }
|
||||
search { checkZimFileSearchSuccessful(composeTestRule) }
|
||||
openSearchWithQuery("Android", testZimFile)
|
||||
search {
|
||||
clickOnSearchItemInSearchList(composeTestRule)
|
||||
checkZimFileSearchSuccessful(R.id.readerFragment)
|
||||
checkZimFileSearchSuccessful(composeTestRule)
|
||||
}
|
||||
|
||||
openSearchWithQuery(zimFile = testZimFile)
|
||||
@ -187,7 +186,7 @@ class SearchFragmentTest : BaseActivityTest() {
|
||||
}
|
||||
}
|
||||
openKiwixReaderFragmentWithFile(downloadingZimFile)
|
||||
search { checkZimFileSearchSuccessful(R.id.readerFragment) }
|
||||
search { checkZimFileSearchSuccessful(composeTestRule) }
|
||||
openSearchWithQuery(zimFile = downloadingZimFile)
|
||||
search {
|
||||
// test with fast typing/deleting
|
||||
@ -273,7 +272,7 @@ class SearchFragmentTest : BaseActivityTest() {
|
||||
}
|
||||
}
|
||||
openKiwixReaderFragmentWithFile(downloadingZimFile)
|
||||
search { checkZimFileSearchSuccessful(R.id.readerFragment) }
|
||||
search { checkZimFileSearchSuccessful(composeTestRule) }
|
||||
openSearchWithQuery(searchTerms[0], downloadingZimFile)
|
||||
// wait for searchFragment become visible on screen.
|
||||
delay(2000)
|
||||
@ -313,9 +312,12 @@ class SearchFragmentTest : BaseActivityTest() {
|
||||
|
||||
private fun openKiwixReaderFragmentWithFile(zimFile: File) {
|
||||
UiThreadStatement.runOnUiThread {
|
||||
val navOptions = NavOptions.Builder()
|
||||
.setPopUpTo(KiwixDestination.Reader.route, false)
|
||||
.build()
|
||||
kiwixMainActivity.navigate(
|
||||
actionNavigationLibraryToNavigationReader()
|
||||
.apply { zimFileUri = zimFile.toUri().toString() }
|
||||
KiwixDestination.Reader.createRoute(zimFileUri = zimFile.toUri().toString()),
|
||||
navOptions
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ package org.kiwix.kiwixmobile.search
|
||||
|
||||
import android.view.KeyEvent
|
||||
import androidx.compose.ui.test.assert
|
||||
import androidx.compose.ui.test.assertIsDisplayed
|
||||
import androidx.compose.ui.test.hasText
|
||||
import androidx.compose.ui.test.junit4.ComposeContentTestRule
|
||||
import androidx.compose.ui.test.onAllNodesWithTag
|
||||
@ -34,11 +35,11 @@ import androidx.test.uiautomator.UiDevice
|
||||
import applyWithViewHierarchyPrinting
|
||||
import com.adevinta.android.barista.interaction.BaristaSleepInteractions
|
||||
import org.kiwix.kiwixmobile.BaseRobot
|
||||
import org.kiwix.kiwixmobile.Findable.ViewId
|
||||
import org.kiwix.kiwixmobile.core.page.SEARCH_ICON_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.core.search.SEARCH_FIELD_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.core.search.SEARCH_ITEM_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.core.ui.components.NAVIGATION_ICON_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.main.BOTTOM_NAV_READER_ITEM_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils.TEST_PAUSE_MS
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils.testFlakyView
|
||||
@ -59,9 +60,12 @@ class SearchRobot : BaseRobot() {
|
||||
}
|
||||
}
|
||||
|
||||
fun checkZimFileSearchSuccessful(readerFragment: Int) {
|
||||
fun checkZimFileSearchSuccessful(composeTestRule: ComposeContentTestRule) {
|
||||
BaristaSleepInteractions.sleep(TestUtils.TEST_PAUSE_MS_FOR_SEARCH_TEST.toLong())
|
||||
isVisible(ViewId(readerFragment))
|
||||
composeTestRule.apply {
|
||||
waitUntilTimeout()
|
||||
onNodeWithTag(BOTTOM_NAV_READER_ITEM_TESTING_TAG).assertIsDisplayed()
|
||||
}
|
||||
}
|
||||
|
||||
fun searchWithFrequentlyTypedWords(
|
||||
@ -131,7 +135,7 @@ class SearchRobot : BaseRobot() {
|
||||
openSearchScreen(composeTestRule)
|
||||
searchWithFrequentlyTypedWords(searchString, composeTestRule = composeTestRule)
|
||||
clickOnSearchItemInSearchList(composeTestRule)
|
||||
checkZimFileSearchSuccessful(org.kiwix.kiwixmobile.R.id.readerFragment)
|
||||
checkZimFileSearchSuccessful(composeTestRule)
|
||||
}
|
||||
|
||||
fun assertArticleLoaded() {
|
||||
|
@ -119,7 +119,7 @@ class KiwixSettingsFragmentTest {
|
||||
clickGetStarted(composeTestRule) {}
|
||||
}
|
||||
StandardActions.openDrawer(kiwixMainActivity as CoreMainActivity)
|
||||
StandardActions.enterSettings()
|
||||
StandardActions.enterSettings(composeTestRule)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -130,13 +130,13 @@ class GetContentShortcutTest {
|
||||
ActivityScenario.launch<KiwixMainActivity>(shortcutIntent)
|
||||
onlineLibrary { assertOnlineLibraryFragmentDisplayed(composeTestRule) }
|
||||
topLevel {
|
||||
clickReaderOnBottomNav {
|
||||
clickReaderOnBottomNav(composeTestRule) {
|
||||
assertReaderScreenDisplayed(composeTestRule)
|
||||
}
|
||||
clickDownloadOnBottomNav {
|
||||
clickDownloadOnBottomNav(composeTestRule) {
|
||||
onlineLibrary { assertOnlineLibraryFragmentDisplayed(composeTestRule) }
|
||||
}
|
||||
clickLibraryOnBottomNav {
|
||||
clickLibraryOnBottomNav(composeTestRule) {
|
||||
assertGetZimNearbyDeviceDisplayed(composeTestRule)
|
||||
clickFileTransferIcon(composeTestRule) {
|
||||
assertReceiveFileTitleVisible(composeTestRule)
|
||||
|
@ -17,24 +17,29 @@
|
||||
*/
|
||||
package org.kiwix.kiwixmobile.utils
|
||||
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import androidx.compose.ui.test.junit4.ComposeContentTestRule
|
||||
import androidx.compose.ui.test.onNodeWithTag
|
||||
import androidx.compose.ui.test.performClick
|
||||
import androidx.test.espresso.Espresso
|
||||
import androidx.test.espresso.action.ViewActions
|
||||
import androidx.test.espresso.matcher.ViewMatchers
|
||||
import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn
|
||||
import com.adevinta.android.barista.interaction.BaristaDialogInteractions
|
||||
import com.adevinta.android.barista.interaction.BaristaSleepInteractions
|
||||
import org.kiwix.kiwixmobile.core.R.string
|
||||
import org.kiwix.kiwixmobile.core.main.CoreMainActivity
|
||||
import org.kiwix.kiwixmobile.core.main.LEFT_DRAWER_SETTINGS_ITEM_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils.waitUntilTimeout
|
||||
|
||||
/**
|
||||
* Created by mhutti1 on 27/04/17.
|
||||
*/
|
||||
object StandardActions {
|
||||
fun enterSettings() {
|
||||
BaristaSleepInteractions.sleep(TestUtils.TEST_PAUSE_MS.toLong())
|
||||
clickOn(TestUtils.getResourceString(string.menu_settings))
|
||||
fun enterSettings(composeContentTest: ComposeContentTestRule) {
|
||||
composeContentTest.apply {
|
||||
waitUntilTimeout()
|
||||
onNodeWithTag(LEFT_DRAWER_SETTINGS_ITEM_TESTING_TAG).performClick()
|
||||
}
|
||||
}
|
||||
|
||||
fun openDrawer(coreMainActivity: CoreMainActivity) {
|
||||
|
@ -135,6 +135,12 @@
|
||||
<action android:name="org.kiwix.kiwixmobile.core.main.CoreMainActivity" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="kiwix" android:host="zimhost" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<receiver
|
||||
|
@ -29,6 +29,7 @@ import android.content.pm.PackageManager.PERMISSION_GRANTED
|
||||
import android.location.LocationManager
|
||||
import android.location.LocationManager.GPS_PROVIDER
|
||||
import android.location.LocationManager.NETWORK_PROVIDER
|
||||
import android.net.Uri
|
||||
import android.net.wifi.p2p.WifiP2pDevice
|
||||
import android.net.wifi.p2p.WifiP2pDeviceList
|
||||
import android.os.Build
|
||||
@ -57,16 +58,16 @@ import org.kiwix.kiwixmobile.core.extensions.ActivityExtensions.popNavigationBac
|
||||
import org.kiwix.kiwixmobile.core.extensions.toast
|
||||
import org.kiwix.kiwixmobile.core.main.CoreMainActivity
|
||||
import org.kiwix.kiwixmobile.core.navigateToAppSettings
|
||||
import org.kiwix.kiwixmobile.core.page.SEARCH_ICON_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.core.ui.components.NavigationIcon
|
||||
import org.kiwix.kiwixmobile.core.ui.models.ActionMenuItem
|
||||
import org.kiwix.kiwixmobile.core.ui.models.IconItem
|
||||
import org.kiwix.kiwixmobile.core.ui.models.IconItem.Vector
|
||||
import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil
|
||||
import org.kiwix.kiwixmobile.core.utils.dialog.AlertDialogShower
|
||||
import org.kiwix.kiwixmobile.core.utils.dialog.DialogHost
|
||||
import org.kiwix.kiwixmobile.core.utils.dialog.KiwixDialog
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import org.kiwix.kiwixmobile.core.page.SEARCH_ICON_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.core.utils.dialog.DialogHost
|
||||
import org.kiwix.kiwixmobile.localFileTransfer.WifiDirectManager.Companion.getDeviceStatus
|
||||
import javax.inject.Inject
|
||||
|
||||
@ -190,7 +191,20 @@ class LocalFileTransferFragment :
|
||||
}
|
||||
|
||||
private fun getFilesForTransfer() =
|
||||
LocalFileTransferFragmentArgs.fromBundle(requireArguments()).uris?.map(::FileItem).orEmpty()
|
||||
arguments
|
||||
?.getParcelableArrayCompat(URIS_KEY)
|
||||
?.map(::FileItem)
|
||||
.orEmpty()
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
private fun Bundle.getParcelableArrayCompat(key: String): Array<Uri>? {
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
getParcelableArray(key, Uri::class.java)
|
||||
} else {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
getParcelableArray(key) as? Array<Uri>
|
||||
}
|
||||
}
|
||||
|
||||
private fun showPeerDiscoveryProgressBar() { // Setup UI for searching peers
|
||||
isPeerSearching.value = true
|
||||
|
@ -21,5 +21,6 @@ package org.kiwix.kiwixmobile.main
|
||||
data class BottomNavItem(
|
||||
val route: String,
|
||||
val title: String,
|
||||
val iconRes: Int
|
||||
val iconRes: Int,
|
||||
val testingTag: String
|
||||
)
|
||||
|
@ -59,7 +59,11 @@ import org.kiwix.kiwixmobile.core.extensions.update
|
||||
import org.kiwix.kiwixmobile.core.main.ACTION_NEW_TAB
|
||||
import org.kiwix.kiwixmobile.core.main.CoreMainActivity
|
||||
import org.kiwix.kiwixmobile.core.main.DrawerMenuItem
|
||||
import org.kiwix.kiwixmobile.core.main.LEFT_DRAWER_HELP_ITEM_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.core.main.LEFT_DRAWER_SUPPORT_ITEM_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.core.main.LEFT_DRAWER_ZIM_HOST_ITEM_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.core.main.NEW_TAB_SHORTCUT_ID
|
||||
import org.kiwix.kiwixmobile.core.main.ZIM_HOST_DEEP_LINK_SCHEME
|
||||
import org.kiwix.kiwixmobile.core.utils.LanguageUtils.Companion.handleLocaleChange
|
||||
import org.kiwix.kiwixmobile.core.utils.dialog.DialogHost
|
||||
import org.kiwix.kiwixmobile.kiwixActivityComponent
|
||||
@ -217,6 +221,10 @@ class KiwixMainActivity : CoreMainActivity() {
|
||||
handleNotificationIntent(intent)
|
||||
handleZimFileIntent(intent)
|
||||
handleGetContentIntent(intent)
|
||||
intent.data?.let { uri ->
|
||||
// for handling the deepLink of ZimHost screen when application is opened.
|
||||
navController.handleDeepLink(intent)
|
||||
}
|
||||
supportFragmentManager.fragments.filterIsInstance<FragmentActivityExtensions>().forEach {
|
||||
it.onNewIntent(intent, this)
|
||||
}
|
||||
@ -239,7 +247,11 @@ class KiwixMainActivity : CoreMainActivity() {
|
||||
}, OPENING_ZIM_FILE_DELAY)
|
||||
}
|
||||
|
||||
else -> toast(R.string.cannot_open_file)
|
||||
else -> {
|
||||
if (it.scheme != ZIM_HOST_DEEP_LINK_SCHEME) {
|
||||
toast(R.string.cannot_open_file)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -276,21 +288,24 @@ class KiwixMainActivity : CoreMainActivity() {
|
||||
title = CoreApp.instance.getString(string.menu_wifi_hotspot),
|
||||
iconRes = drawable.ic_mobile_screen_share_24px,
|
||||
visible = true,
|
||||
onClick = { openZimHostFragment() }
|
||||
onClick = { openZimHostFragment() },
|
||||
testingTag = LEFT_DRAWER_ZIM_HOST_ITEM_TESTING_TAG
|
||||
)
|
||||
|
||||
override val helpDrawerMenuItem: DrawerMenuItem? = DrawerMenuItem(
|
||||
title = CoreApp.instance.getString(string.menu_help),
|
||||
iconRes = drawable.ic_help_24px,
|
||||
visible = true,
|
||||
onClick = { openHelpFragment() }
|
||||
onClick = { openHelpFragment() },
|
||||
testingTag = LEFT_DRAWER_HELP_ITEM_TESTING_TAG
|
||||
)
|
||||
|
||||
override val supportDrawerMenuItem: DrawerMenuItem? = DrawerMenuItem(
|
||||
title = CoreApp.instance.getString(string.menu_support_kiwix),
|
||||
iconRes = drawable.ic_support_24px,
|
||||
visible = true,
|
||||
onClick = { openSupportKiwixExternalLink() }
|
||||
onClick = { openSupportKiwixExternalLink() },
|
||||
testingTag = LEFT_DRAWER_SUPPORT_ITEM_TESTING_TAG
|
||||
)
|
||||
|
||||
/**
|
||||
|
@ -37,6 +37,8 @@ import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTag
|
||||
import androidx.navigation.NavBackStackEntry
|
||||
import androidx.navigation.NavHostController
|
||||
import androidx.navigation.compose.currentBackStackEntryAsState
|
||||
@ -52,6 +54,10 @@ import org.kiwix.kiwixmobile.core.ui.theme.White
|
||||
import org.kiwix.kiwixmobile.ui.KiwixDestination
|
||||
import org.kiwix.kiwixmobile.ui.KiwixNavGraph
|
||||
|
||||
const val BOTTOM_NAV_READER_ITEM_TESTING_TAG = "bottomNavReaderItemTestingTag"
|
||||
const val BOTTOM_NAV_LIBRARY_ITEM_TESTING_TAG = "bottomNavLibraryItemTestingTag"
|
||||
const val BOTTOM_NAV_DOWNLOADS_ITEM_TESTING_TAG = "bottomNavDownloadsItemTestingTag"
|
||||
|
||||
@Suppress("LongParameterList")
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
@ -126,17 +132,20 @@ fun BottomNavigationBar(
|
||||
BottomNavItem(
|
||||
route = KiwixDestination.Reader.route,
|
||||
title = stringResource(id = R.string.reader),
|
||||
iconRes = drawable.ic_reader_navigation_white_24px
|
||||
iconRes = drawable.ic_reader_navigation_white_24px,
|
||||
testingTag = BOTTOM_NAV_READER_ITEM_TESTING_TAG
|
||||
),
|
||||
BottomNavItem(
|
||||
route = KiwixDestination.Library.route,
|
||||
title = stringResource(id = R.string.library),
|
||||
iconRes = drawable.ic_library_navigation_white_24dp
|
||||
iconRes = drawable.ic_library_navigation_white_24dp,
|
||||
testingTag = BOTTOM_NAV_LIBRARY_ITEM_TESTING_TAG
|
||||
),
|
||||
BottomNavItem(
|
||||
route = KiwixDestination.Downloads.route,
|
||||
title = stringResource(id = R.string.download),
|
||||
iconRes = drawable.ic_download_navigation_white_24dp
|
||||
iconRes = drawable.ic_download_navigation_white_24dp,
|
||||
testingTag = BOTTOM_NAV_DOWNLOADS_ITEM_TESTING_TAG
|
||||
)
|
||||
)
|
||||
val currentDestinationRoute = navBackStackEntry?.destination?.route
|
||||
@ -162,7 +171,8 @@ fun BottomNavigationBar(
|
||||
contentDescription = item.title
|
||||
)
|
||||
},
|
||||
label = { Text(item.title) }
|
||||
label = { Text(item.title) },
|
||||
modifier = Modifier.semantics { testTag = item.testingTag }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -75,6 +75,7 @@ import org.kiwix.kiwixmobile.core.extensions.snack
|
||||
import org.kiwix.kiwixmobile.core.extensions.toast
|
||||
import org.kiwix.kiwixmobile.core.main.CoreMainActivity
|
||||
import org.kiwix.kiwixmobile.core.main.MainRepositoryActions
|
||||
import org.kiwix.kiwixmobile.core.main.ZIM_FILE_URI_KEY
|
||||
import org.kiwix.kiwixmobile.core.navigateToAppSettings
|
||||
import org.kiwix.kiwixmobile.core.navigateToSettings
|
||||
import org.kiwix.kiwixmobile.core.reader.ZimFileReader
|
||||
@ -283,10 +284,6 @@ class LocalLibraryFragment : BaseFragment(), CopyMoveFileHandler.FileCopyMoveCal
|
||||
}
|
||||
zimManageViewModel.setAlertDialogShower(dialogShower as AlertDialogShower)
|
||||
zimManageViewModel.fileSelectListStates.observe(viewLifecycleOwner, Observer(::render))
|
||||
.also {
|
||||
// coreMainActivity.navHostContainer
|
||||
// .setBottomMarginToFragmentContainerView(0)
|
||||
}
|
||||
coroutineJobs.apply {
|
||||
add(sideEffects())
|
||||
add(fileSelectActions())
|
||||
@ -315,9 +312,9 @@ class LocalLibraryFragment : BaseFragment(), CopyMoveFileHandler.FileCopyMoveCal
|
||||
}
|
||||
|
||||
private fun showCopyMoveDialogForOpenedZimFileFromStorage() {
|
||||
val args = LocalLibraryFragmentArgs.fromBundle(requireArguments())
|
||||
if (args.zimFileUri.isNotEmpty()) {
|
||||
handleSelectedFileUri(args.zimFileUri.toUri())
|
||||
val zimFileUri = arguments?.getString(ZIM_FILE_URI_KEY).orEmpty()
|
||||
if (zimFileUri.isNotEmpty()) {
|
||||
handleSelectedFileUri(zimFileUri.toUri())
|
||||
}
|
||||
requireArguments().clear()
|
||||
}
|
||||
|
@ -294,10 +294,6 @@ class OnlineLibraryFragment : BaseFragment(), FragmentActivityExtensions {
|
||||
libraryItems
|
||||
.onEach { onLibraryItemsChange(it) }
|
||||
.launchIn(viewLifecycleOwner.lifecycleScope)
|
||||
.also {
|
||||
// coreMainActivity.navHostContainer
|
||||
// .setBottomMarginToFragmentContainerView(0)
|
||||
}
|
||||
// Observe when online library downloading.
|
||||
onlineLibraryDownloading
|
||||
.onEach { (initialLibraryDownloading, loadingMoreItem) ->
|
||||
|
@ -40,11 +40,14 @@ import org.kiwix.kiwixmobile.core.extensions.snack
|
||||
import org.kiwix.kiwixmobile.core.extensions.toast
|
||||
import org.kiwix.kiwixmobile.core.extensions.update
|
||||
import org.kiwix.kiwixmobile.core.main.CoreMainActivity
|
||||
import org.kiwix.kiwixmobile.core.main.PAGE_URL_KEY
|
||||
import org.kiwix.kiwixmobile.core.main.ZIM_FILE_URI_KEY
|
||||
import org.kiwix.kiwixmobile.core.main.reader.CoreReaderFragment
|
||||
import org.kiwix.kiwixmobile.core.main.reader.HIDE_TAB_SWITCHER_DELAY
|
||||
import org.kiwix.kiwixmobile.core.main.reader.RestoreOrigin
|
||||
import org.kiwix.kiwixmobile.core.main.reader.RestoreOrigin.FromExternalLaunch
|
||||
import org.kiwix.kiwixmobile.core.main.reader.RestoreOrigin.FromSearchScreen
|
||||
import org.kiwix.kiwixmobile.core.main.reader.SEARCH_ITEM_TITLE_KEY
|
||||
import org.kiwix.kiwixmobile.core.page.history.adapter.WebViewHistoryItem
|
||||
import org.kiwix.kiwixmobile.core.reader.ZimReaderSource
|
||||
import org.kiwix.kiwixmobile.core.reader.ZimReaderSource.Companion.fromDatabaseValue
|
||||
@ -83,11 +86,13 @@ class KiwixReaderFragment : CoreReaderFragment() {
|
||||
@Suppress("MagicNumber")
|
||||
private fun openPageInBookFromNavigationArguments() {
|
||||
showProgressBarWithProgress(30)
|
||||
val args = KiwixReaderFragmentArgs.fromBundle(requireArguments())
|
||||
val zimFileUri = arguments?.getString(ZIM_FILE_URI_KEY).orEmpty()
|
||||
val pageUrl = arguments?.getString(PAGE_URL_KEY).orEmpty()
|
||||
val searchItemTitle = arguments?.getString(SEARCH_ITEM_TITLE_KEY).orEmpty()
|
||||
coreReaderLifeCycleScope?.launch {
|
||||
if (args.pageUrl.isNotEmpty()) {
|
||||
if (args.zimFileUri.isNotEmpty()) {
|
||||
tryOpeningZimFile(args.zimFileUri)
|
||||
if (pageUrl.isNotEmpty()) {
|
||||
if (zimFileUri.isNotEmpty()) {
|
||||
tryOpeningZimFile(zimFileUri)
|
||||
} else {
|
||||
// Set up bookmarks for the current book when opening bookmarks from the Bookmark screen.
|
||||
// This is necessary because we are not opening the ZIM file again; the bookmark is
|
||||
@ -96,13 +101,13 @@ class KiwixReaderFragment : CoreReaderFragment() {
|
||||
zimReaderContainer?.zimFileReader?.let(::setUpBookmarks)
|
||||
}
|
||||
hideProgressBar()
|
||||
loadUrlWithCurrentWebview(args.pageUrl)
|
||||
loadUrlWithCurrentWebview(pageUrl)
|
||||
} else {
|
||||
if (args.zimFileUri.isNotEmpty()) {
|
||||
tryOpeningZimFile(args.zimFileUri)
|
||||
if (zimFileUri.isNotEmpty()) {
|
||||
tryOpeningZimFile(zimFileUri)
|
||||
} else {
|
||||
val restoreOrigin =
|
||||
if (args.searchItemTitle.isNotEmpty()) FromSearchScreen else FromExternalLaunch
|
||||
if (searchItemTitle.isNotEmpty()) FromSearchScreen else FromExternalLaunch
|
||||
manageExternalLaunchAndRestoringViewState(restoreOrigin)
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ import androidx.navigation.NavType
|
||||
import androidx.navigation.compose.NavHost
|
||||
import androidx.navigation.compose.composable
|
||||
import androidx.navigation.navArgument
|
||||
import androidx.navigation.navDeepLink
|
||||
import org.kiwix.kiwixmobile.core.main.BOOKMARK_FRAGMENT
|
||||
import org.kiwix.kiwixmobile.core.main.DOWNLOAD_FRAGMENT
|
||||
import org.kiwix.kiwixmobile.core.main.FIND_IN_PAGE_SEARCH_STRING
|
||||
@ -56,6 +57,7 @@ import org.kiwix.kiwixmobile.core.main.SETTINGS_FRAGMENT
|
||||
import org.kiwix.kiwixmobile.core.main.SHOULD_OPEN_IN_NEW_TAB
|
||||
import org.kiwix.kiwixmobile.core.main.ZIM_FILE_URI_KEY
|
||||
import org.kiwix.kiwixmobile.core.main.ZIM_HOST_FRAGMENT
|
||||
import org.kiwix.kiwixmobile.core.main.ZIM_HOST_NAV_DEEP_LINK
|
||||
import org.kiwix.kiwixmobile.core.main.reader.SEARCH_ITEM_TITLE_KEY
|
||||
import org.kiwix.kiwixmobile.core.page.bookmark.BookmarksFragment
|
||||
import org.kiwix.kiwixmobile.core.page.history.HistoryFragment
|
||||
@ -68,6 +70,7 @@ import org.kiwix.kiwixmobile.help.KiwixHelpFragment
|
||||
import org.kiwix.kiwixmobile.intro.IntroFragment
|
||||
import org.kiwix.kiwixmobile.language.LanguageFragment
|
||||
import org.kiwix.kiwixmobile.localFileTransfer.LocalFileTransferFragment
|
||||
import org.kiwix.kiwixmobile.localFileTransfer.URIS_KEY
|
||||
import org.kiwix.kiwixmobile.nav.destination.library.local.LocalLibraryFragment
|
||||
import org.kiwix.kiwixmobile.nav.destination.library.online.OnlineLibraryFragment
|
||||
import org.kiwix.kiwixmobile.nav.destination.reader.KiwixReaderFragment
|
||||
@ -179,7 +182,10 @@ fun KiwixNavGraph(
|
||||
LanguageFragment()
|
||||
}
|
||||
}
|
||||
composable(KiwixDestination.ZimHost.route) {
|
||||
composable(
|
||||
KiwixDestination.ZimHost.route,
|
||||
deepLinks = listOf(navDeepLink { uriPattern = ZIM_HOST_NAV_DEEP_LINK })
|
||||
) {
|
||||
FragmentContainer {
|
||||
ZimHostFragment()
|
||||
}
|
||||
@ -228,14 +234,14 @@ fun KiwixNavGraph(
|
||||
composable(
|
||||
route = KiwixDestination.LocalFileTransfer.route,
|
||||
arguments = listOf(
|
||||
navArgument("uris") {
|
||||
navArgument(URIS_KEY) {
|
||||
type = NavType.StringType
|
||||
nullable = true
|
||||
defaultValue = null
|
||||
}
|
||||
)
|
||||
) { backStackEntry ->
|
||||
val urisParam = backStackEntry.arguments?.getString("uris")
|
||||
val urisParam = backStackEntry.arguments?.getString(URIS_KEY)
|
||||
val uris: List<Uri>? =
|
||||
urisParam?.takeIf { it != "null" }?.split(",")?.map {
|
||||
Uri.decode(it).toUri()
|
||||
@ -245,7 +251,7 @@ fun KiwixNavGraph(
|
||||
LocalFileTransferFragment().apply {
|
||||
arguments = Bundle().apply {
|
||||
putParcelableArray(
|
||||
"uris",
|
||||
URIS_KEY,
|
||||
uris?.toTypedArray()
|
||||
)
|
||||
}
|
||||
@ -341,12 +347,12 @@ sealed class KiwixDestination(val route: String) {
|
||||
}
|
||||
}
|
||||
|
||||
object LocalFileTransfer : KiwixDestination("$LOCAL_FILE_TRANSFER_FRAGMENT?uris={uris}") {
|
||||
object LocalFileTransfer : KiwixDestination("$LOCAL_FILE_TRANSFER_FRAGMENT?$URIS_KEY={uris}") {
|
||||
fun createRoute(uris: String? = null): String {
|
||||
return if (uris != null) {
|
||||
"$LOCAL_FILE_TRANSFER_FRAGMENT?uris=${Uri.encode(uris)}"
|
||||
"$LOCAL_FILE_TRANSFER_FRAGMENT?$URIS_KEY=${Uri.encode(uris)}"
|
||||
} else {
|
||||
"$LOCAL_FILE_TRANSFER_FRAGMENT?uris=null"
|
||||
"$LOCAL_FILE_TRANSFER_FRAGMENT?$URIS_KEY=null"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,11 +26,10 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.navigation.NavDeepLinkBuilder
|
||||
import androidx.core.net.toUri
|
||||
import org.kiwix.kiwixmobile.core.CoreApp
|
||||
import org.kiwix.kiwixmobile.core.R
|
||||
import org.kiwix.kiwixmobile.R.id
|
||||
import org.kiwix.kiwixmobile.R.navigation
|
||||
import org.kiwix.kiwixmobile.core.main.ZIM_HOST_NAV_DEEP_LINK
|
||||
import org.kiwix.kiwixmobile.core.qr.GenerateQR
|
||||
import org.kiwix.kiwixmobile.core.utils.HOTSPOT_SERVICE_CHANNEL_ID
|
||||
import javax.inject.Inject
|
||||
@ -58,13 +57,15 @@ class HotspotNotificationManager @Inject constructor(
|
||||
@SuppressLint("UnspecifiedImmutableFlag")
|
||||
fun buildForegroundNotification(uri: String? = null): Notification {
|
||||
val coreMainActivity = (context as CoreApp).getMainActivity()
|
||||
val contentIntent =
|
||||
NavDeepLinkBuilder(context).setComponentName(
|
||||
coreMainActivity.mainActivity::class.java
|
||||
)
|
||||
.setGraph(navigation.kiwix_nav_graph)
|
||||
.setDestination(id.zimHostFragment)
|
||||
.createPendingIntent()
|
||||
val contentIntent = PendingIntent.getActivity(
|
||||
context,
|
||||
0,
|
||||
Intent(context, coreMainActivity.mainActivity::class.java).apply {
|
||||
action = Intent.ACTION_VIEW
|
||||
data = ZIM_HOST_NAV_DEEP_LINK.toUri()
|
||||
},
|
||||
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
|
||||
)
|
||||
hotspotNotificationChannel()
|
||||
val stopIntent =
|
||||
Intent(context, HotspotService::class.java).setAction(
|
||||
|
@ -1,36 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Kiwix Android
|
||||
~ Copyright (c) 2020 Kiwix <android.kiwix.org>
|
||||
~ This program is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 3 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
~
|
||||
-->
|
||||
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/readerFragment"
|
||||
android:icon="@drawable/ic_reader_navigation_white_24px"
|
||||
android:title="@string/reader" />
|
||||
|
||||
<item
|
||||
android:id="@+id/libraryFragment"
|
||||
android:icon="@drawable/ic_library_navigation_white_24dp"
|
||||
android:title="@string/library" />
|
||||
|
||||
<item
|
||||
android:id="@+id/downloadsFragment"
|
||||
android:icon="@drawable/ic_download_navigation_white_24dp"
|
||||
android:title="@string/download" />
|
||||
|
||||
</menu>
|
@ -1,149 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Kiwix Android
|
||||
~ Copyright (c) 2020 Kiwix <android.kiwix.org>
|
||||
~ This program is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 3 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
~
|
||||
-->
|
||||
|
||||
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
app:startDestination="@id/readerFragment">
|
||||
<fragment
|
||||
android:id="@+id/readerFragment"
|
||||
android:name="org.kiwix.kiwixmobile.nav.destination.reader.KiwixReaderFragment"
|
||||
android:label="Reader">
|
||||
<argument
|
||||
android:name="zimFileUri"
|
||||
android:defaultValue=""
|
||||
app:argType="string" />
|
||||
<argument
|
||||
android:name="findInPageSearchString"
|
||||
android:defaultValue=""
|
||||
app:argType="string" />
|
||||
<argument
|
||||
android:name="pageUrl"
|
||||
android:defaultValue=""
|
||||
app:argType="string" />
|
||||
<argument
|
||||
android:name="shouldOpenInNewTab"
|
||||
android:defaultValue="false"
|
||||
app:argType="boolean" />
|
||||
<argument
|
||||
android:name="searchItemTitle"
|
||||
android:defaultValue=""
|
||||
app:argType="string" />
|
||||
|
||||
<action
|
||||
android:id="@+id/action_navigation_reader_to_navigation_library"
|
||||
app:destination="@id/libraryFragment"
|
||||
app:popUpTo="@id/readerFragment"
|
||||
app:popUpToSaveState="true"
|
||||
app:restoreState="true" />
|
||||
|
||||
<action
|
||||
android:id="@+id/action_readerFragment_to_searchFragment"
|
||||
app:destination="@id/searchFragment" />
|
||||
<action
|
||||
android:id="@+id/action_readerFragment_to_introFragment"
|
||||
app:destination="@id/introFragment"
|
||||
app:popUpTo="@id/readerFragment"
|
||||
app:popUpToInclusive="true" />
|
||||
</fragment>
|
||||
|
||||
<fragment
|
||||
android:id="@+id/libraryFragment"
|
||||
android:name="org.kiwix.kiwixmobile.nav.destination.library.local.LocalLibraryFragment"
|
||||
android:label="Library">
|
||||
<action
|
||||
android:id="@+id/action_navigation_library_to_navigation_reader"
|
||||
app:destination="@id/readerFragment"
|
||||
app:popUpTo="@id/readerFragment" />
|
||||
<action
|
||||
android:id="@+id/action_navigation_library_to_navigation_downloads"
|
||||
app:destination="@id/downloadsFragment"
|
||||
app:popUpTo="@id/libraryFragment"
|
||||
app:popUpToInclusive="true"
|
||||
app:restoreState="true" />
|
||||
<action
|
||||
android:id="@+id/action_libraryFragment_to_localFileTransferFragment"
|
||||
app:destination="@id/localFileTransferFragment" />
|
||||
<argument
|
||||
android:name="zimFileUri"
|
||||
android:defaultValue=""
|
||||
app:argType="string" />
|
||||
</fragment>
|
||||
|
||||
<fragment
|
||||
android:id="@+id/downloadsFragment"
|
||||
android:name="org.kiwix.kiwixmobile.nav.destination.library.online.OnlineLibraryFragment"
|
||||
android:label="Downloads" />
|
||||
<fragment
|
||||
android:id="@+id/bookmarksFragment"
|
||||
android:name="org.kiwix.kiwixmobile.core.page.bookmark.BookmarksFragment"
|
||||
android:label="BookmarksFragment" />
|
||||
<fragment
|
||||
android:id="@+id/notesFragment"
|
||||
android:name="org.kiwix.kiwixmobile.core.page.notes.NotesFragment"
|
||||
android:label="NotesFragment" />
|
||||
<fragment
|
||||
android:id="@+id/introFragment"
|
||||
android:name="org.kiwix.kiwixmobile.intro.IntroFragment"
|
||||
android:label="IntroFragment">
|
||||
<action
|
||||
android:id="@+id/action_introfragment_to_libraryFragment"
|
||||
app:destination="@id/libraryFragment"
|
||||
app:popUpTo="@id/introFragment"
|
||||
app:popUpToInclusive="true" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/historyFragment"
|
||||
android:name="org.kiwix.kiwixmobile.core.page.history.HistoryFragment"
|
||||
android:label="HistoryFragment" />
|
||||
<fragment
|
||||
android:id="@+id/languageFragment"
|
||||
android:name="org.kiwix.kiwixmobile.language.LanguageFragment"
|
||||
android:label="LanguageFragment" />
|
||||
<fragment
|
||||
android:id="@+id/zimHostFragment"
|
||||
android:name="org.kiwix.kiwixmobile.webserver.ZimHostFragment"
|
||||
android:label="ZimHostFragment" />
|
||||
<fragment
|
||||
android:id="@+id/helpFragment"
|
||||
android:name="org.kiwix.kiwixmobile.help.KiwixHelpFragment"
|
||||
android:label="HelpFragment" />
|
||||
<fragment
|
||||
android:id="@+id/kiwixSettingsFragment"
|
||||
android:name="org.kiwix.kiwixmobile.settings.KiwixSettingsFragment"
|
||||
android:label="KiwixSettingsFragment" />
|
||||
<fragment
|
||||
android:id="@+id/searchFragment"
|
||||
android:name="org.kiwix.kiwixmobile.core.search.SearchFragment"
|
||||
android:label="SearchFragment">
|
||||
<action
|
||||
android:id="@+id/action_searchFragment_to_readerFragment"
|
||||
app:destination="@id/readerFragment"
|
||||
app:popUpTo="@id/readerFragment" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/localFileTransferFragment"
|
||||
android:name="org.kiwix.kiwixmobile.localFileTransfer.LocalFileTransferFragment"
|
||||
android:label="LocalFileTransferFragment">
|
||||
<argument
|
||||
android:name="uris"
|
||||
android:defaultValue="@null"
|
||||
app:argType="android.net.Uri[]"
|
||||
app:nullable="true" />
|
||||
</fragment>
|
||||
</navigation>
|
@ -62,6 +62,7 @@ import org.kiwix.kiwixmobile.core.reader.ZimReaderSource
|
||||
import org.kiwix.kiwixmobile.core.utils.ExternalLinkOpener
|
||||
import org.kiwix.kiwixmobile.core.utils.dialog.AlertDialogShower
|
||||
import org.kiwix.kiwixmobile.core.utils.dialog.RateDialogHandler
|
||||
import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import javax.inject.Inject
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
@ -88,6 +89,16 @@ const val HELP_FRAGMENT = "helpFragment"
|
||||
const val SETTINGS_FRAGMENT = "settingsFragment"
|
||||
const val SEARCH_FRAGMENT = "searchFragment"
|
||||
const val LOCAL_FILE_TRANSFER_FRAGMENT = "localFileTransferFragment"
|
||||
const val ZIM_HOST_DEEP_LINK_SCHEME = "kiwix"
|
||||
const val ZIM_HOST_NAV_DEEP_LINK = "$ZIM_HOST_DEEP_LINK_SCHEME://zimhost"
|
||||
const val LEFT_DRAWER_BOOKMARK_ITEM_TESTING_TAG = "leftDrawerBookmarkItemTestingTag"
|
||||
const val LEFT_DRAWER_HISTORY_ITEM_TESTING_TAG = "leftDrawerHistoryItemTestingTag"
|
||||
const val LEFT_DRAWER_NOTES_ITEM_TESTING_TAG = "leftDrawerNotesItemTestingTag"
|
||||
const val LEFT_DRAWER_SETTINGS_ITEM_TESTING_TAG = "leftDrawerSettingsItemTestingTag"
|
||||
const val LEFT_DRAWER_SUPPORT_ITEM_TESTING_TAG = "leftDrawerSupportItemTestingTag"
|
||||
const val LEFT_DRAWER_HELP_ITEM_TESTING_TAG = "leftDrawerHelpItemTestingTag"
|
||||
const val LEFT_DRAWER_ZIM_HOST_ITEM_TESTING_TAG = "leftDrawerZimHostItemTestingTag"
|
||||
const val LEFT_DRAWER_ABOUT_APP_ITEM_TESTING_TAG = "leftDrawerAboutAppItemTestingTag"
|
||||
|
||||
abstract class CoreMainActivity : BaseActivity(), WebViewProvider {
|
||||
abstract val searchFragmentRoute: String
|
||||
@ -373,7 +384,9 @@ abstract class CoreMainActivity : BaseActivity(), WebViewProvider {
|
||||
}
|
||||
|
||||
private fun activeFragments(): MutableList<Fragment> =
|
||||
supportFragmentManager.fragments
|
||||
supportFragmentManager.fragments.also {
|
||||
Log.d("Fragments", "Found fragments: ${supportFragmentManager.fragments}")
|
||||
}
|
||||
|
||||
fun navigate(action: NavDirections) {
|
||||
navController.currentDestination?.getAction(action.actionId)?.run {
|
||||
@ -453,19 +466,22 @@ abstract class CoreMainActivity : BaseActivity(), WebViewProvider {
|
||||
title = CoreApp.instance.getString(R.string.bookmarks),
|
||||
iconRes = R.drawable.ic_bookmark_black_24dp,
|
||||
visible = true,
|
||||
onClick = { openBookmarks() }
|
||||
onClick = { openBookmarks() },
|
||||
testingTag = LEFT_DRAWER_BOOKMARK_ITEM_TESTING_TAG
|
||||
),
|
||||
DrawerMenuItem(
|
||||
title = CoreApp.instance.getString(R.string.history),
|
||||
iconRes = R.drawable.ic_history_24px,
|
||||
visible = true,
|
||||
onClick = { openHistory() }
|
||||
onClick = { openHistory() },
|
||||
testingTag = LEFT_DRAWER_HISTORY_ITEM_TESTING_TAG
|
||||
),
|
||||
DrawerMenuItem(
|
||||
title = CoreApp.instance.getString(R.string.pref_notes),
|
||||
iconRes = R.drawable.ic_add_note,
|
||||
visible = true,
|
||||
onClick = { openNotes() }
|
||||
onClick = { openNotes() },
|
||||
testingTag = LEFT_DRAWER_NOTES_ITEM_TESTING_TAG
|
||||
),
|
||||
zimHostDrawerMenuItem
|
||||
)
|
||||
@ -479,7 +495,8 @@ abstract class CoreMainActivity : BaseActivity(), WebViewProvider {
|
||||
title = CoreApp.instance.getString(R.string.menu_settings),
|
||||
iconRes = R.drawable.ic_settings_24px,
|
||||
visible = true,
|
||||
onClick = { openSettings() }
|
||||
onClick = { openSettings() },
|
||||
testingTag = LEFT_DRAWER_SETTINGS_ITEM_TESTING_TAG
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -24,7 +24,8 @@ data class DrawerMenuItem(
|
||||
val title: String,
|
||||
@DrawableRes val iconRes: Int,
|
||||
val visible: Boolean = true,
|
||||
val onClick: () -> Unit
|
||||
val onClick: () -> Unit,
|
||||
val testingTag: String
|
||||
)
|
||||
|
||||
data class DrawerMenuGroup(val drawerMenuItemList: List<DrawerMenuItem>)
|
||||
|
@ -123,6 +123,7 @@ import org.kiwix.kiwixmobile.core.main.ServiceWorkerUninitialiser
|
||||
import org.kiwix.kiwixmobile.core.main.UNINITIALISER_ADDRESS
|
||||
import org.kiwix.kiwixmobile.core.main.WebViewCallback
|
||||
import org.kiwix.kiwixmobile.core.main.WebViewProvider
|
||||
import org.kiwix.kiwixmobile.core.main.ZIM_HOST_DEEP_LINK_SCHEME
|
||||
import org.kiwix.kiwixmobile.core.main.reader.RestoreOrigin.FromExternalLaunch
|
||||
import org.kiwix.kiwixmobile.core.navigateToAppSettings
|
||||
import org.kiwix.kiwixmobile.core.page.bookmark.adapter.LibkiwixBookmarkItem
|
||||
@ -1931,7 +1932,7 @@ abstract class CoreReaderFragment :
|
||||
// Added condition to handle ZIM files. When opening from storage, the intent may
|
||||
// return null for the type, triggering the search unintentionally. This condition
|
||||
// prevents such occurrences.
|
||||
intent.scheme !in listOf("file", "content")
|
||||
intent.scheme !in listOf("file", "content", ZIM_HOST_DEEP_LINK_SCHEME)
|
||||
) {
|
||||
val searchString = if (intent.data == null) "" else intent.data?.lastPathSegment
|
||||
openSearch(
|
||||
|
@ -37,6 +37,8 @@ import org.kiwix.kiwixmobile.core.extensions.browserIntent
|
||||
import org.kiwix.kiwixmobile.core.main.ACTION_NEW_TAB
|
||||
import org.kiwix.kiwixmobile.core.main.CoreMainActivity
|
||||
import org.kiwix.kiwixmobile.core.main.DrawerMenuItem
|
||||
import org.kiwix.kiwixmobile.core.main.LEFT_DRAWER_ABOUT_APP_ITEM_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.core.main.LEFT_DRAWER_SUPPORT_ITEM_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.core.main.NEW_TAB_SHORTCUT_ID
|
||||
import org.kiwix.kiwixmobile.core.utils.dialog.DialogHost
|
||||
import org.kiwix.kiwixmobile.custom.BuildConfig
|
||||
@ -117,7 +119,8 @@ class CustomMainActivity : CoreMainActivity() {
|
||||
onClick = {
|
||||
closeNavigationDrawer()
|
||||
externalLinkOpener.openExternalUrl(BuildConfig.SUPPORT_URL.toUri().browserIntent(), false)
|
||||
}
|
||||
},
|
||||
testingTag = LEFT_DRAWER_SUPPORT_ITEM_TESTING_TAG
|
||||
)
|
||||
} else {
|
||||
/**
|
||||
@ -146,7 +149,8 @@ class CustomMainActivity : CoreMainActivity() {
|
||||
BuildConfig.ABOUT_APP_URL.toUri().browserIntent(),
|
||||
false
|
||||
)
|
||||
}
|
||||
},
|
||||
testingTag = LEFT_DRAWER_ABOUT_APP_ITEM_TESTING_TAG
|
||||
)
|
||||
} else {
|
||||
null
|
||||
|
@ -34,6 +34,7 @@ import org.kiwix.kiwixmobile.core.extensions.browserIntent
|
||||
import org.kiwix.kiwixmobile.core.extensions.isFileExist
|
||||
import org.kiwix.kiwixmobile.core.extensions.update
|
||||
import org.kiwix.kiwixmobile.core.main.CoreMainActivity
|
||||
import org.kiwix.kiwixmobile.core.main.PAGE_URL_KEY
|
||||
import org.kiwix.kiwixmobile.core.main.reader.CoreReaderFragment
|
||||
import org.kiwix.kiwixmobile.core.main.reader.ReaderMenuState
|
||||
import org.kiwix.kiwixmobile.core.main.reader.RestoreOrigin
|
||||
@ -173,9 +174,9 @@ class CustomReaderFragment : CoreReaderFragment() {
|
||||
}
|
||||
|
||||
private fun loadPageFromNavigationArguments() {
|
||||
val args = CustomReaderFragmentArgs.fromBundle(requireArguments())
|
||||
if (args.pageUrl.isNotEmpty()) {
|
||||
loadUrlWithCurrentWebview(args.pageUrl)
|
||||
val pageUrl = arguments?.getString(PAGE_URL_KEY).orEmpty()
|
||||
if (pageUrl.isNotEmpty()) {
|
||||
loadUrlWithCurrentWebview(pageUrl)
|
||||
// Setup bookmark for current book
|
||||
// See https://github.com/kiwix/kiwix-android/issues/3541
|
||||
zimReaderContainer?.zimFileReader?.let(::setUpBookmarks)
|
||||
|
@ -1,50 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Kiwix Android
|
||||
~ Copyright (c) 2020 Kiwix <android.kiwix.org>
|
||||
~ This program is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 3 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
~
|
||||
-->
|
||||
|
||||
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/custom_drawer_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:ignore="UnusedIds">
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/custom_nav_controller"
|
||||
android:name="org.kiwix.kiwixmobile.core.main.NavigationHostFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:defaultNavHost="true"
|
||||
app:navGraph="@navigation/custom_nav_graph" />
|
||||
|
||||
<com.google.android.material.navigation.NavigationView
|
||||
android:id="@+id/drawer_nav_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
app:headerLayout="@layout/nav_main"
|
||||
app:menu="@menu/menu_drawer_main" />
|
||||
|
||||
<com.google.android.material.navigation.NavigationView
|
||||
android:id="@+id/activity_main_nav_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginTop="24dp"
|
||||
app:headerLayout="@layout/drawer_right" />
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
@ -1,80 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Kiwix Android
|
||||
~ Copyright (c) 2020 Kiwix <android.kiwix.org>
|
||||
~ This program is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 3 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
~
|
||||
-->
|
||||
|
||||
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
app:startDestination="@id/customReaderFragment">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/customReaderFragment"
|
||||
android:name="org.kiwix.kiwixmobile.custom.main.CustomReaderFragment"
|
||||
android:label="CustomReaderFragment">
|
||||
|
||||
<argument
|
||||
android:name="pageUrl"
|
||||
android:defaultValue=""
|
||||
app:argType="string" />
|
||||
<argument
|
||||
android:name="findInPageSearchString"
|
||||
android:defaultValue=""
|
||||
app:argType="string" />
|
||||
<argument
|
||||
android:name="shouldOpenInNewTab"
|
||||
android:defaultValue="false"
|
||||
app:argType="boolean" />
|
||||
<action
|
||||
android:id="@+id/action_customReader_to_customDownload"
|
||||
app:destination="@id/customDownloadFragment"
|
||||
app:popUpTo="@id/customReaderFragment"
|
||||
app:popUpToInclusive="true" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/historyFragment"
|
||||
android:name="org.kiwix.kiwixmobile.core.page.history.HistoryFragment"
|
||||
android:label="HistoryFragment" />
|
||||
<fragment
|
||||
android:id="@+id/notesFragment"
|
||||
android:name="org.kiwix.kiwixmobile.core.page.notes.NotesFragment"
|
||||
android:label="NotesFragment" />
|
||||
<fragment
|
||||
android:id="@+id/bookmarksFragment"
|
||||
android:name="org.kiwix.kiwixmobile.core.page.bookmark.BookmarksFragment"
|
||||
android:label="BookmarksFragment" />
|
||||
<fragment
|
||||
android:id="@+id/helpFragment"
|
||||
android:name="org.kiwix.kiwixmobile.custom.help.CustomHelpFragment"
|
||||
android:label="HelpFragment" />
|
||||
<fragment
|
||||
android:id="@+id/customSettingsFragment"
|
||||
android:name="org.kiwix.kiwixmobile.custom.settings.CustomSettingsFragment"
|
||||
android:label="CustomSettingsFragment" />
|
||||
<fragment
|
||||
android:id="@+id/customDownloadFragment"
|
||||
android:name="org.kiwix.kiwixmobile.custom.download.CustomDownloadFragment"
|
||||
android:label="CustomDownloadFragment">
|
||||
<action
|
||||
android:id="@+id/action_customDownload_to_customReader"
|
||||
app:destination="@id/customReaderFragment"
|
||||
app:popUpTo="@id/customDownloadFragment"
|
||||
app:popUpToInclusive="true" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/searchFragment"
|
||||
android:name="org.kiwix.kiwixmobile.core.search.SearchFragment"
|
||||
android:label="SearchFragment" />
|
||||
</navigation>
|
Loading…
x
Reference in New Issue
Block a user