mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-08 14:52:13 -04:00
Merge pull request #4074 from kiwix/Fixes#4065
Fixed: Unclean opening local ZIM file in library
This commit is contained in:
commit
9c6267d05f
@ -89,7 +89,9 @@ class KiwixReaderFragment : CoreReaderFragment() {
|
||||
openPageInBookFromNavigationArguments()
|
||||
}
|
||||
|
||||
@Suppress("MagicNumber")
|
||||
private fun openPageInBookFromNavigationArguments() {
|
||||
showProgressBarWithProgress(30)
|
||||
val args = KiwixReaderFragmentArgs.fromBundle(requireArguments())
|
||||
lifecycleScope.launch {
|
||||
if (args.pageUrl.isNotEmpty()) {
|
||||
@ -102,6 +104,7 @@ class KiwixReaderFragment : CoreReaderFragment() {
|
||||
// See https://github.com/kiwix/kiwix-android/issues/3541
|
||||
zimReaderContainer?.zimFileReader?.let(::setUpBookmarks)
|
||||
}
|
||||
hideProgressBar()
|
||||
loadUrlWithCurrentWebview(args.pageUrl)
|
||||
} else {
|
||||
if (args.zimFileUri.isNotEmpty()) {
|
||||
@ -217,9 +220,6 @@ class KiwixReaderFragment : CoreReaderFragment() {
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (zimReaderContainer?.zimReaderSource == null) {
|
||||
exitBook()
|
||||
}
|
||||
if (isFullScreenVideo || isInFullScreenMode()) {
|
||||
hideNavBar()
|
||||
}
|
||||
|
@ -121,6 +121,7 @@ import org.kiwix.kiwixmobile.core.main.DocumentParser.SectionsListener
|
||||
import org.kiwix.kiwixmobile.core.main.KiwixTextToSpeech.OnInitSucceedListener
|
||||
import org.kiwix.kiwixmobile.core.main.KiwixTextToSpeech.OnSpeakingListener
|
||||
import org.kiwix.kiwixmobile.core.main.MainMenu.MenuClickListener
|
||||
import org.kiwix.kiwixmobile.core.main.RestoreOrigin.FromExternalLaunch
|
||||
import org.kiwix.kiwixmobile.core.main.TableDrawerAdapter.DocumentSection
|
||||
import org.kiwix.kiwixmobile.core.main.TableDrawerAdapter.TableClickListener
|
||||
import org.kiwix.kiwixmobile.core.navigateToAppSettings
|
||||
@ -174,7 +175,6 @@ import java.util.Date
|
||||
import javax.inject.Inject
|
||||
import kotlin.math.abs
|
||||
import kotlin.math.max
|
||||
import org.kiwix.kiwixmobile.core.main.RestoreOrigin.FromExternalLaunch
|
||||
|
||||
const val SEARCH_ITEM_TITLE_KEY = "searchItemTitle"
|
||||
|
||||
@ -1382,6 +1382,7 @@ abstract class CoreReaderFragment :
|
||||
bottomToolbar?.visibility = View.GONE
|
||||
actionBar?.title = getString(R.string.reader)
|
||||
contentFrame?.visibility = View.GONE
|
||||
hideProgressBar()
|
||||
mainMenu?.hideBookSpecificMenuItems()
|
||||
closeZimBook()
|
||||
}
|
||||
@ -1390,6 +1391,21 @@ abstract class CoreReaderFragment :
|
||||
zimReaderContainer?.setZimReaderSource(null)
|
||||
}
|
||||
|
||||
protected fun showProgressBarWithProgress(progress: Int) {
|
||||
progressBar?.apply {
|
||||
visibility = VISIBLE
|
||||
show()
|
||||
this.progress = progress
|
||||
}
|
||||
}
|
||||
|
||||
protected fun hideProgressBar() {
|
||||
progressBar?.apply {
|
||||
visibility = View.GONE
|
||||
hide()
|
||||
}
|
||||
}
|
||||
|
||||
private fun restoreDeletedTab(index: Int) {
|
||||
if (webViewList.isEmpty()) {
|
||||
reopenBook()
|
||||
@ -2331,14 +2347,10 @@ abstract class CoreReaderFragment :
|
||||
override fun webViewProgressChanged(progress: Int, webView: WebView) {
|
||||
if (isAdded) {
|
||||
updateUrlProcessor()
|
||||
progressBar?.apply {
|
||||
visibility = View.VISIBLE
|
||||
show()
|
||||
this.progress = progress
|
||||
if (progress == 100) {
|
||||
hide()
|
||||
Log.d(TAG_KIWIX, "Loaded URL: " + getCurrentWebView()?.url)
|
||||
}
|
||||
showProgressBarWithProgress(progress)
|
||||
if (progress == 100) {
|
||||
hideProgressBar()
|
||||
Log.d(TAG_KIWIX, "Loaded URL: " + getCurrentWebView()?.url)
|
||||
}
|
||||
(webView.context as AppCompatActivity).invalidateOptionsMenu()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user