1
0
mirror of https://github.com/fumiama/copymanga.git synced 2026-06-08 08:50:27 +08:00
This commit is contained in:
index
2020-10-14 17:44:01 +08:00
parent 5c9f45e272
commit 41fa9bdf17
9 changed files with 27 additions and 24 deletions

View File

@@ -45,7 +45,7 @@ class DlActivity : Activity() {
private var cdwnHeight = 0
private var canDl = false
private lateinit var toolsBox: ToolsBox
val mangaDlTools = MangaDlTools()
lateinit var mangaDlTools: MangaDlTools
@ExperimentalStdlibApi
@@ -54,6 +54,7 @@ class DlActivity : Activity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_dl)
mh?.saveUrlsOnly = true
mangaDlTools = MangaDlTools(this)
handler.sendEmptyMessage(-2)
}

View File

@@ -116,11 +116,9 @@ class ViewMangaActivity : Activity() {
}
private fun loadOneImg() {
Glide.with(this@ViewMangaActivity.applicationContext).load(
Glide.with(this@ViewMangaActivity).load(
imgUrls[currentItem]
).thumbnail(
Glide.with(this@ViewMangaActivity.applicationContext).load(R.drawable.bg_comment)
).into(onei)
).placeholder(R.drawable.bg_comment).into(onei)
updateSeekBar()
}
@@ -145,7 +143,7 @@ class ViewMangaActivity : Activity() {
idtblr.setOnClickListener {
if (idtblr.isChecked) p["r2l"] = "true"
else p["r2l"] = "false"
Toast.makeText(this.applicationContext, "下次浏览生效", Toast.LENGTH_SHORT).show()
Toast.makeText(this, "下次浏览生效", Toast.LENGTH_SHORT).show()
}
}
@@ -153,7 +151,7 @@ class ViewMangaActivity : Activity() {
idtbvp.setOnClickListener {
if (idtbvp.isChecked) p["noAnimation"] = "true"
else p["noAnimation"] = "false"
Toast.makeText(this.applicationContext, "下次浏览生效", Toast.LENGTH_SHORT).show()
Toast.makeText(this, "下次浏览生效", Toast.LENGTH_SHORT).show()
}
}
@@ -230,7 +228,7 @@ class ViewMangaActivity : Activity() {
if (idtbfullscreen.isChecked) p["useFullScreen"] =
"true"
else p["useFullScreen"] = "false"
Toast.makeText(this.applicationContext, "下次浏览生效", Toast.LENGTH_SHORT).show()
Toast.makeText(this, "下次浏览生效", Toast.LENGTH_SHORT).show()
}
}
@@ -279,12 +277,7 @@ class ViewMangaActivity : Activity() {
@SuppressLint("ClickableViewAccessibility", "SetTextI18n")
override fun onBindViewHolder(holder: ViewData, position: Int) {
val pos = if (r2l) count - position - 1 else position
Glide.with(this@ViewMangaActivity.applicationContext).load(
imgUrls[pos]
).thumbnail(
Glide.with(this@ViewMangaActivity.applicationContext)
.load(R.drawable.bg_comment)
).into(holder.itemView.onei)
Glide.with(this@ViewMangaActivity).load(imgUrls[pos]).placeholder(R.drawable.bg_comment).into(holder.itemView.onei)
}
override fun getItemCount(): Int {

View File

@@ -1,7 +1,7 @@
package top.fumiama.copymanga.tool
import top.fumiama.copymanga.R
import top.fumiama.copymanga.activity.MainActivity.Companion.wm
import top.fumiama.copymanga.activity.DlActivity
import top.fumiama.copymanga.data.ComicStructure
import top.fumiama.copymanga.view.JSWebView
import top.fumiama.copymanga.web.JSHidden
@@ -12,14 +12,16 @@ import java.util.zip.CheckedOutputStream
import java.util.zip.ZipEntry
import java.util.zip.ZipOutputStream
class MangaDlTools {
class MangaDlTools(activity: DlActivity) {
var exit = false
private val p = PropertiesTools(File("${wm?.get()?.filesDir}/chapters.hash"))
private val da = WeakReference(activity)
private val d = da.get()
private val p = PropertiesTools(File("${d?.filesDir}/chapters.hash"))
private var imgUrlsList: Array<Array<String>?>? = null
private var chaptersCount = 0
private val newWebViewHidden: JSWebView?
get() {
val re = wm?.get()?.let { JSWebView(it, it.getString(R.string.pc_ua)) }
val re = d?.let { JSWebView(it, it.getString(R.string.pc_ua)) }
re?.setWebViewClient("h.js")
re?.loadJSInterface(JSHidden())
return re