mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 18:56:44 -04:00
Fixed: Opening a searched item and "Find in Page" was not working after rebasing.
* Removed unnecessary code from the project to simplify it and make it more robust.
This commit is contained in:
parent
3f80e9d852
commit
c29997aa12
@ -510,6 +510,16 @@ abstract class CoreReaderFragment :
|
||||
readAloudService?.registerCallBack(this@CoreReaderFragment)
|
||||
}
|
||||
}
|
||||
requireActivity().observeNavigationResult<String>(
|
||||
FIND_IN_PAGE_SEARCH_STRING,
|
||||
viewLifecycleOwner,
|
||||
Observer(::storeFindInPageTitle)
|
||||
)
|
||||
requireActivity().observeNavigationResult<SearchItemToOpen>(
|
||||
TAG_FILE_SEARCHED,
|
||||
viewLifecycleOwner,
|
||||
Observer(::storeSearchItem)
|
||||
)
|
||||
handleClicks()
|
||||
}
|
||||
|
||||
@ -2790,6 +2800,7 @@ abstract class CoreReaderFragment :
|
||||
onComplete: () -> Unit
|
||||
) {
|
||||
try {
|
||||
isFromManageExternalLaunch = true
|
||||
currentWebViewIndex = 0
|
||||
tabsAdapter?.apply {
|
||||
webViewList.removeAt(0)
|
||||
@ -2807,28 +2818,6 @@ abstract class CoreReaderFragment :
|
||||
Log.w(TAG_KIWIX, "Kiwix shared preferences corrupted", ignore)
|
||||
activity.toast(R.string.could_not_restore_tabs, Toast.LENGTH_LONG)
|
||||
}
|
||||
// After restoring the tabs, observe any search actions that the user might have triggered.
|
||||
// Since the ZIM file opening functionality has been moved to a background thread,
|
||||
// we ensure that all necessary actions are completed before observing these search actions.
|
||||
observeSearchActions()
|
||||
}
|
||||
|
||||
/**
|
||||
* Observes any search-related actions triggered by the user, such as "Find in Page" or
|
||||
* opening a specific search item.
|
||||
* This method sets up observers for navigation results related to search functionality.
|
||||
*/
|
||||
private fun observeSearchActions() {
|
||||
requireActivity().observeNavigationResult<String>(
|
||||
FIND_IN_PAGE_SEARCH_STRING,
|
||||
viewLifecycleOwner,
|
||||
Observer(::storeFindInPageTitle)
|
||||
)
|
||||
requireActivity().observeNavigationResult<SearchItemToOpen>(
|
||||
TAG_FILE_SEARCHED,
|
||||
viewLifecycleOwner,
|
||||
Observer(::storeSearchItem)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user