mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-11 08:27:50 -04:00
Updated SaveHandler to use Bundle.get()
instead of deprecated
msg.data['url']`
This commit is contained in:
parent
97a17eac3a
commit
35ff151e9b
@ -24,6 +24,7 @@ import android.os.Handler
|
|||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import android.os.Message
|
import android.os.Message
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
|
import android.util.Log
|
||||||
import android.view.ContextMenu
|
import android.view.ContextMenu
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN
|
import android.view.WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN
|
||||||
@ -169,13 +170,15 @@ open class KiwixWebView @SuppressLint("SetJavaScriptEnabled") constructor(
|
|||||||
|
|
||||||
@SuppressWarnings("NestedBlockDepth")
|
@SuppressWarnings("NestedBlockDepth")
|
||||||
override fun handleMessage(msg: Message) {
|
override fun handleMessage(msg: Message) {
|
||||||
val url = msg.data["url"] as? String
|
val url = msg.data.getString("url", null)
|
||||||
val src = msg.data["src"] as? String
|
val src = msg.data.getString("src", null)
|
||||||
if (url != null || src != null) {
|
if (url != null || src != null) {
|
||||||
val savedFile =
|
val savedFile =
|
||||||
FileUtils.downloadFileFromUrl(url, src, zimReaderContainer, sharedPreferenceUtil)
|
FileUtils.downloadFileFromUrl(url, src, zimReaderContainer, sharedPreferenceUtil)
|
||||||
savedFile?.let {
|
savedFile?.let {
|
||||||
instance.toast(instance.getString(R.string.save_media_saved, it.name))
|
instance.toast(instance.getString(R.string.save_media_saved, it.name)).also {
|
||||||
|
Log.e("savedFile", "handleMessage: ${savedFile.isFile} ${savedFile.path}")
|
||||||
|
}
|
||||||
} ?: run {
|
} ?: run {
|
||||||
instance.toast(R.string.save_media_error)
|
instance.toast(R.string.save_media_error)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user