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