mirror of
https://github.com/fumiama/copymanga.git
synced 2026-06-05 07:20:23 +08:00
v2.0.3
新增 1. 默认不在我的下载显示未下载漫画 修复 1. 某些排序标签效果与邻签相同(作者、标签、已完结) 2. 从漫画下载进入阅览,退出后加载中对话框不消失 优化 1. 未登录时进入我的订阅、浏览历史则自动返回 2. Fragment activity 获取 3. VMHandler 消息表示 4. ViewMangaActivity Dialog 泄漏 5. 设置页加载卡顿
This commit is contained in:
@@ -8,8 +8,8 @@ android {
|
||||
applicationId 'top.fumiama.copymanga'
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 34
|
||||
versionCode 38
|
||||
versionName '2.0.2'
|
||||
versionCode 39
|
||||
versionName '2.0.3'
|
||||
resConfigs 'zh', 'zh-rCN'
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
@@ -11,7 +11,7 @@ import top.fumiama.copymanga.ui.vm.ViewMangaActivity
|
||||
import java.io.File
|
||||
|
||||
object Reader {
|
||||
fun viewMangaAt(name: String, pos: Int, fromFirstPage: Boolean = false) {
|
||||
fun viewMangaAt(name: String, pos: Int, urlArray: Array<String>, fromFirstPage: Boolean = false) {
|
||||
Log.d("MyR", "viewMangaAt name $name, pos $pos")
|
||||
mainWeakReference?.get()?.apply {
|
||||
getPreferences(Context.MODE_PRIVATE)?.edit {
|
||||
@@ -19,11 +19,12 @@ object Reader {
|
||||
apply()
|
||||
Log.d("MyR", "记录 $name 阅读到第 ${pos+1} 话")
|
||||
}?: Log.d("MyR", "无法获得 main pref")
|
||||
ViewMangaActivity.dlhandler = null
|
||||
// ViewMangaActivity.dlhandler = null
|
||||
ViewMangaActivity.position = pos
|
||||
ViewMangaActivity.comicName = name
|
||||
val zipf = ViewMangaActivity.fileArray[pos]
|
||||
val intent = Intent(this, ViewMangaActivity::class.java)
|
||||
intent.putExtra("urlArray", urlArray)
|
||||
if(!fromFirstPage) {
|
||||
intent.putExtra("function", "log")
|
||||
ViewMangaActivity.pn = -2
|
||||
|
||||
@@ -66,7 +66,7 @@ open class MangaPagesFragmentTemplate(inflateRes:Int, val isLazy: Boolean = true
|
||||
}
|
||||
Thread {
|
||||
sleep(600)
|
||||
MainActivity.mainWeakReference?.get()?.runOnUiThread {
|
||||
activity?.runOnUiThread {
|
||||
setLayouts()
|
||||
}
|
||||
}.start()
|
||||
@@ -109,7 +109,7 @@ open class MangaPagesFragmentTemplate(inflateRes:Int, val isLazy: Boolean = true
|
||||
reset()
|
||||
Thread {
|
||||
sleep(600)
|
||||
MainActivity.mainWeakReference?.get()?.runOnUiThread {
|
||||
activity?.runOnUiThread {
|
||||
addPage()
|
||||
}
|
||||
}.start()
|
||||
|
||||
@@ -17,12 +17,12 @@ import java.io.File
|
||||
import java.lang.ref.WeakReference
|
||||
|
||||
class CardList(
|
||||
fragment: WeakReference<Fragment>,
|
||||
private val fragment: WeakReference<Fragment>,
|
||||
private val cardWidth: Int,
|
||||
private val cardHeight: Int,
|
||||
private val cardPerRow: Int
|
||||
) {
|
||||
private val that = fragment.get()
|
||||
private val that get() = fragment.get()
|
||||
private var rows:Array<View?> = arrayOfNulls(20)
|
||||
private var index = 0
|
||||
private var count = 0
|
||||
@@ -42,15 +42,17 @@ class CardList(
|
||||
}
|
||||
|
||||
private fun inflateRow(){
|
||||
that?.layoutInflater?.inflate(R.layout.line_horizonal_empty, that.mydll, false)?.let {
|
||||
if(exitCardList) return
|
||||
it.layoutParams.height = cardHeight + 16
|
||||
mainWeakReference?.get()?.runOnUiThread {
|
||||
if(exitCardList) return@runOnUiThread
|
||||
that.mydll.addView(it)
|
||||
that?.apply {
|
||||
layoutInflater.inflate(R.layout.line_horizonal_empty, mydll, false)?.let {
|
||||
if(exitCardList) return
|
||||
it.layoutParams.height = cardHeight + 16
|
||||
activity?.runOnUiThread {
|
||||
if(exitCardList) return@runOnUiThread
|
||||
mydll?.addView(it)
|
||||
}
|
||||
recycleOneRow(it)
|
||||
index++
|
||||
}
|
||||
recycleOneRow(it)
|
||||
index++
|
||||
}
|
||||
}
|
||||
private fun recycleOneRow(v:View?){
|
||||
@@ -58,11 +60,11 @@ class CardList(
|
||||
if(rows[relativeIndex] == null) rows[relativeIndex] = v
|
||||
else {
|
||||
val victim = rows[relativeIndex]
|
||||
mainWeakReference?.get()?.runOnUiThread {
|
||||
if(exitCardList) return@runOnUiThread
|
||||
that?.apply {
|
||||
that?.apply {
|
||||
activity?.runOnUiThread {
|
||||
if(exitCardList) return@runOnUiThread
|
||||
mydll?.removeView(victim)
|
||||
mys?.scrollY = that.mys?.scrollY?.minus(cardHeight + 16)?:0
|
||||
mys?.scrollY = mys?.scrollY?.minus(cardHeight + 16)?:0
|
||||
}
|
||||
}
|
||||
rows[relativeIndex] = v
|
||||
@@ -70,26 +72,29 @@ class CardList(
|
||||
}
|
||||
|
||||
@ExperimentalStdlibApi
|
||||
fun addCard(name: String, append: String? = null, head: String? = null, path: String? = null, chapterUUID: String? = null, pn: Int? = null, isFinish: Boolean = false, isNew: Boolean = false){
|
||||
if(exitCardList) return
|
||||
fun addCard(name: String, append: String? = null, head: String? = null, path: String? = null, chapterUUID: String? = null, pn: Int? = null, isFinish: Boolean = false, isNew: Boolean = false) {
|
||||
if (exitCardList) return
|
||||
manageRow()
|
||||
that?.layoutInflater?.inflate(R.layout.card_book, that.mydll.ltbtn, false)?.let {
|
||||
val card = it.cic
|
||||
card.name = name
|
||||
card.append = append
|
||||
card.headImageUrl = head
|
||||
card.path = path
|
||||
card.index = index - 1
|
||||
card.chapterUUID = chapterUUID
|
||||
card.pageNumber = pn
|
||||
card.isFinish = isFinish
|
||||
card.isNew = isNew
|
||||
mainWeakReference?.get()?.runOnUiThread{
|
||||
if(exitCardList) return@runOnUiThread
|
||||
addCard(it)
|
||||
that?.apply {
|
||||
layoutInflater.inflate(R.layout.card_book, mydll.ltbtn, false)?.let {
|
||||
val card = it.cic
|
||||
card.name = name
|
||||
card.append = append
|
||||
card.headImageUrl = head
|
||||
card.path = path
|
||||
card.index = index - 1
|
||||
card.chapterUUID = chapterUUID
|
||||
card.pageNumber = pn
|
||||
card.isFinish = isFinish
|
||||
card.isNew = isNew
|
||||
activity?.runOnUiThread {
|
||||
if (exitCardList) return@runOnUiThread
|
||||
addCard(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
@ExperimentalStdlibApi
|
||||
fun addCard(cardFrame: View) {
|
||||
|
||||
@@ -26,6 +26,12 @@ open class InfoCardLoader(inflateRes:Int, private val navId:Int, private val isT
|
||||
override fun addPage(){
|
||||
super.addPage()
|
||||
ad = AutoDownloadThread(subUrl) {
|
||||
if (it == null) {
|
||||
activity?.runOnUiThread {
|
||||
findNavController().popBackStack()
|
||||
}
|
||||
return@AutoDownloadThread
|
||||
}
|
||||
if(isRefresh){
|
||||
page = 0
|
||||
isRefresh = false
|
||||
@@ -128,7 +134,7 @@ open class InfoCardLoader(inflateRes:Int, private val navId:Int, private val isT
|
||||
|
||||
override fun onLoadFinish() {
|
||||
super.onLoadFinish()
|
||||
MainActivity.mainWeakReference?.get()?.runOnUiThread {
|
||||
activity?.runOnUiThread {
|
||||
if(ad?.exit != true) mypl.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ open class StatusCardFlow(private val api: Int, nav: Int) : InfoCardLoader(R.lay
|
||||
}
|
||||
Thread{
|
||||
Thread.sleep(400)
|
||||
mainWeakReference?.get()?.runOnUiThread {
|
||||
activity?.runOnUiThread {
|
||||
reset()
|
||||
addPage()
|
||||
}
|
||||
@@ -54,14 +54,14 @@ open class StatusCardFlow(private val api: Int, nav: Int) : InfoCardLoader(R.lay
|
||||
setOnClickListener {
|
||||
sortValue = if (apim.rotation == 0f) {
|
||||
ObjectAnimator.ofFloat(apim, "rotation", 0f, 180f).setDuration(233).start()
|
||||
1
|
||||
3
|
||||
} else {
|
||||
ObjectAnimator.ofFloat(apim, "rotation", 180f, 0f).setDuration(233).start()
|
||||
0
|
||||
2
|
||||
}
|
||||
Thread {
|
||||
Thread.sleep(400)
|
||||
mainWeakReference?.get()?.runOnUiThread {
|
||||
activity?.runOnUiThread {
|
||||
reset()
|
||||
addPage()
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ class BookFragment: NoBackRefreshFragment(R.layout.fragment_book) {
|
||||
i = p
|
||||
}
|
||||
setOnClickListener {
|
||||
Reader.viewMangaAt(comic.name, i)
|
||||
Reader.viewMangaAt(comic.name, i, bookHandler!!.urlArray)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -125,7 +125,7 @@ class BookFragment: NoBackRefreshFragment(R.layout.fragment_book) {
|
||||
if (collect < 0) return@setOnClickListener
|
||||
Thread{
|
||||
val re = MainActivity.shelf?.del(collect)
|
||||
mainWeakReference?.get()?.runOnUiThread {
|
||||
activity?.runOnUiThread {
|
||||
Toast.makeText(context, re, Toast.LENGTH_SHORT).show()
|
||||
if (re == "请求成功") {
|
||||
this@BookFragment.lbbsub.setText(R.string.button_sub)
|
||||
@@ -137,7 +137,7 @@ class BookFragment: NoBackRefreshFragment(R.layout.fragment_book) {
|
||||
}
|
||||
Thread{
|
||||
val re = MainActivity.shelf?.add(comic.uuid)
|
||||
mainWeakReference?.get()?.runOnUiThread {
|
||||
activity?.runOnUiThread {
|
||||
Toast.makeText(context, re, Toast.LENGTH_SHORT).show()
|
||||
if (re == "修改成功") {
|
||||
this@BookFragment.lbbsub.setText(R.string.button_sub_subscribed)
|
||||
|
||||
@@ -64,6 +64,8 @@ class BookHandler(private val th: WeakReference<BookFragment>, val path: String)
|
||||
var collect: Int = -1
|
||||
private val divider get() = that?.layoutInflater?.inflate(R.layout.div_h, that?.fbl, false)
|
||||
|
||||
var urlArray = arrayOf<String>()
|
||||
|
||||
override fun handleMessage(msg: Message) {
|
||||
super.handleMessage(msg)
|
||||
when(msg.what){
|
||||
@@ -242,10 +244,10 @@ class BookHandler(private val th: WeakReference<BookFragment>, val path: String)
|
||||
if(exit) return@Thread
|
||||
that?.apply {
|
||||
book?.results?.apply {
|
||||
mainWeakReference?.get()?.runOnUiThread{
|
||||
that?.activity?.runOnUiThread{
|
||||
if(exit) return@runOnUiThread
|
||||
ViewMangaActivity.fileArray = arrayOf()
|
||||
ViewMangaActivity.urlArray = arrayOf()
|
||||
urlArray = arrayOf()
|
||||
ViewMangaActivity.uuidArray = arrayOf()
|
||||
var i = 0
|
||||
vols?.forEachIndexed { iv, v ->
|
||||
@@ -258,7 +260,7 @@ class BookHandler(private val th: WeakReference<BookFragment>, val path: String)
|
||||
var line: View? = null
|
||||
val last = v.results.list.size - 1
|
||||
v.results.list.forEach {
|
||||
ViewMangaActivity.urlArray += CMApi.getChapterInfoApiUrl(
|
||||
urlArray += CMApi.getChapterInfoApiUrl(
|
||||
comic.path_word,
|
||||
it.uuid
|
||||
)?:""
|
||||
@@ -271,7 +273,7 @@ class BookHandler(private val th: WeakReference<BookFragment>, val path: String)
|
||||
line?.lcc?.apply {
|
||||
lct.text = it.name
|
||||
val index = i
|
||||
setOnClickListener { Reader.viewMangaAt(comic.name, index) }
|
||||
setOnClickListener { Reader.viewMangaAt(comic.name, index, urlArray) }
|
||||
}
|
||||
fbl?.addView(line)
|
||||
} else {
|
||||
@@ -279,13 +281,13 @@ class BookHandler(private val th: WeakReference<BookFragment>, val path: String)
|
||||
line?.l2cl?.apply {
|
||||
lct.text = it.name
|
||||
val index = i
|
||||
setOnClickListener { Reader.viewMangaAt(comic.name, index) }
|
||||
setOnClickListener { Reader.viewMangaAt(comic.name, index, urlArray) }
|
||||
}
|
||||
}
|
||||
} else line?.l2cr?.apply {
|
||||
lct.text = it.name
|
||||
val index = i
|
||||
setOnClickListener { Reader.viewMangaAt(comic.name, index) }
|
||||
setOnClickListener { Reader.viewMangaAt(comic.name, index, urlArray) }
|
||||
fbl?.addView(line)
|
||||
line = null
|
||||
}
|
||||
@@ -368,7 +370,7 @@ class BookHandler(private val th: WeakReference<BookFragment>, val path: String)
|
||||
c++
|
||||
}
|
||||
if (volumes.size == gpws.size) {
|
||||
mainWeakReference?.get()?.runOnUiThread {
|
||||
that?.activity?.runOnUiThread {
|
||||
saveVolumes(volumes)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package top.fumiama.copymanga.ui.cardflow.history
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import kotlinx.android.synthetic.main.line_lazybooklines.*
|
||||
import top.fumiama.copymanga.MainActivity
|
||||
import top.fumiama.copymanga.template.ui.InfoCardLoader
|
||||
@@ -11,4 +13,9 @@ import top.fumiama.dmzj.copymanga.R
|
||||
class HistoryFragment : InfoCardLoader(R.layout.fragment_history, R.id.action_nav_history_to_nav_book, isHistoryBook = true) {
|
||||
override fun getApiUrl() =
|
||||
getString(R.string.historyApiUrl).format(CMApi.myHostApiUrl, page * 21)
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
if (MainActivity.member?.hasLogin != true) findNavController().popBackStack()
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ class RankFragment : InfoCardLoader(R.layout.fragment_rank, R.id.action_nav_rank
|
||||
sortValue = value
|
||||
Thread{
|
||||
sleep(400)
|
||||
if(ad?.exit != true) MainActivity.mainWeakReference?.get()?.runOnUiThread {
|
||||
if(ad?.exit != true) activity?.runOnUiThread {
|
||||
reset()
|
||||
addPage()
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package top.fumiama.copymanga.ui.cardflow.shelf
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.os.Bundle
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import kotlinx.android.synthetic.main.anchor_popular.view.*
|
||||
import kotlinx.android.synthetic.main.line_shelf.*
|
||||
import top.fumiama.copymanga.MainActivity
|
||||
@@ -28,6 +30,11 @@ class ShelfFragment : InfoCardLoader(R.layout.fragment_shelf, R.id.action_nav_su
|
||||
sortWay[sortValue]
|
||||
)
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
if (MainActivity.member?.hasLogin != true) findNavController().popBackStack()
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
override fun setListeners() {
|
||||
super.setListeners()
|
||||
setUpdate()
|
||||
@@ -48,7 +55,7 @@ class ShelfFragment : InfoCardLoader(R.layout.fragment_shelf, R.id.action_nav_su
|
||||
}
|
||||
Thread {
|
||||
sleep(400)
|
||||
MainActivity.mainWeakReference?.get()?.runOnUiThread {
|
||||
activity?.runOnUiThread {
|
||||
reset()
|
||||
addPage()
|
||||
}
|
||||
@@ -69,7 +76,7 @@ class ShelfFragment : InfoCardLoader(R.layout.fragment_shelf, R.id.action_nav_su
|
||||
}
|
||||
Thread {
|
||||
sleep(400)
|
||||
MainActivity.mainWeakReference?.get()?.runOnUiThread {
|
||||
activity?.runOnUiThread {
|
||||
reset()
|
||||
addPage()
|
||||
}
|
||||
@@ -90,7 +97,7 @@ class ShelfFragment : InfoCardLoader(R.layout.fragment_shelf, R.id.action_nav_su
|
||||
}
|
||||
Thread {
|
||||
sleep(400)
|
||||
MainActivity.mainWeakReference?.get()?.runOnUiThread {
|
||||
activity?.runOnUiThread {
|
||||
reset()
|
||||
addPage()
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class SortFragment : InfoCardLoader(R.layout.fragment_sort, R.id.action_nav_sort
|
||||
it?.let {
|
||||
filter = Gson().fromJson(it.inputStream().reader(), FilterStructure::class.java)
|
||||
if(ad?.exit == true) return@AutoDownloadThread
|
||||
mainWeakReference?.get()?.runOnUiThread{
|
||||
activity?.runOnUiThread{
|
||||
if(ad?.exit != true) setClasses()
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ class SortFragment : InfoCardLoader(R.layout.fragment_sort, R.id.action_nav_sort
|
||||
}
|
||||
Thread{
|
||||
sleep(400)
|
||||
mainWeakReference?.get()?.runOnUiThread {
|
||||
activity?.runOnUiThread {
|
||||
reset()
|
||||
addPage()
|
||||
}
|
||||
@@ -83,7 +83,7 @@ class SortFragment : InfoCardLoader(R.layout.fragment_sort, R.id.action_nav_sort
|
||||
it.apt.text = "全部"
|
||||
Thread{
|
||||
sleep(400)
|
||||
mainWeakReference?.get()?.runOnUiThread {
|
||||
activity?.runOnUiThread {
|
||||
reset()
|
||||
addPage()
|
||||
}
|
||||
@@ -98,7 +98,7 @@ class SortFragment : InfoCardLoader(R.layout.fragment_sort, R.id.action_nav_sort
|
||||
region = i
|
||||
Thread{
|
||||
sleep(400)
|
||||
mainWeakReference?.get()?.runOnUiThread {
|
||||
activity?.runOnUiThread {
|
||||
reset()
|
||||
addPage()
|
||||
}
|
||||
@@ -125,7 +125,7 @@ class SortFragment : InfoCardLoader(R.layout.fragment_sort, R.id.action_nav_sort
|
||||
it.apt.text = "全部"
|
||||
Thread{
|
||||
sleep(400)
|
||||
mainWeakReference?.get()?.runOnUiThread {
|
||||
activity?.runOnUiThread {
|
||||
reset()
|
||||
addPage()
|
||||
}
|
||||
@@ -140,7 +140,7 @@ class SortFragment : InfoCardLoader(R.layout.fragment_sort, R.id.action_nav_sort
|
||||
theme = i
|
||||
Thread{
|
||||
sleep(400)
|
||||
mainWeakReference?.get()?.runOnUiThread {
|
||||
activity?.runOnUiThread {
|
||||
reset()
|
||||
addPage()
|
||||
}
|
||||
@@ -167,7 +167,7 @@ class SortFragment : InfoCardLoader(R.layout.fragment_sort, R.id.action_nav_sort
|
||||
}
|
||||
Thread {
|
||||
sleep(400)
|
||||
mainWeakReference?.get()?.runOnUiThread {
|
||||
activity?.runOnUiThread {
|
||||
reset()
|
||||
addPage()
|
||||
}
|
||||
|
||||
@@ -25,9 +25,10 @@ class TopicFragment : InfoCardLoader(R.layout.fragment_topic, R.id.action_nav_to
|
||||
val r = inputStream().reader()
|
||||
val topic = Gson().fromJson(r, TopicStructure::class.java)
|
||||
topic?.apply {
|
||||
if(ad?.exit == true) return@AutoDownloadThread
|
||||
mainWeakReference?.get()?.let {
|
||||
if(ad?.exit != true) it.runOnUiThread {
|
||||
if(ad?.exit != false) return@AutoDownloadThread
|
||||
activity?.let {
|
||||
it.runOnUiThread {
|
||||
if(ad?.exit != false) return@runOnUiThread
|
||||
it.toolbar.title = results.title
|
||||
ftttime.text = results.datetime_created
|
||||
fttintro.text = results.intro
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.util.Log
|
||||
import android.view.View
|
||||
import com.google.gson.Gson
|
||||
import kotlinx.android.synthetic.main.fragment_dlcomic.*
|
||||
import top.fumiama.copymanga.MainActivity.Companion.mainWeakReference
|
||||
import top.fumiama.copymanga.json.ChapterStructure
|
||||
import top.fumiama.copymanga.json.VolumeStructure
|
||||
import top.fumiama.copymanga.template.http.AutoDownloadThread
|
||||
@@ -31,7 +30,7 @@ class ComicDlFragment: NoBackRefreshFragment(R.layout.fragment_dlcomic) {
|
||||
arguments?.getString("name")?.let {
|
||||
Thread{
|
||||
sleep(600)
|
||||
mainWeakReference?.get()?.runOnUiThread {
|
||||
activity?.runOnUiThread {
|
||||
start2load(loadFromJson(), true, loadGroupsFromFile(File(home, "$it/grps.json")))
|
||||
}
|
||||
}.start()
|
||||
@@ -51,6 +50,7 @@ class ComicDlFragment: NoBackRefreshFragment(R.layout.fragment_dlcomic) {
|
||||
//mainWeakReference?.get()?.menuMain?.let { setMenuInvisible(it) }
|
||||
handler?.downloading = false
|
||||
handler?.mangaDlTools?.exit = true
|
||||
handler?.dl?.dismiss()
|
||||
ads.forEach {
|
||||
it.exit = true
|
||||
}
|
||||
@@ -139,7 +139,7 @@ class ComicDlFragment: NoBackRefreshFragment(R.layout.fragment_dlcomic) {
|
||||
c++
|
||||
}
|
||||
if (volumes.size == gpws.size) {
|
||||
mainWeakReference?.get()?.runOnUiThread {
|
||||
activity?.runOnUiThread {
|
||||
start2load(volumes)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,13 +39,13 @@ class ComicDlHandler(looper: Looper, private val th: WeakReference<ComicDlFragme
|
||||
isOld = true
|
||||
}
|
||||
private var isOld = false
|
||||
var complete = false
|
||||
private var complete = false
|
||||
private val that get() = th.get()
|
||||
private val toolsBox = UITools(th.get()?.context)
|
||||
private var btnNumPerRow = 4
|
||||
private var btnw = 0
|
||||
private var cdwnWidth = 0
|
||||
private var dl: Dialog? = null
|
||||
var dl: Dialog? = null
|
||||
private var haveSElectAll = false
|
||||
private var checkedChapter = 0
|
||||
private val dldChapter: Int get() = finishMap.count { p -> return@count p == true }
|
||||
@@ -56,6 +56,7 @@ class ComicDlHandler(looper: Looper, private val th: WeakReference<ComicDlFragme
|
||||
private var multiSelect = false
|
||||
private var finishMap = arrayOf<Boolean?>()
|
||||
var downloading = false
|
||||
private var urlArray = arrayOf<String>()
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun handleMessage(msg: Message) {
|
||||
@@ -104,7 +105,7 @@ class ComicDlHandler(looper: Looper, private val th: WeakReference<ComicDlFragme
|
||||
setComponents()
|
||||
if(isOld) analyzeOldStructure()
|
||||
else Thread{
|
||||
ViewMangaActivity.urlArray = arrayOf()
|
||||
urlArray = arrayOf()
|
||||
ViewMangaActivity.fileArray = arrayOf()
|
||||
ViewMangaActivity.uuidArray = arrayOf()
|
||||
vols.forEachIndexed { i, vol ->
|
||||
@@ -225,7 +226,7 @@ class ComicDlHandler(looper: Looper, private val th: WeakReference<ComicDlFragme
|
||||
}
|
||||
mangaDlTools.onDownloadedListener = object :MangaDlTools.OnDownloadedListener{
|
||||
override fun handleMessage(index: Int, isSuccess: Boolean) {
|
||||
mainWeakReference?.get()?.runOnUiThread {
|
||||
that?.activity?.runOnUiThread {
|
||||
if(isSuccess) onZipDownloadFinish(index)
|
||||
else onZipDownloadFailure(index)
|
||||
}
|
||||
@@ -237,7 +238,7 @@ class ComicDlHandler(looper: Looper, private val th: WeakReference<ComicDlFragme
|
||||
total: Int,
|
||||
isSuccess: Boolean
|
||||
) {
|
||||
mainWeakReference?.get()?.runOnUiThread {
|
||||
that?.activity?.runOnUiThread {
|
||||
if(isSuccess) {
|
||||
tbtnlist[index].text = if(downloaded == 0 && total == 0) tbtnlist[index].chapterName else "$downloaded/$total"
|
||||
} else {
|
||||
@@ -312,7 +313,7 @@ class ComicDlHandler(looper: Looper, private val th: WeakReference<ComicDlFragme
|
||||
}
|
||||
private fun addTbtn(data: Array<String>){
|
||||
addTbtn(data[0], data[1], data[2], data[3])
|
||||
ViewMangaActivity.urlArray += data[3]
|
||||
urlArray += data[3]
|
||||
}
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun addTbtn(title: String, uuid: String, caption: String, url: String) {
|
||||
@@ -381,7 +382,9 @@ class ComicDlHandler(looper: Looper, private val th: WeakReference<ComicDlFragme
|
||||
ViewMangaActivity.position = it.tbtn.index
|
||||
dl?.show()
|
||||
|
||||
that?.startActivity(Intent(that?.context, ViewMangaActivity::class.java))
|
||||
val intent = Intent(that?.context, ViewMangaActivity::class.java)
|
||||
intent.putExtra("urlArray", urlArray)
|
||||
that?.startActivity(intent)
|
||||
}, null, null
|
||||
)
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ import kotlinx.android.synthetic.main.app_bar_main.*
|
||||
import kotlinx.android.synthetic.main.fragment_download.*
|
||||
import top.fumiama.copymanga.MainActivity.Companion.mainWeakReference
|
||||
import top.fumiama.copymanga.template.general.NoBackRefreshFragment
|
||||
import top.fumiama.copymanga.tools.ui.Navigate
|
||||
import top.fumiama.copymanga.tools.file.FileUtils
|
||||
import top.fumiama.copymanga.tools.ui.Navigate
|
||||
import top.fumiama.copymanga.ui.comicdl.ComicDlFragment
|
||||
import top.fumiama.copymanga.ui.vm.ViewMangaActivity
|
||||
import top.fumiama.dmzj.copymanga.R
|
||||
@@ -60,7 +60,7 @@ class DownloadFragment: NoBackRefreshFragment(R.layout.fragment_download) {
|
||||
ViewMangaActivity.comicName = it[position]
|
||||
ViewMangaActivity.position = position
|
||||
ViewMangaActivity.fileArray = it.map { File(cd, it) }.toTypedArray()
|
||||
ViewMangaActivity.urlArray = Array(it.size) {return@Array ""}
|
||||
// ViewMangaActivity.urlArray = Array(it.size) {return@Array ""}
|
||||
startActivity(Intent(context, ViewMangaActivity::class.java))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.util.Log
|
||||
import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.preference.PreferenceManager
|
||||
import kotlinx.android.synthetic.main.line_lazybooklines.*
|
||||
import top.fumiama.copymanga.MainActivity
|
||||
import top.fumiama.copymanga.manga.Reader
|
||||
@@ -28,9 +29,12 @@ class NewDownloadFragment: MangaPagesFragmentTemplate(R.layout.fragment_newdownl
|
||||
private var isReverse = false
|
||||
private var isContentChanged = false
|
||||
private var exit = false
|
||||
private var showAll = false
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
wn = WeakReference(this)
|
||||
val settingsPref = MainActivity.mainWeakReference?.get()?.let { PreferenceManager.getDefaultSharedPreferences(it) }
|
||||
showAll = settingsPref?.getBoolean("settings_cat_md_sw_show_0m_manga", false)?:false
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
@@ -65,6 +69,11 @@ class NewDownloadFragment: MangaPagesFragmentTemplate(R.layout.fragment_newdownl
|
||||
Log.d("MyNDF", "reversed...")
|
||||
sortedBookList = sortedBookList?.asReversed()
|
||||
}
|
||||
if (!showAll) {
|
||||
sortedBookList = sortedBookList?.filter {
|
||||
return@filter FileUtils.sizeOf(it) / 1048576 > 0
|
||||
}
|
||||
}
|
||||
isContentChanged = false
|
||||
}
|
||||
Log.d("MyNDF", "Start drawing cards")
|
||||
@@ -124,7 +133,7 @@ class NewDownloadFragment: MangaPagesFragmentTemplate(R.layout.fragment_newdownl
|
||||
.setTitle("提示").setPositiveButton(android.R.string.ok) { _, _ ->
|
||||
if (chosenFile.exists()) Thread {
|
||||
FileUtils.recursiveRemove(chosenFile)
|
||||
MainActivity.mainWeakReference?.get()?.runOnUiThread {
|
||||
activity?.runOnUiThread {
|
||||
it.visibility = View.INVISIBLE
|
||||
}
|
||||
}.start()
|
||||
@@ -175,7 +184,7 @@ class NewDownloadFragment: MangaPagesFragmentTemplate(R.layout.fragment_newdownl
|
||||
|
||||
override fun onLoadFinish() {
|
||||
super.onLoadFinish()
|
||||
MainActivity.mainWeakReference?.get()?.runOnUiThread {
|
||||
activity?.runOnUiThread {
|
||||
mypl.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ class HomeFragment : NoBackRefreshFragment(R.layout.fragment_home) {
|
||||
|
||||
fun refresh(q: CharSequence) {
|
||||
query = q
|
||||
mainWeakReference?.get()?.apply {
|
||||
activity?.apply {
|
||||
AutoDownloadThread(getString(R.string.searchApiUrl).format(CMApi.myHostApiUrl, 0, query, type)) {
|
||||
results = Gson().fromJson(it?.decodeToString(), BookListStructure::class.java)
|
||||
count = results?.results?.total?:0
|
||||
|
||||
@@ -17,7 +17,12 @@ import java.lang.Thread.sleep
|
||||
|
||||
class SettingsFragment: PreferenceFragmentCompat() {
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
setPreferencesFromResource(R.xml.pref_setting, rootKey)
|
||||
Thread {
|
||||
sleep(300)
|
||||
activity?.runOnUiThread {
|
||||
setPreferencesFromResource(R.xml.pref_setting, rootKey)
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
||||
@@ -4,11 +4,10 @@ import android.widget.Toast
|
||||
import top.fumiama.copymanga.manga.Reader
|
||||
import top.fumiama.copymanga.ui.vm.ViewMangaActivity.Companion.comicName
|
||||
import top.fumiama.copymanga.ui.vm.ViewMangaActivity.Companion.position
|
||||
import top.fumiama.copymanga.ui.vm.ViewMangaActivity.Companion.urlArray
|
||||
import java.lang.ref.WeakReference
|
||||
|
||||
class PagesManager(w: WeakReference<ViewMangaActivity>) {
|
||||
val v = w.get()
|
||||
class PagesManager(private val w: WeakReference<ViewMangaActivity>) {
|
||||
val v get() = w.get()
|
||||
private var isEndL = false
|
||||
private var isEndR = false
|
||||
@ExperimentalStdlibApi
|
||||
@@ -22,8 +21,12 @@ class PagesManager(w: WeakReference<ViewMangaActivity>) {
|
||||
private fun judgePrevious() = (v?.pageNum ?: 0) > 1
|
||||
private fun judgeNext() = (v?.pageNum ?: 0) < (v?.realCount ?: 0)
|
||||
@ExperimentalStdlibApi
|
||||
fun toPage(goNext:Boolean){
|
||||
if (v?.clicked == false) {
|
||||
fun toPage(goNext:Boolean) {
|
||||
v?.let { v ->
|
||||
if (v.clicked) {
|
||||
v.hideObjs()
|
||||
return
|
||||
}
|
||||
if (if(goNext)judgeNext() else judgePrevious()) {
|
||||
if(goNext) {
|
||||
v.scrollForward()
|
||||
@@ -32,36 +35,36 @@ class PagesManager(w: WeakReference<ViewMangaActivity>) {
|
||||
v.scrollBack()
|
||||
isEndL = false
|
||||
}
|
||||
} else {
|
||||
val chapterPosition = position + if(goNext) 1 else -1
|
||||
urlArray.let {
|
||||
if(chapterPosition >= 0 && chapterPosition < it.size) it[chapterPosition].let {
|
||||
if (if(goNext) isEndR else isEndL) {
|
||||
//if(v.zipFirst) intent.putExtra("callFrom", "zipFirst")
|
||||
v.tt.canDo = false
|
||||
//ViewMangaActivity.dlhandler = null
|
||||
comicName?.let { it1 -> Reader.viewMangaAt(it1, chapterPosition, goNext) }
|
||||
v.finish()
|
||||
} else {
|
||||
val hint = if(goNext) '下' else '上'
|
||||
Toast.makeText(
|
||||
v.applicationContext,
|
||||
"再次按下加载${hint}一章",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
if(goNext) isEndR = true
|
||||
else isEndL = true
|
||||
}
|
||||
} else Toast.makeText(
|
||||
return
|
||||
}
|
||||
val chapterPosition = position + if(goNext) 1 else -1
|
||||
if (v.urlArray.isNotEmpty()) {
|
||||
if(chapterPosition >= 0 && chapterPosition < v.urlArray.size) v.urlArray[chapterPosition].let {
|
||||
if (if(goNext) isEndR else isEndL) {
|
||||
//if(v.zipFirst) intent.putExtra("callFrom", "zipFirst")
|
||||
v.tt.canDo = false
|
||||
//ViewMangaActivity.dlhandler = null
|
||||
comicName?.let { it1 -> Reader.viewMangaAt(it1, chapterPosition, v.urlArray, goNext) }
|
||||
v.finish()
|
||||
return
|
||||
}
|
||||
val hint = if(goNext) '下' else '上'
|
||||
Toast.makeText(
|
||||
v.applicationContext,
|
||||
"已经到头了~",
|
||||
"再次按下加载${hint}一章",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
if(goNext) isEndR = true
|
||||
else isEndL = true
|
||||
} else Toast.makeText(
|
||||
v.applicationContext,
|
||||
"已经到头了~",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
} else v?.hideObjs()
|
||||
}
|
||||
}
|
||||
fun manageInfo(){
|
||||
if (v?.clicked == false) v.showObjs() else v?.hideObjs()
|
||||
if (v?.clicked == false) v?.showObjs() else v?.hideObjs()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class VMHandler(activity: ViewMangaActivity, url: String) : AutoDownloadHandler(
|
||||
private val wv = WeakReference(activity)
|
||||
private val infcard = wv.get()?.infcard
|
||||
private var infcShowed = false
|
||||
private val dl = wv.get()?.let {
|
||||
val dl = activity.let {
|
||||
val re = Dialog(it)
|
||||
re.setContentView(R.layout.dialog_unzipping)
|
||||
re
|
||||
@@ -64,56 +64,56 @@ class VMHandler(activity: ViewMangaActivity, url: String) : AutoDownloadHandler(
|
||||
override fun handleMessage(msg: Message) {
|
||||
super.handleMessage(msg)
|
||||
when (msg.what) {
|
||||
1 -> if (infcShowed) {
|
||||
HIDE_INFO_CARD -> if (infcShowed) {
|
||||
hideInfCard(); infcShowed = false
|
||||
}
|
||||
2 -> if (!infcShowed) {
|
||||
SHOW_INFO_CARD -> if (!infcShowed) {
|
||||
showInfCard(); infcShowed = true
|
||||
}
|
||||
3 -> infcShowed = if (infcShowed) {
|
||||
TRIGGER_INFO_CARD -> infcShowed = if (infcShowed) {
|
||||
hideInfCard(); false
|
||||
} else {
|
||||
showInfCard(); true
|
||||
}
|
||||
4 -> {
|
||||
LOAD_IMG_ON -> {
|
||||
val simg = msg.obj as ScaleImageView
|
||||
wv.get()?.loadImgOn(simg, msg.arg1, msg.arg2)
|
||||
//simg.setHeight2FitImgWidth()
|
||||
//if(msg.arg2 == 1) sendEmptyMessage(8)
|
||||
//if(msg.arg2 == 1) sendEmptyMessage(DELAYED_RESTORE_PAGE_NUMBER)
|
||||
}
|
||||
5 -> wv.get()?.clearImgOn(msg.obj as ScaleImageView)
|
||||
6 -> wv.get()?.prepareLastPage(msg.arg1, msg.arg2)
|
||||
7 -> dl?.show()
|
||||
8 -> Thread{
|
||||
CLEAR_IMG_ON -> wv.get()?.clearImgOn(msg.obj as ScaleImageView)
|
||||
PREPARE_LAST_PAGE -> wv.get()?.prepareLastPage(msg.arg1, msg.arg2)
|
||||
DIALOG_SHOW -> dl.show()
|
||||
DELAYED_RESTORE_PAGE_NUMBER -> Thread{
|
||||
sleep(233)
|
||||
sendEmptyMessage(13)
|
||||
sendEmptyMessage(RESTORE_PAGE_NUMBER)
|
||||
}.start()
|
||||
9 -> loadScrollMode(msg.arg1)
|
||||
10 -> loadScrollMode()
|
||||
11 -> loadImagesIntoLine(msg.arg1)
|
||||
12 -> loadImagesIntoLine()
|
||||
13 -> {
|
||||
dl?.hide()
|
||||
LOAD_ITEM_SCROLL_MODE -> loadScrollMode(msg.arg1)
|
||||
LOAD_SCROLL_MODE -> loadScrollMode()
|
||||
LOAD_ITEM_IMAGES_INTO_LINE -> loadImagesIntoLine(msg.arg1)
|
||||
LOAD_IMAGES_INTO_LINE -> loadImagesIntoLine()
|
||||
RESTORE_PAGE_NUMBER -> {
|
||||
sendEmptyMessage(DIALOG_HIDE)
|
||||
wv.get()?.restorePN()
|
||||
}
|
||||
14 -> {
|
||||
LOAD_PAGE_FROM_ITEM -> {
|
||||
val item = (pn - 1) / (wv.get()?.verticalLoadMaxCount?:20) * (wv.get()?.verticalLoadMaxCount?:20)
|
||||
loadScrollMode(item)
|
||||
Log.d("MyVMH", "Load page from $item")
|
||||
}
|
||||
15 -> dl?.hide()
|
||||
16 -> if (infcShowed) {
|
||||
DIALOG_HIDE -> dl.hide()
|
||||
HIDE_INFO_CARD_FULL -> if (infcShowed) {
|
||||
hideInfCardFull(); infcShowed = false
|
||||
}
|
||||
17 -> if (!infcShowed) {
|
||||
SHOW_INFO_CARD_FULL -> if (!infcShowed) {
|
||||
showInfCardFull(); infcShowed = true
|
||||
}
|
||||
18 -> infcShowed = if (infcShowed) {
|
||||
TRIGGER_INFO_CARD_FULL -> infcShowed = if (infcShowed) {
|
||||
hideInfCardFull(); false
|
||||
} else {
|
||||
showInfCardFull(); true
|
||||
}
|
||||
22 -> wv.get()?.idtime?.text = SimpleDateFormat("HH:mm").format(Date()) + week + wv.get()?.toolsBox?.netInfo
|
||||
SET_NET_INFO -> wv.get()?.idtime?.text = SimpleDateFormat("HH:mm").format(Date()) + week + wv.get()?.toolsBox?.netInfo
|
||||
}
|
||||
}
|
||||
override fun getGsonItem() = manga
|
||||
@@ -161,7 +161,7 @@ class VMHandler(activity: ViewMangaActivity, url: String) : AutoDownloadHandler(
|
||||
}
|
||||
}
|
||||
true
|
||||
}catch (e: Exception){
|
||||
} catch (e: Exception){
|
||||
e.printStackTrace()
|
||||
//wv.get()?.toolsBox?.toastError("读取本地章节信息失败")
|
||||
false
|
||||
@@ -183,25 +183,25 @@ class VMHandler(activity: ViewMangaActivity, url: String) : AutoDownloadHandler(
|
||||
val notFull = item + maxCount > count
|
||||
val loadCount = (if(notFull) count - item else maxCount) - 1
|
||||
Log.d("MyVMH", "count: $count, loadCount: $loadCount, notFull: $notFull")
|
||||
if(loadCount >= 0) for(i in 0..loadCount) obtainMessage(4,item + i, if(i == loadCount - 1) 1 else 0, wv.get()?.scrollImages?.get(i)).sendToTarget()
|
||||
else sendEmptyMessage(8)
|
||||
if(notFull) obtainMessage(6, loadCount + 1, maxCount).sendToTarget()
|
||||
if(loadCount >= 0) for(i in 0..loadCount) obtainMessage(LOAD_IMG_ON,item + i, if(i == loadCount - 1) 1 else 0, wv.get()?.scrollImages?.get(i)).sendToTarget()
|
||||
else sendEmptyMessage(DELAYED_RESTORE_PAGE_NUMBER)
|
||||
if(notFull) obtainMessage(PREPARE_LAST_PAGE, loadCount + 1, maxCount).sendToTarget()
|
||||
wv.get()?.updateSeekBar()
|
||||
}
|
||||
}
|
||||
}//.start()
|
||||
|
||||
private fun loadScrollMode() {
|
||||
sendEmptyMessage(7)
|
||||
sendEmptyMessage(DIALOG_SHOW)
|
||||
//sleep(233)
|
||||
sendEmptyMessage(12)
|
||||
sendEmptyMessage(LOAD_IMAGES_INTO_LINE)
|
||||
}
|
||||
|
||||
private fun loadScrollMode(item: Int) {
|
||||
sendEmptyMessage(7)
|
||||
sendEmptyMessage(DIALOG_SHOW)
|
||||
//sleep(233)
|
||||
Log.d("MyVMH", "loadImgsIntoLine($item)")
|
||||
obtainMessage(11, item, 0).sendToTarget()
|
||||
obtainMessage(LOAD_ITEM_IMAGES_INTO_LINE, item, 0).sendToTarget()
|
||||
}
|
||||
|
||||
private fun showInfCard() {
|
||||
@@ -224,4 +224,27 @@ class VMHandler(activity: ViewMangaActivity, url: String) : AutoDownloadHandler(
|
||||
ObjectAnimator.ofFloat(infcard?.idc, "alpha", 0.8F, 0.0F).setDuration(233).start()
|
||||
ObjectAnimator.ofFloat(infcard, "translationY", 0F, delta).setDuration(233).start()
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val HIDE_INFO_CARD = 1
|
||||
const val SHOW_INFO_CARD = 2
|
||||
const val TRIGGER_INFO_CARD = 3
|
||||
const val LOAD_IMG_ON = 4
|
||||
const val CLEAR_IMG_ON = 5
|
||||
const val PREPARE_LAST_PAGE = 6
|
||||
const val DIALOG_SHOW = 7
|
||||
const val DELAYED_RESTORE_PAGE_NUMBER = 8
|
||||
const val LOAD_ITEM_SCROLL_MODE = 9
|
||||
const val LOAD_SCROLL_MODE = 10
|
||||
const val LOAD_ITEM_IMAGES_INTO_LINE = 11
|
||||
const val LOAD_IMAGES_INTO_LINE = 12
|
||||
const val RESTORE_PAGE_NUMBER = 13
|
||||
const val LOAD_PAGE_FROM_ITEM = 14
|
||||
const val DIALOG_HIDE = 15
|
||||
const val HIDE_INFO_CARD_FULL = 16
|
||||
const val SHOW_INFO_CARD_FULL = 17
|
||||
const val TRIGGER_INFO_CARD_FULL = 18
|
||||
|
||||
const val SET_NET_INFO = 22
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import androidx.core.content.edit
|
||||
import androidx.preference.PreferenceManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.viewpager2.widget.ViewPager2
|
||||
import com.afollestad.materialdialogs.utils.MDUtil.getStringArray
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.load.model.GlideUrl
|
||||
import com.bumptech.glide.request.target.SimpleTarget
|
||||
@@ -95,6 +96,8 @@ class ViewMangaActivity : TitleActivityTemplate() {
|
||||
private var fullyHideInfo = false
|
||||
val realCount get() = if(cut) indexMap.size else count
|
||||
|
||||
var urlArray = arrayOf<String>()
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
setContentView(R.layout.activity_viewmanga)
|
||||
@@ -103,6 +106,7 @@ class ViewMangaActivity : TitleActivityTemplate() {
|
||||
va = WeakReference(this)
|
||||
//dlZip2View = intent.getStringExtra("callFrom") == "Dl" || p["dlZip2View"] == "true"
|
||||
//zipFirst = intent.getStringExtra("callFrom") == "zipFirst"
|
||||
intent.getStringArrayExtra("urlArray")?.let { urlArray = it }
|
||||
cut = pb["useCut"]
|
||||
r2l = pb["r2l"]
|
||||
verticalLoadMaxCount = settingsPref?.getInt("settings_cat_vm_sb_vertical_max", 20)?.let { if(it > 0) it else 20 }?:20
|
||||
@@ -111,7 +115,7 @@ class ViewMangaActivity : TitleActivityTemplate() {
|
||||
//url = intent.getStringExtra("url")
|
||||
handler = VMHandler(this, if(urlArray.isNotEmpty()) urlArray[position] else "")
|
||||
settingsPref?.getInt("settings_cat_vm_sb_quality", 100)?.let { q = if (it > 0) it else 100 }
|
||||
tt = TimeThread(handler, 22)
|
||||
tt = TimeThread(handler, VMHandler.SET_NET_INFO)
|
||||
tt.canDo = true
|
||||
tt.start()
|
||||
volTurnPage = settingsPref?.getBoolean("settings_cat_vm_sw_vol_turn", false)?:false
|
||||
@@ -213,7 +217,7 @@ class ViewMangaActivity : TitleActivityTemplate() {
|
||||
getImgUrlArray()?.apply {
|
||||
if(cut) {
|
||||
Log.d("MyVM", "is cut, load all pages...")
|
||||
handler.sendEmptyMessage(7) //showDl
|
||||
handler.sendEmptyMessage(VMHandler.DIALOG_SHOW) //showDl
|
||||
isCut = BooleanArray(size)
|
||||
val analyzedCnt = BooleanArray(size)
|
||||
forEachIndexed{ i, it ->
|
||||
@@ -364,7 +368,7 @@ class ViewMangaActivity : TitleActivityTemplate() {
|
||||
imgView.setImageBitmap(bitmap2load)
|
||||
if(isVertical){
|
||||
imgView.setHeight2FitImgWidth()
|
||||
if (!isPlaceholder && isLast == 1) handler.sendEmptyMessage(8)
|
||||
if (!isPlaceholder && isLast == 1) handler.sendEmptyMessage(VMHandler.DELAYED_RESTORE_PAGE_NUMBER)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -430,7 +434,7 @@ class ViewMangaActivity : TitleActivityTemplate() {
|
||||
}
|
||||
|
||||
fun prepareLastPage(loadCount: Int, maxCount: Int){
|
||||
for (i in loadCount until maxCount) handler.obtainMessage(5, scrollImages[i]).sendToTarget()
|
||||
for (i in loadCount until maxCount) handler.obtainMessage(VMHandler.CLEAR_IMG_ON, scrollImages[i]).sendToTarget()
|
||||
// handler.dl?.hide()
|
||||
}
|
||||
|
||||
@@ -465,7 +469,7 @@ class ViewMangaActivity : TitleActivityTemplate() {
|
||||
infoDrawerDelta = position.toFloat()
|
||||
infcard.translationY = infoDrawerDelta
|
||||
Log.d("MyVM", "Set info drawer delta to $infoDrawerDelta")
|
||||
handler.sendEmptyMessage(if (fullyHideInfo) 16 else 1)
|
||||
handler.sendEmptyMessage(if (fullyHideInfo) 16 else VMHandler.HIDE_INFO_CARD)
|
||||
}
|
||||
|
||||
@ExperimentalStdlibApi
|
||||
@@ -575,7 +579,7 @@ class ViewMangaActivity : TitleActivityTemplate() {
|
||||
})
|
||||
isearch.setImageResource(R.drawable.ic_author)
|
||||
isearch.setOnClickListener {
|
||||
handler.sendEmptyMessage(if (fullyHideInfo) 18 else 3) // trigger info card
|
||||
handler.sendEmptyMessage(if (fullyHideInfo) VMHandler.TRIGGER_INFO_CARD_FULL else VMHandler.TRIGGER_INFO_CARD) // trigger info card
|
||||
}
|
||||
}
|
||||
|
||||
@@ -602,7 +606,7 @@ class ViewMangaActivity : TitleActivityTemplate() {
|
||||
vp.visibility = View.GONE
|
||||
vsp.visibility = View.VISIBLE
|
||||
initImgList()
|
||||
handler.sendEmptyMessage(if(isPnValid)14 else 10)
|
||||
handler.sendEmptyMessage(if(isPnValid) VMHandler.LOAD_PAGE_FROM_ITEM else VMHandler.LOAD_SCROLL_MODE)
|
||||
psivs.setOnScrollChangeListener { _, _, scrollY, _, _ ->
|
||||
isInScroll = true
|
||||
if(!isInSeek){
|
||||
@@ -624,7 +628,7 @@ class ViewMangaActivity : TitleActivityTemplate() {
|
||||
isInScroll = false
|
||||
if(isVertical && (pageNum-1) % verticalLoadMaxCount == 0){
|
||||
Log.d("MyVM", "Do scroll back, isVertical: $isVertical, pageNum: $pageNum")
|
||||
handler.obtainMessage(9, currentItem - verticalLoadMaxCount, 0).sendToTarget() //loadImgsIntoLine(currentItem - verticalLoadMaxCount)
|
||||
handler.obtainMessage(VMHandler.LOAD_ITEM_SCROLL_MODE, currentItem - verticalLoadMaxCount, 0).sendToTarget() //loadImgsIntoLine(currentItem - verticalLoadMaxCount)
|
||||
psivl.postDelayed({ pageNum-- }, 233)
|
||||
}else pageNum--
|
||||
}
|
||||
@@ -632,7 +636,7 @@ class ViewMangaActivity : TitleActivityTemplate() {
|
||||
fun scrollForward() {
|
||||
isInScroll = false
|
||||
pageNum++
|
||||
if(isVertical && (pageNum-1) % verticalLoadMaxCount == 0) handler.sendEmptyMessage(10)
|
||||
if(isVertical && (pageNum-1) % verticalLoadMaxCount == 0) handler.sendEmptyMessage(VMHandler.LOAD_SCROLL_MODE)
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
@@ -649,6 +653,7 @@ class ViewMangaActivity : TitleActivityTemplate() {
|
||||
tt.canDo = false
|
||||
destroy = true
|
||||
dlhandler = null
|
||||
handler.dl.dismiss()
|
||||
handler.destroy()
|
||||
super.onDestroy()
|
||||
}
|
||||
@@ -721,13 +726,12 @@ class ViewMangaActivity : TitleActivityTemplate() {
|
||||
infseek.visibility = View.GONE
|
||||
isearch.visibility = View.GONE
|
||||
}, 300)
|
||||
handler.sendEmptyMessage(if (fullyHideInfo) 16 else 1)
|
||||
handler.sendEmptyMessage(if (fullyHideInfo) VMHandler.HIDE_INFO_CARD_FULL else VMHandler.HIDE_INFO_CARD)
|
||||
}
|
||||
|
||||
companion object {
|
||||
var comicName: String? = null
|
||||
var uuidArray = arrayOf<String>()
|
||||
var urlArray = arrayOf<String>()
|
||||
var fileArray = arrayOf<File>()
|
||||
var position = 0
|
||||
var zipFile: File? = null
|
||||
|
||||
@@ -30,7 +30,7 @@ object Update {
|
||||
val msg = kanban[BuildConfig.VERSION_CODE]
|
||||
if(msg != "null") {
|
||||
val verNum = msg.substringBefore('\n').toIntOrNull()
|
||||
val skipNum = activity.getPreferences(MODE_PRIVATE).getInt("skipVersion", 0)
|
||||
val skipNum = getPreferences(MODE_PRIVATE).getInt("skipVersion", 0)
|
||||
|
||||
Log.d("MyUP", "Ver:$verNum, skip: $skipNum")
|
||||
if(verNum != null) {
|
||||
@@ -57,7 +57,7 @@ object Update {
|
||||
}
|
||||
val f = File(externalCacheDir, "new.apk")
|
||||
f.writeBytes(it)
|
||||
install(f, activity)
|
||||
install(f, this)
|
||||
} else runOnUiThread {
|
||||
Toast.makeText(this, "文件损坏", Toast.LENGTH_SHORT).show()
|
||||
info.dismiss()
|
||||
@@ -66,7 +66,7 @@ object Update {
|
||||
}
|
||||
}.start()
|
||||
}, {
|
||||
activity.getPreferences(MODE_PRIVATE).edit {
|
||||
getPreferences(MODE_PRIVATE).edit {
|
||||
putInt("skipVersion", verNum)
|
||||
apply()
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import top.fumiama.copymanga.tools.http.DownloadTools
|
||||
import top.fumiama.dmzj.copymanga.R
|
||||
|
||||
class Member(private val pref: SharedPreferences, private val getString: (Int) -> String) {
|
||||
val hasLogin: Boolean get() = pref.getString("token", "")?.isNotEmpty()?:false
|
||||
fun login(username: String, pwd: String, salt: Int): LoginInfoStructure {
|
||||
try {
|
||||
CMApi.getLoginConnection(username, pwd, salt)?.apply {
|
||||
|
||||
@@ -139,6 +139,11 @@
|
||||
<string name="settings_cat_vm_sb_quality">图片质量</string>
|
||||
<string name="settings_cat_vm_sm_quality">默认为100</string>
|
||||
|
||||
<string name="settings_cat_md">漫画下载</string>
|
||||
<string name="settings_cat_md_sw_show_0m_manga">显示未下载漫画</string>
|
||||
<string name="settings_cat_md_sm_show_0m_manga">打开后将在我的下载显示所有浏览过详情页的漫画,旧版下载永远全部显示</string>
|
||||
|
||||
|
||||
|
||||
<string name="login_null_username">用户名为空</string>
|
||||
<string name="login_null_pwd">密码为空</string>
|
||||
|
||||
@@ -82,4 +82,15 @@
|
||||
app:summary="@string/settings_cat_vm_sm_quality"
|
||||
app:title="@string/settings_cat_vm_sb_quality" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
app:iconSpaceReserved="false"
|
||||
app:title="@string/settings_cat_md">
|
||||
<SwitchPreferenceCompat
|
||||
app:iconSpaceReserved="false"
|
||||
app:key="settings_cat_md_sw_show_0m_manga"
|
||||
app:selectable="true"
|
||||
app:summary="@string/settings_cat_md_sm_show_0m_manga"
|
||||
app:title="@string/settings_cat_md_sw_show_0m_manga" />
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
|
||||
Reference in New Issue
Block a user