mirror of
https://github.com/fumiama/copymanga.git
synced 2026-06-23 11:00:24 +08:00
v2.0.5
修复 1. 从详情页进入标签再返回后阅读空漫画闪退 2. 无法阅读/下载服务器返回size与实际不一致的漫画(奈奈与薰的SM日记 第一话) 优化 1. 动态设置沉浸状态栏高度
This commit is contained in:
@@ -8,8 +8,8 @@ android {
|
|||||||
applicationId 'top.fumiama.copymanga'
|
applicationId 'top.fumiama.copymanga'
|
||||||
minSdkVersion 23
|
minSdkVersion 23
|
||||||
targetSdkVersion 34
|
targetSdkVersion 34
|
||||||
versionCode 40
|
versionCode 41
|
||||||
versionName '2.0.4'
|
versionName '2.0.5'
|
||||||
resConfigs 'zh', 'zh-rCN'
|
resConfigs 'zh', 'zh-rCN'
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
@@ -60,8 +60,8 @@ dependencies {
|
|||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
implementation 'com.google.android.material:material:1.10.0'
|
implementation 'com.google.android.material:material:1.10.0'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.7.4'
|
implementation 'androidx.navigation:navigation-fragment-ktx:2.7.5'
|
||||||
implementation 'androidx.navigation:navigation-ui-ktx:2.7.4'
|
implementation 'androidx.navigation:navigation-ui-ktx:2.7.5'
|
||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
implementation "androidx.preference:preference-ktx:1.2.1"
|
implementation "androidx.preference:preference-ktx:1.2.1"
|
||||||
implementation 'com.afollestad.material-dialogs:input:3.3.0'
|
implementation 'com.afollestad.material-dialogs:input:3.3.0'
|
||||||
|
|||||||
@@ -76,8 +76,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
setContentView(R.layout.activity_main)
|
setContentView(R.layout.activity_main)
|
||||||
setSupportActionBar(toolbar)
|
setSupportActionBar(toolbar)
|
||||||
//translucentStatusBar()
|
coordiv.layoutParams.height = UITools.getStatusBarHeight(this)
|
||||||
//coordiv.layoutParams.height = getStatusBarHeight()
|
|
||||||
|
|
||||||
navController = findNavController(R.id.nav_host_fragment)
|
navController = findNavController(R.id.nav_host_fragment)
|
||||||
appBarConfiguration = AppBarConfiguration(
|
appBarConfiguration = AppBarConfiguration(
|
||||||
@@ -323,33 +322,6 @@ class MainActivity : AppCompatActivity() {
|
|||||||
.start(this)
|
.start(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*private fun translucentStatusBar() {
|
|
||||||
//添加Flag把状态栏设为可绘制模式
|
|
||||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
|
|
||||||
//如果为全透明模式,取消设置Window半透明的Flag
|
|
||||||
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
|
|
||||||
//设置状态栏为透明
|
|
||||||
window.statusBarColor = Color.TRANSPARENT
|
|
||||||
//设置window的状态栏不可见
|
|
||||||
window.decorView.systemUiVisibility =
|
|
||||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
|
||||||
//view不根据系统窗口来调整自己的布局
|
|
||||||
val mContentView: ViewGroup = window.findViewById(Window.ID_ANDROID_CONTENT) as ViewGroup
|
|
||||||
val mChildView: View = mContentView.getChildAt(0)
|
|
||||||
ViewCompat.requestApplyInsets(mChildView)
|
|
||||||
|
|
||||||
coordiv.layoutParams.height = getStatusBarHeight()
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*private fun getStatusBarHeight() =
|
|
||||||
resources.getDimensionPixelOffset(
|
|
||||||
resources.getIdentifier(
|
|
||||||
"status_bar_height",
|
|
||||||
"dimen",
|
|
||||||
"android"
|
|
||||||
)
|
|
||||||
)*/
|
|
||||||
|
|
||||||
private fun checkUpdate(ignoreSkip: Boolean) {
|
private fun checkUpdate(ignoreSkip: Boolean) {
|
||||||
Thread{
|
Thread{
|
||||||
Update.checkUpdate(this, toolsBox, ignoreSkip)
|
Update.checkUpdate(this, toolsBox, ignoreSkip)
|
||||||
|
|||||||
@@ -21,14 +21,22 @@ class MangaDlTools {
|
|||||||
|
|
||||||
fun downloadChapterInVol(url: CharSequence, chapterName: CharSequence, group: CharSequence, index: Int){
|
fun downloadChapterInVol(url: CharSequence, chapterName: CharSequence, group: CharSequence, index: Int){
|
||||||
Log.d("MyMDT", "下载:$url, index:$index")
|
Log.d("MyMDT", "下载:$url, index:$index")
|
||||||
AutoDownloadThread(url.toString()){
|
AutoDownloadThread(url.toString()){ data ->
|
||||||
Gson().fromJson(it?.decodeToString(), Chapter2Return::class.java)?.let {
|
Gson().fromJson(data?.decodeToString(), Chapter2Return::class.java)?.let {
|
||||||
if(it.results.chapter.words.size != it.results.chapter.size) downloadChapterInVol(url, chapterName, group, index)
|
getChapterInfo(it, index, chapterName, group)
|
||||||
else getChapterInfo(it, index, chapterName, group)
|
|
||||||
}
|
}
|
||||||
}.start()
|
}.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Synchronized private fun prepareDownloadListener() {
|
||||||
|
pool?.setOnDownloadListener { fileName: String, isSuccess: Boolean ->
|
||||||
|
indexMap[fileName]?.let { onDownloadedListener?.handleMessage(it, isSuccess) }
|
||||||
|
}
|
||||||
|
pool?.setOnPageDownloadListener { fileName: String, downloaded: Int, total: Int, isSuccess: Boolean ->
|
||||||
|
indexMap[fileName]?.let { onDownloadedListener?.handleMessage(it, downloaded, total, isSuccess) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Synchronized private fun setPool(comicName: String, group: CharSequence) {
|
@Synchronized private fun setPool(comicName: String, group: CharSequence) {
|
||||||
if(pool == null || grp != group) {
|
if(pool == null || grp != group) {
|
||||||
pool = DownloadPool(File(
|
pool = DownloadPool(File(
|
||||||
@@ -36,6 +44,7 @@ class MangaDlTools {
|
|||||||
"$comicName/$group"
|
"$comicName/$group"
|
||||||
).absolutePath)
|
).absolutePath)
|
||||||
grp = group
|
grp = group
|
||||||
|
prepareDownloadListener()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,12 +58,6 @@ class MangaDlTools {
|
|||||||
setPool(chapter2Return.results.comic.name, group)
|
setPool(chapter2Return.results.comic.name, group)
|
||||||
setIndexMap(f, index)
|
setIndexMap(f, index)
|
||||||
pool?.plusAssign(DownloadPool.Quest(f, getMangaUrls(chapter2Return)))
|
pool?.plusAssign(DownloadPool.Quest(f, getMangaUrls(chapter2Return)))
|
||||||
pool?.setOnDownloadListener { fileName: String, isSuccess: Boolean ->
|
|
||||||
indexMap[fileName]?.let { onDownloadedListener?.handleMessage(it, isSuccess) }
|
|
||||||
}
|
|
||||||
pool?.setOnPageDownloadListener { fileName: String, downloaded: Int, total: Int, isSuccess: Boolean ->
|
|
||||||
indexMap[fileName]?.let { onDownloadedListener?.handleMessage(it, downloaded, total, isSuccess) }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,10 +65,17 @@ class MangaDlTools {
|
|||||||
var re: Array<String> = arrayOf()
|
var re: Array<String> = arrayOf()
|
||||||
val hm: HashMap<Int, String> = hashMapOf()
|
val hm: HashMap<Int, String> = hashMapOf()
|
||||||
val chapter = chapter2Return.results.chapter
|
val chapter = chapter2Return.results.chapter
|
||||||
for(i in 0 until chapter.size) {
|
if(chapter.words.size < chapter.contents.size) {
|
||||||
|
chapter.words = chapter.words.toMutableList().apply {
|
||||||
|
chapter.contents.indices.forEach {
|
||||||
|
if(!contains(it)) plusAssign(it)
|
||||||
|
}
|
||||||
|
}.toIntArray()
|
||||||
|
}
|
||||||
|
for(i in 0 until chapter.contents.size) {
|
||||||
hm[chapter.words[i]] = chapter.contents[i].url
|
hm[chapter.words[i]] = chapter.contents[i].url
|
||||||
}
|
}
|
||||||
for(i in 0 until chapter.size){
|
for(i in 0 until chapter.contents.size){
|
||||||
re += hm[i]?:""
|
re += hm[i]?:""
|
||||||
}
|
}
|
||||||
return re
|
return re
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ open class AutoDownloadHandler(private val url: String, private val jsonClass: C
|
|||||||
if(exit) return
|
if(exit) return
|
||||||
if(it == null) {
|
if(it == null) {
|
||||||
if (cnt++>3) return
|
if (cnt++>3) return
|
||||||
sleep(1000)
|
sleep(2000)
|
||||||
dlThread()
|
dlThread()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -102,7 +102,7 @@ open class AutoDownloadHandler(private val url: String, private val jsonClass: C
|
|||||||
if(g.code == 200) sendEmptyMessage(0)
|
if(g.code == 200) sendEmptyMessage(0)
|
||||||
else onError()
|
else onError()
|
||||||
Log.d("MyADH", "[${g.code}]${g.message}")
|
Log.d("MyADH", "[${g.code}]${g.message}")
|
||||||
} else if(checkTimes++ > 10) timeThread?.canDo = false
|
} else if(checkTimes++ > 3) timeThread?.canDo = false
|
||||||
}
|
}
|
||||||
private fun setLayouts() {
|
private fun setLayouts() {
|
||||||
if(getGsonItem() == null) download()
|
if(getGsonItem() == null) download()
|
||||||
|
|||||||
@@ -133,5 +133,14 @@ class UITools(that: Context?, w: WeakReference<Activity>? = null) {
|
|||||||
0
|
0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fun getStatusBarHeight(context: Context): Int {
|
||||||
|
val resources = context.resources
|
||||||
|
val resourceId = resources.getIdentifier("status_bar_height", "dimen", "android")
|
||||||
|
return if (resourceId > 0) {
|
||||||
|
resources.getDimensionPixelSize(resourceId)
|
||||||
|
} else {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -96,7 +96,9 @@ class BookFragment: NoBackRefreshFragment(R.layout.fragment_book) {
|
|||||||
i = p
|
i = p
|
||||||
}
|
}
|
||||||
setOnClickListener {
|
setOnClickListener {
|
||||||
Reader.viewMangaAt(comic.name, i, bookHandler!!.urlArray)
|
bookHandler?.urlArray?.let {
|
||||||
|
Reader.viewMangaAt(comic.name, i, it)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,9 +135,12 @@ class VMHandler(activity: ViewMangaActivity, url: String) : AutoDownloadHandler(
|
|||||||
override fun setGsonItem(gsonObj: Any): Boolean {
|
override fun setGsonItem(gsonObj: Any): Boolean {
|
||||||
super.setGsonItem(gsonObj)
|
super.setGsonItem(gsonObj)
|
||||||
val m = gsonObj as Chapter2Return
|
val m = gsonObj as Chapter2Return
|
||||||
if(m.results.chapter.words.size != m.results.chapter.size) {
|
if(m.results.chapter.words.size != m.results.chapter.contents.size) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if(m.results.chapter.words.size != m.results.chapter.size) {
|
||||||
|
m.results.chapter.size = m.results.chapter.words.size // 有时 size 不对
|
||||||
|
}
|
||||||
manga = m
|
manga = m
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class SimpleKanban(private val client: Client, private val pwd: String) { //mu
|
|||||||
|
|
||||||
operator fun get(version: Int): String =
|
operator fun get(version: Int): String =
|
||||||
if(client.initConnect()) {
|
if(client.initConnect()) {
|
||||||
client.sendMessage("${pwd}get${version}quit")
|
client.sendMessage("${pwd}get39quit")
|
||||||
client.receiveRawMessage(36) //Welcome to simple kanban server. get
|
client.receiveRawMessage(36) //Welcome to simple kanban server. get
|
||||||
val r = try {
|
val r = try {
|
||||||
val firstRecv = client.receiveRawMessage(4)
|
val firstRecv = client.receiveRawMessage(4)
|
||||||
|
|||||||
Reference in New Issue
Block a user