1
0
mirror of https://github.com/fumiama/copymanga.git synced 2026-06-27 14:20:30 +08:00
1. 更改 加载图片占位
2. 修复 重复写入info
3. 更改 长按删除提示语
4. 增加 翻到上一章时置于末页
5. 优化 浏览漫画性能
This commit is contained in:
fumiama
2021-01-09 14:39:37 +08:00
parent 36ea5cc149
commit 5bbe768882
13 changed files with 344 additions and 562 deletions

9
.idea/dictionaries/rumia.xml generated Normal file
View File

@@ -0,0 +1,9 @@
<component name="ProjectDictionaryState">
<dictionary name="rumia">
<words>
<w>cdwn</w>
<w>manga</w>
<w>rmrf</w>
</words>
</dictionary>
</component>

View File

@@ -11,8 +11,8 @@ android {
applicationId "top.fumiama.copymanga" applicationId "top.fumiama.copymanga"
minSdkVersion 23 minSdkVersion 23
targetSdkVersion 30 targetSdkVersion 30
versionCode 9 versionCode 10
versionName '1.3.1' versionName '1.3.2'
resConfigs "zh", "zh-rCN" resConfigs "zh", "zh-rCN"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View File

@@ -25,6 +25,7 @@ import top.fumiama.copymanga.handler.DlHandler
import top.fumiama.copymanga.tool.MangaDlTools import top.fumiama.copymanga.tool.MangaDlTools
import top.fumiama.copymanga.tool.MangaDlTools.Companion.wmdlt import top.fumiama.copymanga.tool.MangaDlTools.Companion.wmdlt
import top.fumiama.copymanga.tool.ToolsBox import top.fumiama.copymanga.tool.ToolsBox
import top.fumiama.copymanga.view.ChapterToggleButton
import top.fumiama.copymanga.view.LazyScrollView import top.fumiama.copymanga.view.LazyScrollView
import java.io.File import java.io.File
import java.lang.Thread.sleep import java.lang.Thread.sleep
@@ -41,17 +42,14 @@ class DlActivity : Activity() {
var haveDlStarted = false var haveDlStarted = false
private var btnNumPerRow = 4 private var btnNumPerRow = 4
private lateinit var ltbtn: View private lateinit var ltbtn: View
var tbtnlist: List<ToggleButton> = arrayListOf() var tbtnlist: Array<ChapterToggleButton> = arrayOf()
var tbtnUrlList = arrayListOf<String>()
private val handler = DlHandler(this, Looper.myLooper()!!) private val handler = DlHandler(this, Looper.myLooper()!!)
private var btnw = 0 private var btnw = 0
private var cdwnWidth = 0 private var cdwnWidth = 0
private var canDl = false private var canDl = false
private lateinit var toolsBox: ToolsBox private lateinit var toolsBox: ToolsBox
lateinit var mangaDlTools: MangaDlTools private lateinit var mangaDlTools: MangaDlTools
var multiSelect = false var multiSelect = false
private var zipArrayList: Array<String> = arrayOf()
@ExperimentalStdlibApi @ExperimentalStdlibApi
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
@@ -85,14 +83,14 @@ class DlActivity : Activity() {
private fun fillChapters() { private fun fillChapters() {
mangaDlTools.allocateChapterUrls(checkedChapter) mangaDlTools.allocateChapterUrls(checkedChapter)
for (i in tbtnlist.indices) { for (i in tbtnlist) {
if (tbtnlist[i].isChecked) mangaDlTools.dlChapterUrl(tbtnUrlList[i]) if (i.isChecked) mangaDlTools.dlChapterUrl(i.url.toString())
} }
} }
private fun dlThead(dlMethod: (i: ToggleButton) -> Unit) { private fun dlThread(dlMethod: (i: ChapterToggleButton) -> Unit) {
sleep(10000) sleep(10000)
for (i in tbtnlist.listIterator()) { for (i in tbtnlist) {
if (i.isChecked) dlMethod(i) if (i.isChecked) dlMethod(i)
if (!canDl) { if (!canDl) {
checkedChapter -= dldChapter checkedChapter -= dldChapter
@@ -139,7 +137,7 @@ class DlActivity : Activity() {
handler.sendEmptyMessage(9) //set dl card color to red handler.sendEmptyMessage(9) //set dl card color to red
Toast.makeText(this, "十秒后开始下载...", Toast.LENGTH_SHORT).show() Toast.makeText(this, "十秒后开始下载...", Toast.LENGTH_SHORT).show()
fillChapters() fillChapters()
Thread { dlThead { downloadChapterPages(it) } }.start() Thread { dlThread { downloadChapterPages(it) } }.start()
} }
} }
} }
@@ -157,6 +155,7 @@ class DlActivity : Activity() {
} }
private fun analyzeStructure() { private fun analyzeStructure() {
ViewMangaActivity.zipList = arrayOf()
Gson().fromJson(json?.reader(), Array<ComicStructure>::class.java)?.let { Gson().fromJson(json?.reader(), Array<ComicStructure>::class.java)?.let {
for (group in it) { for (group in it) {
val tc = layoutInflater.inflate(R.layout.line_caption, ldwn, false) val tc = layoutInflater.inflate(R.layout.line_caption, ldwn, false)
@@ -182,21 +181,21 @@ class DlActivity : Activity() {
val mangaHome = File("${getExternalFilesDir("")}/$comicName") val mangaHome = File("${getExternalFilesDir("")}/$comicName")
val jsonFile = File(mangaHome, "info.bin") val jsonFile = File(mangaHome, "info.bin")
if(!mangaHome.exists()) mangaHome.mkdirs() if(!mangaHome.exists()) mangaHome.mkdirs()
json?.let { jsonFile.writeText(it) } if(!(jsonFile.exists() && intent.getBooleanExtra("callFromDlList", false))) json?.let { jsonFile.writeText(it) }
} }
@ExperimentalStdlibApi @ExperimentalStdlibApi
private fun downloadChapterPages(i: ToggleButton) { private fun downloadChapterPages(i: ChapterToggleButton) {
mangaDlTools.onDownloadedListener = mangaDlTools.onDownloadedListener =
object : MangaDlTools.OnDownloadedListener { object : MangaDlTools.OnDownloadedListener {
override fun handleMessage(succeed: Boolean) { override fun handleMessage(succeed: Boolean) {
handler.obtainMessage(if (succeed) 1 else -1, tbtnlist.indexOf(i), 0) handler.obtainMessage(if (succeed) 1 else -1, i.index, 0)
.sendToTarget() .sendToTarget()
} }
override fun handleMessage(succeed: Boolean, pageNow: Int) { override fun handleMessage(succeed: Boolean, pageNow: Int) {
handler.obtainMessage( handler.obtainMessage(
5, 5,
tbtnlist.indexOf(i), i.index,
pageNow, pageNow,
succeed succeed
).sendToTarget() ).sendToTarget()
@@ -204,15 +203,17 @@ class DlActivity : Activity() {
override fun handleMessage(pageNow: Int){ override fun handleMessage(pageNow: Int){
handler.obtainMessage( handler.obtainMessage(
10, 10,
tbtnlist.indexOf(i), i.index,
pageNow pageNow
).sendToTarget() ).sendToTarget()
} }
} }
mangaDlTools.dlChapterAndPackIntoZip( i.hash?.let {
File("${getExternalFilesDir("")}/$comicName/${i.hint}/${i.textOn}.zip"), mangaDlTools.dlChapterAndPackIntoZip(
tbtnUrlList[tbtnlist.indexOf(i)].substringAfterLast("/") File("${getExternalFilesDir("")}/$comicName/${i.hint}/${i.textOn}.zip"),
) it
)
}
} }
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
@@ -224,11 +225,12 @@ class DlActivity : Activity() {
isNewTitle = false isNewTitle = false
} }
val tbv = layoutInflater.inflate(R.layout.button_tbutton, ltbtn.ltbtn, false) val tbv = layoutInflater.inflate(R.layout.button_tbutton, ltbtn.ltbtn, false)
tbv.tbtn.index = tbtnlist.size
tbtnlist += tbv.tbtn tbtnlist += tbv.tbtn
tbv.tbtn.url = url
tbtncnt++ tbtncnt++
tbtnUrlList.add(url) val zipPosition = ViewMangaActivity.zipList?.size
val zipPosition = zipArrayList.size ViewMangaActivity.zipList = ViewMangaActivity.zipList?.plus("$title.zip")
zipArrayList += "$title.zip"
tbv.tbtn.textOff = title tbv.tbtn.textOff = title
tbv.tbtn.textOn = title tbv.tbtn.textOn = title
tbv.tbtn.text = title tbv.tbtn.text = title
@@ -251,7 +253,7 @@ class DlActivity : Activity() {
else tdwn.text = "$dldChapter/${--checkedChapter}" else tdwn.text = "$dldChapter/${--checkedChapter}"
}else if(it.tbtn.isChecked){ }else if(it.tbtn.isChecked){
it.tbtn.isChecked = false it.tbtn.isChecked = false
callVM(title, zipf, zipPosition) zipPosition?.let { callVM(title, zipf, it) }
} }
} }
tbv.tbtn.setOnLongClickListener { tbv.tbtn.setOnLongClickListener {
@@ -289,7 +291,7 @@ class DlActivity : Activity() {
private fun callVM(titleText: String, zipFile: File, zipPosition:Int){ private fun callVM(titleText: String, zipFile: File, zipPosition:Int){
ViewMangaActivity.titleText = titleText ViewMangaActivity.titleText = titleText
ViewMangaActivity.zipFile = zipFile ViewMangaActivity.zipFile = zipFile
ViewMangaActivity.zipList = zipArrayList //ViewMangaActivity.zipList = zipArrayList
ViewMangaActivity.zipPosition = zipPosition ViewMangaActivity.zipPosition = zipPosition
ViewMangaActivity.cd = zipFile.parentFile ViewMangaActivity.cd = zipFile.parentFile
startActivity(Intent(this, ViewMangaActivity::class.java)) startActivity(Intent(this, ViewMangaActivity::class.java))

View File

@@ -57,7 +57,7 @@ class DlListActivity:Activity() {
ViewMangaActivity.zipFile = chosenFile ViewMangaActivity.zipFile = chosenFile
ViewMangaActivity.titleText = it[position] ViewMangaActivity.titleText = it[position]
ViewMangaActivity.zipPosition = position ViewMangaActivity.zipPosition = position
ViewMangaActivity.zipList = it ViewMangaActivity.zipList = it as Array<String>
ViewMangaActivity.cd = cd ViewMangaActivity.cd = cd
startActivity(Intent(this, ViewMangaActivity::class.java)) startActivity(Intent(this, ViewMangaActivity::class.java))
} }
@@ -66,8 +66,8 @@ class DlListActivity:Activity() {
mylv.setOnItemLongClickListener { _, _, position, _ -> mylv.setOnItemLongClickListener { _, _, position, _ ->
val chosenFile = File(cd, it[position]) val chosenFile = File(cd, it[position])
AlertDialog.Builder(this) AlertDialog.Builder(this)
.setIcon(R.drawable.ic_launcher_foreground).setMessage("是否在此执行删除/查错?") .setIcon(R.drawable.ic_launcher_foreground).setMessage("在此执行删除/查错?")
.setTitle("提示").setPositiveButton(android.R.string.ok){ _, _ -> .setTitle("提示").setPositiveButton("删除"){ _, _ ->
if(chosenFile.exists()) handler?.obtainMessage(2, chosenFile)?.sendToTarget() //call rmrf if(chosenFile.exists()) handler?.obtainMessage(2, chosenFile)?.sendToTarget() //call rmrf
handler?.obtainMessage(3, cd)?.sendToTarget() //call scanFile handler?.obtainMessage(3, cd)?.sendToTarget() //call scanFile
}.setNegativeButton(android.R.string.cancel){_, _ ->} }.setNegativeButton(android.R.string.cancel){_, _ ->}
@@ -97,7 +97,10 @@ class DlListActivity:Activity() {
private fun callDownloadActivity(jsonFile: File){ private fun callDownloadActivity(jsonFile: File){
DlActivity.json = jsonFile.readText() DlActivity.json = jsonFile.readText()
DlActivity.comicName = jsonFile.parentFile?.name?:"Null" DlActivity.comicName = jsonFile.parentFile?.name?:"Null"
startActivity(Intent(this, DlActivity::class.java)) startActivity(
Intent(this, DlActivity::class.java)
.putExtra("callFromDlList", true)
)
} }
private fun findNullWebpZipFileInDir(f: File){ private fun findNullWebpZipFileInDir(f: File){

View File

@@ -26,7 +26,7 @@ class MainActivity: Activity() {
setContentView(R.layout.activity_main) setContentView(R.layout.activity_main)
wm = WeakReference(this) wm = WeakReference(this)
mh = MainHandler(Looper.getMainLooper()) mh = MainHandler(Looper.myLooper()!!)
toolsBox = ToolsBox(wm as WeakReference<Any>) toolsBox = ToolsBox(wm as WeakReference<Any>)
toolsBox?.netinfo?.let { toolsBox?.netinfo?.let {
if(it == "无网络" || it == "错误"){ if(it == "无网络" || it == "错误"){

View File

@@ -5,10 +5,7 @@ import android.annotation.SuppressLint
import android.app.Activity import android.app.Activity
import android.graphics.Bitmap import android.graphics.Bitmap
import android.graphics.BitmapFactory import android.graphics.BitmapFactory
import android.os.Build import android.os.*
import android.os.Bundle
import android.os.Handler
import android.os.Message
import android.util.Log import android.util.Log
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
@@ -105,6 +102,13 @@ class ViewMangaActivity : Activity() {
} }
try { try {
prepareItems() prepareItems()
if(pn > 0) {
pageNum = pn
pn = -1
}else if(pn == -2){
pageNum = count
pn = -1
}
} catch (e: Exception) { } catch (e: Exception) {
e.printStackTrace() e.printStackTrace()
toolsBox.toastError("准备控件错误") toolsBox.toastError("准备控件错误")
@@ -152,7 +156,11 @@ class ViewMangaActivity : Activity() {
private fun loadOneImg() { private fun loadOneImg() {
if(dlZip2View) onei.setImageBitmap(getImgBitmap(currentItem)) if(dlZip2View) onei.setImageBitmap(getImgBitmap(currentItem))
else Glide.with(this@ViewMangaActivity).load(imgUrls[currentItem]).placeholder(R.drawable.bg_comment).into(onei) else Glide.with(this@ViewMangaActivity)
.load(imgUrls[currentItem])
.placeholder(R.drawable.ic_dl)
.dontAnimate()
.into(onei)
updateSeekBar() updateSeekBar()
} }
@@ -338,7 +346,7 @@ class ViewMangaActivity : Activity() {
//Glide.with(this@ViewMangaActivity).load(it).placeholder(R.drawable.bg_comment).into(holder.itemView.onei) //Glide.with(this@ViewMangaActivity).load(it).placeholder(R.drawable.bg_comment).into(holder.itemView.onei)
holder.itemView.onei.setImageBitmap(it) holder.itemView.onei.setImageBitmap(it)
} }
else Glide.with(this@ViewMangaActivity).load(imgUrls[pos]).placeholder(R.drawable.bg_comment).timeout(10000).into(holder.itemView.onei) else Glide.with(this@ViewMangaActivity).load(imgUrls[pos]).placeholder(R.drawable.ic_dl).dontAnimate().timeout(10000).into(holder.itemView.onei)
} }
override fun getItemCount(): Int { override fun getItemCount(): Int {
@@ -377,7 +385,7 @@ class ViewMangaActivity : Activity() {
class MyHandler( class MyHandler(
private val infcard: View, private val infcard: View,
private val toolsBox: ToolsBox private val toolsBox: ToolsBox
) : Handler() { ) : Handler(Looper.myLooper()!!) {
private var infcShowed = false private var infcShowed = false
private var delta = -1f private var delta = -1f
get() { get() {
@@ -429,7 +437,8 @@ class ViewMangaActivity : Activity() {
var nextChapterUrl: String? = null var nextChapterUrl: String? = null
var previousChapterUrl: String? = null var previousChapterUrl: String? = null
var zipPosition = 0 var zipPosition = 0
var zipList: Array<out String>? = null var zipList: Array<String>? = null
var cd: File? = null var cd: File? = null
var pn = -1
} }
} }

View File

@@ -48,7 +48,7 @@ class DlHandler(activity: DlActivity, looper: Looper) : Handler(looper) {
d?.pdwn?.progress = 0 d?.pdwn?.progress = 0
val selectDownloaded = d?.multiSelect?:false val selectDownloaded = d?.multiSelect?:false
if (d?.haveSElectAll == true) { if (d?.haveSElectAll == true) {
d?.tbtnlist?.listIterator()?.forEach { i -> d?.tbtnlist?.forEach { i ->
if(i.freezesText) i.setBackgroundResource(R.drawable.rndbg_checked) else i.setBackgroundResource(R.drawable.toggle_button) if(i.freezesText) i.setBackgroundResource(R.drawable.rndbg_checked) else i.setBackgroundResource(R.drawable.toggle_button)
i.isChecked = false i.isChecked = false
} }
@@ -62,7 +62,7 @@ class DlHandler(activity: DlActivity, looper: Looper) : Handler(looper) {
i.isChecked = true i.isChecked = true
it.checkedChapter++ it.checkedChapter++
} }
for (i in it.tbtnlist.listIterator()) { for (i in it.tbtnlist) {
if(selectDownloaded) checkBtn(i, it) if(selectDownloaded) checkBtn(i, it)
else if(!i.freezesText) checkBtn(i, it) else if(!i.freezesText) checkBtn(i, it)
} }
@@ -90,7 +90,7 @@ class DlHandler(activity: DlActivity, looper: Looper) : Handler(looper) {
} }
private fun setSize(pageNow: Int, tbtnNo: Int){ private fun setSize(pageNow: Int, tbtnNo: Int){
if(refreshSize || size == 0) { if(refreshSize || size == 0) {
size = d?.tbtnUrlList?.get(tbtnNo)?.let { wmdlt?.get()?.getImgsCountByHash(it.substringAfterLast("/")) }?:0 size = d?.tbtnlist?.get(tbtnNo)?.hash?.let { wmdlt?.get()?.getImgsCountByHash(it) }?:0
refreshSize = false refreshSize = false
}else if(pageNow == size) refreshSize = true }else if(pageNow == size) refreshSize = true
} }

View File

@@ -28,9 +28,9 @@ class MainHandler(looper: Looper):Handler(looper) {
} }
private fun loadUrlInHiddenWebView(url: String){wm?.get()?.wh?.loadUrl(url)} private fun loadUrlInHiddenWebView(url: String){wm?.get()?.wh?.loadUrl(url)}
private fun callViewManga(content: String){ private fun callViewManga(content: String){
val listChapter = content.split("\n") val listChapter = content.split('\n')
if(!saveUrlsOnly) { if(!saveUrlsOnly) {
ViewMangaActivity.titleText = listChapter[0].substringBeforeLast(" ") ViewMangaActivity.titleText = listChapter[0].substringBeforeLast(' ')
ViewMangaActivity.nextChapterUrl = listChapter[1].let { if(it == "null") null else it } ViewMangaActivity.nextChapterUrl = listChapter[1].let { if(it == "null") null else it }
ViewMangaActivity.previousChapterUrl = listChapter[2].let { if(it == "null") null else it } ViewMangaActivity.previousChapterUrl = listChapter[2].let { if(it == "null") null else it }
ViewMangaActivity.imgUrls = arrayOf() ViewMangaActivity.imgUrls = arrayOf()
@@ -39,7 +39,7 @@ class MainHandler(looper: Looper):Handler(looper) {
} else{ } else{
var imgs = arrayOf<String>() var imgs = arrayOf<String>()
for(i in 3 until listChapter.size) imgs += listChapter[i] for(i in 3 until listChapter.size) imgs += listChapter[i]
wmdlt?.get()?.setChapterImgs(listChapter[0].substringAfterLast(" "), imgs) wmdlt?.get()?.setChapterImgs(listChapter[0].substringAfterLast(' '), imgs)
} }
} }
private fun updateLoadProgress(progress: Int){ private fun updateLoadProgress(progress: Int){

View File

@@ -1,7 +1,6 @@
package top.fumiama.copymanga.tool package top.fumiama.copymanga.tool
import android.content.Intent import android.content.Intent
import android.util.Log
import android.widget.Toast import android.widget.Toast
import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.activity_main.*
import top.fumiama.copymanga.activity.MainActivity.Companion.wm import top.fumiama.copymanga.activity.MainActivity.Companion.wm
@@ -21,9 +20,6 @@ class PagesManager(w: WeakReference<ViewMangaActivity>) {
private fun judgeNext() = v?.pageNum?:0 < v?.count?:0 private fun judgeNext() = v?.pageNum?:0 < v?.count?:0
@ExperimentalStdlibApi @ExperimentalStdlibApi
private fun toPage(goNext:Boolean){ private fun toPage(goNext:Boolean){
val chapterUrl = if(goNext) ViewMangaActivity.nextChapterUrl else ViewMangaActivity.previousChapterUrl
val newZipPosition = ViewMangaActivity.zipPosition + (if(goNext) 1 else -1)
val hint = if(goNext) "" else ""
if (v?.clicked == false) { if (v?.clicked == false) {
if (if(goNext)judgeNext() else judgePrevious()) { if (if(goNext)judgeNext() else judgePrevious()) {
if(goNext) { if(goNext) {
@@ -33,33 +29,42 @@ class PagesManager(w: WeakReference<ViewMangaActivity>) {
v.scrollBack() v.scrollBack()
isEndL = false isEndL = false
} }
} else if (chapterUrl != null) { } else {
if (if(goNext)isEndR else isEndL) { val chapterUrl = if(goNext) ViewMangaActivity.nextChapterUrl else ViewMangaActivity.previousChapterUrl
wm?.get()?.w?.loadUrl("javascript:invoke.clickClass(\"comicControlBottomTopClick\",${if(goNext)1 else 0});") if (chapterUrl != null) {
v.tt.canDo = false if (if(goNext)isEndR else isEndL) {
v.finish() if(!goNext) ViewMangaActivity.pn = -2
} else doubleTapToast(hint, goNext) wm?.get()?.w?.loadUrl("javascript:invoke.clickClass(\"comicControlBottomTopClick\",${if(goNext)1 else 0});")
} else if(v.dlZip2View && newZipPosition >= 0 && newZipPosition < ViewMangaActivity.zipList?.size?:0){ v.tt.canDo = false
if (if(goNext)isEndR else isEndL){ v.finish()
ViewMangaActivity.zipPosition = newZipPosition } else doubleTapToast(goNext)
ViewMangaActivity.titleText = ViewMangaActivity.zipList?.get(newZipPosition) ?: "null" } else {
ViewMangaActivity.zipFile = File(ViewMangaActivity.cd, ViewMangaActivity.titleText) val newZipPosition = ViewMangaActivity.zipPosition + (if(goNext) 1 else -1)
v.startActivity(Intent(v, ViewMangaActivity::class.java)) if(v.dlZip2View && newZipPosition >= 0 && newZipPosition < ViewMangaActivity.zipList?.size?:0){
v.tt.canDo = false if (if(goNext)isEndR else isEndL){
v.finish() if(!goNext) ViewMangaActivity.pn = -2
}else doubleTapToast(hint, goNext) ViewMangaActivity.zipPosition = newZipPosition
ViewMangaActivity.titleText = ViewMangaActivity.zipList?.get(newZipPosition) ?: "null"
ViewMangaActivity.zipFile = File(ViewMangaActivity.cd, ViewMangaActivity.titleText)
v.startActivity(Intent(v, ViewMangaActivity::class.java))
v.tt.canDo = false
v.finish()
}else doubleTapToast(goNext)
}
else Toast.makeText(
v.applicationContext,
"已经到头了~",
Toast.LENGTH_SHORT
).show()
}
} }
else Toast.makeText(
v.applicationContext,
"已经到头了~",
Toast.LENGTH_SHORT
).show()
} else v?.hideObjs() } else v?.hideObjs()
} }
fun manageInfo(){ fun manageInfo(){
if (v?.clicked == false) v.showObjs() else v?.hideObjs() if (v?.clicked == false) v.showObjs() else v?.hideObjs()
} }
private fun doubleTapToast(hint: String, goNext: Boolean){ private fun doubleTapToast(goNext: Boolean){
val hint = if(goNext) "" else ""
Toast.makeText( Toast.makeText(
v?.applicationContext, v?.applicationContext,
"再次按下加载${hint}一章", "再次按下加载${hint}一章",

View File

@@ -0,0 +1,23 @@
package top.fumiama.copymanga.view
import android.content.Context
import android.util.AttributeSet
import android.widget.ToggleButton
class ChapterToggleButton: ToggleButton {
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int): super(context, attrs, defStyleAttr)
constructor(context: Context?, attrs: AttributeSet?): super(context, attrs)
constructor(context: Context?): super(context, null)
var url: CharSequence? = null
val hash get() = url?.toString()?.substringAfterLast('/')
var caption: CharSequence? = null
var index: Int = 0
var chapterName: CharSequence = "null"
set(value) {
textOn = value
textOff = value
text = value
field = value
}
}

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ToggleButton xmlns:android="http://schemas.android.com/apk/res/android" <top.fumiama.copymanga.view.ChapterToggleButton xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/tbtn" android:id="@+id/tbtn"
android:layout_width="64dp" android:layout_width="64dp"