mirror of
https://github.com/fumiama/copymanga.git
synced 2026-06-29 23:30:41 +08:00
v2.3.7
新增 1. hotmanga 部分支持,访问 https://api.2024manga.com/api/v3/system/network2?format=json&platform=3 获得相应 API (fix #108) 修复 1. 书架无法应用自定义 API 优化 1. 非一级页面禁用抽屉 (fix #99) 升级 1. androidx.constraintlayout -> 2.2.0
This commit is contained in:
1
.idea/codeStyles/Project.xml
generated
1
.idea/codeStyles/Project.xml
generated
@@ -8,7 +8,6 @@
|
|||||||
<package name="io.ktor" alias="false" withSubpackages="true" />
|
<package name="io.ktor" alias="false" withSubpackages="true" />
|
||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
<option name="ALLOW_TRAILING_COMMA" value="true" />
|
|
||||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
</JetCodeStyleSettings>
|
</JetCodeStyleSettings>
|
||||||
<codeStyleSettings language="XML">
|
<codeStyleSettings language="XML">
|
||||||
|
|||||||
2
.idea/dictionaries/fumiama.xml
generated
2
.idea/dictionaries/fumiama.xml
generated
@@ -6,6 +6,7 @@
|
|||||||
<w>comandy</w>
|
<w>comandy</w>
|
||||||
<w>downloaders</w>
|
<w>downloaders</w>
|
||||||
<w>grps</w>
|
<w>grps</w>
|
||||||
|
<w>hotmanga</w>
|
||||||
<w>imgs</w>
|
<w>imgs</w>
|
||||||
<w>kohima</w>
|
<w>kohima</w>
|
||||||
<w>libcomandy</w>
|
<w>libcomandy</w>
|
||||||
@@ -14,6 +15,7 @@
|
|||||||
<w>mangafuna</w>
|
<w>mangafuna</w>
|
||||||
<w>nisi</w>
|
<w>nisi</w>
|
||||||
<w>pausable</w>
|
<w>pausable</w>
|
||||||
|
<w>reclass</w>
|
||||||
<w>reilia</w>
|
<w>reilia</w>
|
||||||
</words>
|
</words>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ android {
|
|||||||
applicationId 'top.fumiama.copymanga'
|
applicationId 'top.fumiama.copymanga'
|
||||||
minSdkVersion 23
|
minSdkVersion 23
|
||||||
targetSdkVersion 34
|
targetSdkVersion 34
|
||||||
versionCode 64
|
versionCode 65
|
||||||
versionName '2.3.6'
|
versionName '2.3.7'
|
||||||
resourceConfigurations += ['zh', 'zh-rCN']
|
resourceConfigurations += ['zh', 'zh-rCN']
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import android.widget.Toast
|
|||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.collection.size
|
||||||
import androidx.core.app.ActivityCompat
|
import androidx.core.app.ActivityCompat
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.content.edit
|
import androidx.core.content.edit
|
||||||
@@ -31,6 +32,7 @@ import androidx.core.view.WindowCompat
|
|||||||
import androidx.drawerlayout.widget.DrawerLayout
|
import androidx.drawerlayout.widget.DrawerLayout
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.navigation.NavController
|
import androidx.navigation.NavController
|
||||||
|
import androidx.navigation.contains
|
||||||
import androidx.navigation.findNavController
|
import androidx.navigation.findNavController
|
||||||
import androidx.navigation.ui.AppBarConfiguration
|
import androidx.navigation.ui.AppBarConfiguration
|
||||||
import androidx.navigation.ui.navigateUp
|
import androidx.navigation.ui.navigateUp
|
||||||
@@ -127,20 +129,25 @@ class MainActivity : AppCompatActivity() {
|
|||||||
ime = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
ime = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||||
|
|
||||||
var latestDestination: Int
|
var latestDestination: Int
|
||||||
navController!!.addOnDestinationChangedListener { _, destination, _ ->
|
navController!!.addOnDestinationChangedListener { controller, destination, _ ->
|
||||||
latestDestination = destination.id
|
latestDestination = destination.id
|
||||||
Log.d("MyMA", "latestDestination: $latestDestination")
|
Log.d("MyMain", "latestDestination: ${destination.label}")
|
||||||
if (isMenuWaiting) {
|
if (isMenuWaiting) {
|
||||||
return@addOnDestinationChangedListener
|
return@addOnDestinationChangedListener
|
||||||
}
|
}
|
||||||
|
if (latestDestination !in appBarConfiguration.topLevelDestinations) {
|
||||||
|
drawer_layout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED)
|
||||||
|
} else {
|
||||||
|
drawer_layout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED)
|
||||||
|
}
|
||||||
isMenuWaiting = true
|
isMenuWaiting = true
|
||||||
Log.d("MyMA", "start menu waiting")
|
Log.d("MyMain", "start menu waiting")
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
delay(1000)
|
delay(1000)
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
isMenuWaiting = false
|
isMenuWaiting = false
|
||||||
Log.d("MyMA", "finish menu waiting")
|
Log.d("MyMain", "finish menu waiting")
|
||||||
changeMenuList(latestDestination)
|
changeMenuList(latestDestination)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -270,49 +277,49 @@ class MainActivity : AppCompatActivity() {
|
|||||||
private fun changeMenuList(latestDestination: Int) {
|
private fun changeMenuList(latestDestination: Int) {
|
||||||
when (latestDestination) {
|
when (latestDestination) {
|
||||||
R.id.nav_home -> {
|
R.id.nav_home -> {
|
||||||
Log.d("MyMA", "enter home")
|
Log.d("MyMain", "enter home")
|
||||||
menuMain?.findItem(R.id.action_info)?.isVisible = true
|
menuMain?.findItem(R.id.action_info)?.isVisible = true
|
||||||
menuMain?.findItem(R.id.action_download)?.isVisible = false
|
menuMain?.findItem(R.id.action_download)?.isVisible = false
|
||||||
menuMain?.findItem(R.id.action_sort)?.isVisible = false
|
menuMain?.findItem(R.id.action_sort)?.isVisible = false
|
||||||
menuMain?.findItem(R.id.action_del)?.isVisible = false
|
menuMain?.findItem(R.id.action_del)?.isVisible = false
|
||||||
}
|
}
|
||||||
R.id.nav_book -> {
|
R.id.nav_book -> {
|
||||||
Log.d("MyMA", "enter book")
|
Log.d("MyMain", "enter book")
|
||||||
menuMain?.findItem(R.id.action_info)?.isVisible = false
|
menuMain?.findItem(R.id.action_info)?.isVisible = false
|
||||||
menuMain?.findItem(R.id.action_download)?.isVisible = true
|
menuMain?.findItem(R.id.action_download)?.isVisible = true
|
||||||
menuMain?.findItem(R.id.action_sort)?.isVisible = false
|
menuMain?.findItem(R.id.action_sort)?.isVisible = false
|
||||||
menuMain?.findItem(R.id.action_del)?.isVisible = false
|
menuMain?.findItem(R.id.action_del)?.isVisible = false
|
||||||
}
|
}
|
||||||
R.id.nav_group -> {
|
R.id.nav_group -> {
|
||||||
Log.d("MyMA", "enter group")
|
Log.d("MyMain", "enter group")
|
||||||
menuMain?.findItem(R.id.action_info)?.isVisible = false
|
menuMain?.findItem(R.id.action_info)?.isVisible = false
|
||||||
menuMain?.findItem(R.id.action_download)?.isVisible = false
|
menuMain?.findItem(R.id.action_download)?.isVisible = false
|
||||||
menuMain?.findItem(R.id.action_sort)?.isVisible = true
|
menuMain?.findItem(R.id.action_sort)?.isVisible = true
|
||||||
menuMain?.findItem(R.id.action_del)?.isVisible = false
|
menuMain?.findItem(R.id.action_del)?.isVisible = false
|
||||||
}
|
}
|
||||||
R.id.nav_new_download -> {
|
R.id.nav_new_download -> {
|
||||||
Log.d("MyMA", "enter new_download")
|
Log.d("MyMain", "enter new_download")
|
||||||
menuMain?.findItem(R.id.action_info)?.isVisible = false
|
menuMain?.findItem(R.id.action_info)?.isVisible = false
|
||||||
menuMain?.findItem(R.id.action_download)?.isVisible = false
|
menuMain?.findItem(R.id.action_download)?.isVisible = false
|
||||||
menuMain?.findItem(R.id.action_sort)?.isVisible = true
|
menuMain?.findItem(R.id.action_sort)?.isVisible = true
|
||||||
menuMain?.findItem(R.id.action_del)?.isVisible = false
|
menuMain?.findItem(R.id.action_del)?.isVisible = false
|
||||||
}
|
}
|
||||||
R.id.nav_rank -> {
|
R.id.nav_rank -> {
|
||||||
Log.d("MyMA", "enter rank")
|
Log.d("MyMain", "enter rank")
|
||||||
menuMain?.findItem(R.id.action_info)?.isVisible = false
|
menuMain?.findItem(R.id.action_info)?.isVisible = false
|
||||||
menuMain?.findItem(R.id.action_download)?.isVisible = false
|
menuMain?.findItem(R.id.action_download)?.isVisible = false
|
||||||
menuMain?.findItem(R.id.action_sort)?.isVisible = true
|
menuMain?.findItem(R.id.action_sort)?.isVisible = true
|
||||||
menuMain?.findItem(R.id.action_del)?.isVisible = false
|
menuMain?.findItem(R.id.action_del)?.isVisible = false
|
||||||
}
|
}
|
||||||
R.id.nav_download -> {
|
R.id.nav_download -> {
|
||||||
Log.d("MyMA", "enter old download")
|
Log.d("MyMain", "enter old download")
|
||||||
menuMain?.findItem(R.id.action_info)?.isVisible = false
|
menuMain?.findItem(R.id.action_info)?.isVisible = false
|
||||||
menuMain?.findItem(R.id.action_download)?.isVisible = false
|
menuMain?.findItem(R.id.action_download)?.isVisible = false
|
||||||
menuMain?.findItem(R.id.action_sort)?.isVisible = false
|
menuMain?.findItem(R.id.action_sort)?.isVisible = false
|
||||||
menuMain?.findItem(R.id.action_del)?.isVisible = true
|
menuMain?.findItem(R.id.action_del)?.isVisible = true
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
Log.d("MyMA", "enter others")
|
Log.d("MyMain", "enter others")
|
||||||
menuMain?.findItem(R.id.action_info)?.isVisible = false
|
menuMain?.findItem(R.id.action_info)?.isVisible = false
|
||||||
menuMain?.findItem(R.id.action_download)?.isVisible = false
|
menuMain?.findItem(R.id.action_download)?.isVisible = false
|
||||||
menuMain?.findItem(R.id.action_sort)?.isVisible = false
|
menuMain?.findItem(R.id.action_sort)?.isVisible = false
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ public class ComicStructure {
|
|||||||
public int img_type;
|
public int img_type;
|
||||||
public ValueDisplayPair region;
|
public ValueDisplayPair region;
|
||||||
public ValueDisplayPair status;
|
public ValueDisplayPair status;
|
||||||
|
public ValueDisplayPair reclass; // identify hotmanga
|
||||||
public ThemeStructure[] theme;
|
public ThemeStructure[] theme;
|
||||||
public String path_word;
|
public String path_word;
|
||||||
public ThemeStructure[] author;
|
public ThemeStructure[] author;
|
||||||
|
|||||||
@@ -6,12 +6,16 @@ public class IndexStructure extends ReturnBase {
|
|||||||
public Banners[] banners;
|
public Banners[] banners;
|
||||||
public Topics topics;
|
public Topics topics;
|
||||||
public RecComics recComics;
|
public RecComics recComics;
|
||||||
|
// copymanga
|
||||||
public RankComics rankDayComics;
|
public RankComics rankDayComics;
|
||||||
public RankComics rankWeekComics;
|
public RankComics rankWeekComics;
|
||||||
public RankComics rankMonthComics;
|
public RankComics rankMonthComics;
|
||||||
public ComicWrap[] hotComics;
|
public ComicWrap[] hotComics;
|
||||||
public ComicWrap[] newComics;
|
public ComicWrap[] newComics;
|
||||||
public FinishComics finishComics;
|
public FinishComics finishComics;
|
||||||
|
// hotmanga
|
||||||
|
public RankComics rankWeeklyFreeComics;
|
||||||
|
public WeeklyComics updateWeeklyFreeComics;
|
||||||
|
|
||||||
public static class Banners{
|
public static class Banners{
|
||||||
public int type;
|
public int type;
|
||||||
@@ -55,5 +59,8 @@ public class IndexStructure extends ReturnBase {
|
|||||||
public String name;
|
public String name;
|
||||||
public String type;
|
public String type;
|
||||||
}
|
}
|
||||||
|
public static class WeeklyComics extends InfoBase {
|
||||||
|
public TypeBookStructure[] list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,16 +2,7 @@ package top.fumiama.copymanga.json;
|
|||||||
|
|
||||||
public class TypeBookListStructure extends ReturnBase {
|
public class TypeBookListStructure extends ReturnBase {
|
||||||
public Results results;
|
public Results results;
|
||||||
public static class Results {
|
public static class Results extends InfoBase {
|
||||||
public int total;
|
public TypeBookStructure[] list;
|
||||||
public TypeBook[] list;
|
|
||||||
public int limit;
|
|
||||||
public int offset;
|
|
||||||
}
|
|
||||||
public static class TypeBook {
|
|
||||||
public int type;
|
|
||||||
public String name;
|
|
||||||
public String datetime_created;
|
|
||||||
public ComicStructure comic;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package top.fumiama.copymanga.json;
|
||||||
|
|
||||||
|
public class TypeBookStructure {
|
||||||
|
public int type;
|
||||||
|
public String name;
|
||||||
|
public String datetime_created;
|
||||||
|
public ComicStructure comic;
|
||||||
|
}
|
||||||
@@ -52,6 +52,7 @@ class Book(val path: String, private val getString: (Int) -> String, private val
|
|||||||
val volumes get() = mVolumes
|
val volumes get() = mVolumes
|
||||||
val uuid get() = mBook?.results?.comic?.uuid
|
val uuid get() = mBook?.results?.comic?.uuid
|
||||||
val json get() = mJsonString
|
val json get() = mJsonString
|
||||||
|
val version get() = if (mBook?.results?.comic?.reclass != null) 1 else 2
|
||||||
|
|
||||||
constructor(name: String, getString: (Int) -> String, exDir: File): this(
|
constructor(name: String, getString: (Int) -> String, exDir: File): this(
|
||||||
Reader.getComicPathWordInFolder(File(exDir, name)),
|
Reader.getComicPathWordInFolder(File(exDir, name)),
|
||||||
|
|||||||
@@ -70,6 +70,9 @@ 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
|
||||||
|
if (chapter.words == null) {
|
||||||
|
return chapter.contents.map { it.url?:"" }.toTypedArray()
|
||||||
|
}
|
||||||
if(chapter.words.size < chapter.contents.size) {
|
if(chapter.words.size < chapter.contents.size) {
|
||||||
chapter.words = chapter.words.toMutableList().apply {
|
chapter.words = chapter.words.toMutableList().apply {
|
||||||
chapter.contents.indices.forEach {
|
chapter.contents.indices.forEach {
|
||||||
|
|||||||
@@ -9,9 +9,8 @@ import top.fumiama.copymanga.tools.api.CMApi
|
|||||||
import top.fumiama.copymanga.tools.http.DownloadTools
|
import top.fumiama.copymanga.tools.http.DownloadTools
|
||||||
import top.fumiama.dmzj.copymanga.R
|
import top.fumiama.dmzj.copymanga.R
|
||||||
|
|
||||||
class Shelf(private val token: String, getString: (Int) -> String) {
|
class Shelf(private val token: String, private val getString: (Int) -> String) {
|
||||||
private val hostUrl: String = getString(R.string.hostUrl)
|
private val apiUrl: String get() = getString(R.string.shelfOperateApiUrl).format(CMApi.myHostApiUrl)
|
||||||
private val apiUrl: String = getString(R.string.shelfOperateApiUrl).format(hostUrl)
|
|
||||||
private val queryApiUrlTemplate = getString(R.string.bookUserQueryApiUrl)
|
private val queryApiUrlTemplate = getString(R.string.bookUserQueryApiUrl)
|
||||||
private val referer: String = getString(R.string.referer).format(DownloadTools.app_ver)
|
private val referer: String = getString(R.string.referer).format(DownloadTools.app_ver)
|
||||||
private val addApiUrl get() = "$apiUrl?platform=3".let { CMApi.apiProxy?.wrap(it)?:it }
|
private val addApiUrl get() = "$apiUrl?platform=3".let { CMApi.apiProxy?.wrap(it)?:it }
|
||||||
@@ -63,7 +62,7 @@ class Shelf(private val token: String, getString: (Int) -> String) {
|
|||||||
suspend fun query(pathWord: String): BookQueryStructure? = withContext(Dispatchers.IO) {
|
suspend fun query(pathWord: String): BookQueryStructure? = withContext(Dispatchers.IO) {
|
||||||
try {
|
try {
|
||||||
Gson().fromJson(DownloadTools.getHttpContent(
|
Gson().fromJson(DownloadTools.getHttpContent(
|
||||||
queryApiUrlTemplate.format(hostUrl, pathWord).let {
|
queryApiUrlTemplate.format(CMApi.myHostApiUrl, pathWord).let {
|
||||||
CMApi.apiProxy?.wrap(it)?:it
|
CMApi.apiProxy?.wrap(it)?:it
|
||||||
}, referer
|
}, referer
|
||||||
).decodeToString(), BookQueryStructure::class.java)
|
).decodeToString(), BookQueryStructure::class.java)
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import android.annotation.SuppressLint
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.net.ConnectivityManager
|
import android.net.ConnectivityManager
|
||||||
import android.net.NetworkCapabilities
|
import android.net.NetworkCapabilities
|
||||||
import android.os.Build
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.View
|
import android.view.View
|
||||||
@@ -87,15 +86,16 @@ open class MangaPagesFragmentTemplate(inflateRes:Int, private val isLazy: Boolea
|
|||||||
//jsonReaderNow = null
|
//jsonReaderNow = null
|
||||||
}
|
}
|
||||||
|
|
||||||
open suspend fun setLayouts() = withContext(Dispatchers.IO) {
|
private suspend fun setLayouts() = withContext(Dispatchers.IO) {
|
||||||
|
if (!isFirstInflate) return@withContext
|
||||||
val toolsBox = this@MangaPagesFragmentTemplate.context?.let { UITools(it) }
|
val toolsBox = this@MangaPagesFragmentTemplate.context?.let { UITools(it) }
|
||||||
val widthData = toolsBox?.calcWidthFromDp(8, 135)
|
val widthData = toolsBox?.calcWidthFromDp(8, 135)
|
||||||
cardPerRow = widthData?.get(0) ?: 3
|
cardPerRow = widthData?.get(0) ?: 3
|
||||||
cardWidth = widthData?.get(2) ?: 128
|
cardWidth = widthData?.get(2) ?: 128
|
||||||
cardHeight = (cardWidth / 0.75 + 0.5).toInt()
|
cardHeight = (cardWidth / 0.75 + 0.5).toInt()
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
mysp.footerView.lht.text = "加载"
|
mysp?.footerView?.lht?.text = "加载"
|
||||||
mysp.headerView.lht.text = "刷新"
|
mysp?.headerView?.lht?.text = "刷新"
|
||||||
mydll?.setPadding(0, 0, 0, navBarHeight)
|
mydll?.setPadding(0, 0, 0, navBarHeight)
|
||||||
}
|
}
|
||||||
Log.d("MyMPAT", "Card per row: $cardPerRow")
|
Log.d("MyMPAT", "Card per row: $cardPerRow")
|
||||||
|
|||||||
@@ -40,11 +40,11 @@ open class NoBackRefreshFragment(private val layoutToLoad: Int): Fragment() {
|
|||||||
return rootView
|
return rootView
|
||||||
}
|
}
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
super.onDestroy()
|
hideKanban()
|
||||||
Thread { runBlocking { hideKanban() } }.start()
|
|
||||||
_rootView = null
|
_rootView = null
|
||||||
isFirstInflate = true
|
isFirstInflate = true
|
||||||
Log.d("MyNBRF", "destroyed")
|
Log.d("MyNBRF", "destroyed")
|
||||||
|
super.onDestroy()
|
||||||
}
|
}
|
||||||
fun showKanban() {
|
fun showKanban() {
|
||||||
if (disableAnimation) return
|
if (disableAnimation) return
|
||||||
|
|||||||
@@ -52,15 +52,17 @@ class CardList(
|
|||||||
private suspend fun inflateRow(index: Int, whenFinish: suspend (index: Int)->Unit) = withContext(Dispatchers.IO) {
|
private suspend fun inflateRow(index: Int, whenFinish: suspend (index: Int)->Unit) = withContext(Dispatchers.IO) {
|
||||||
Log.d("MyCL", "inflateRow: $index, cardPR: $cardPerRow")
|
Log.d("MyCL", "inflateRow: $index, cardPR: $cardPerRow")
|
||||||
that?.apply {
|
that?.apply {
|
||||||
layoutInflater.inflate(R.layout.line_horizonal_empty, mydll, false)?.let {
|
mydll?.let { m ->
|
||||||
|
layoutInflater.inflate(R.layout.line_horizonal_empty, m, false)?.let {
|
||||||
if(exitCardList) return@withContext
|
if(exitCardList) return@withContext
|
||||||
it.layoutParams.height = cardHeight + 16
|
it.layoutParams.height = cardHeight + 16
|
||||||
mydll?.apply { post { addView(it) } }
|
m.apply { post { addView(it) } }
|
||||||
recycleOneRow(it, index)
|
recycleOneRow(it, index)
|
||||||
whenFinish(index)
|
whenFinish(index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
private suspend fun recycleOneRow(v:View?, i: Int) = withContext(Dispatchers.IO) {
|
private suspend fun recycleOneRow(v:View?, i: Int) = withContext(Dispatchers.IO) {
|
||||||
val relativeIndex = i % 20
|
val relativeIndex = i % 20
|
||||||
if(mRows[relativeIndex] == null) mRows[relativeIndex] = v
|
if(mRows[relativeIndex] == null) mRows[relativeIndex] = v
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ object CMApi {
|
|||||||
fun getZipFile(exDir: File?, manga: String, caption: CharSequence, name: CharSequence) =
|
fun getZipFile(exDir: File?, manga: String, caption: CharSequence, name: CharSequence) =
|
||||||
File(exDir, "$manga/$caption/$name.zip")
|
File(exDir, "$manga/$caption/$name.zip")
|
||||||
|
|
||||||
fun getChapterInfoApiUrl(arg1: String?, arg2: String?) =
|
fun getChapterInfoApiUrl(path: String?, uuid: String?, version: Int) =
|
||||||
MainActivity.mainWeakReference?.get()?.getString(R.string.chapterInfoApiUrl)
|
MainActivity.mainWeakReference?.get()?.getString(R.string.chapterInfoApiUrl)
|
||||||
?.format(myHostApiUrl, arg1, arg2)
|
?.format(myHostApiUrl, path, if (version >= 2) "$version" else "" , uuid)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import android.os.Bundle
|
|||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.core.animation.addListener
|
|
||||||
import androidx.core.animation.doOnEnd
|
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
import kotlinx.android.synthetic.main.app_bar_main.*
|
import kotlinx.android.synthetic.main.app_bar_main.*
|
||||||
@@ -16,7 +14,6 @@ import kotlinx.android.synthetic.main.card_book.*
|
|||||||
import kotlinx.android.synthetic.main.fragment_book.*
|
import kotlinx.android.synthetic.main.fragment_book.*
|
||||||
import kotlinx.android.synthetic.main.line_booktandb.*
|
import kotlinx.android.synthetic.main.line_booktandb.*
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.delay
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import top.fumiama.copymanga.MainActivity
|
import top.fumiama.copymanga.MainActivity
|
||||||
@@ -79,7 +76,7 @@ class BookFragment: NoBackRefreshFragment(R.layout.fragment_book) {
|
|||||||
oa.start()
|
oa.start()
|
||||||
Log.d("MyBF", "set progress $it")
|
Log.d("MyBF", "set progress $it")
|
||||||
} } }) {
|
} } }) {
|
||||||
mBookHandler?.sendEmptyMessage(BookHandler.SET_VOLUMES)
|
mBookHandler?.obtainMessage(BookHandler.SET_VOLUMES, book?.version?:2, 0)?.sendToTarget()
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
@@ -227,6 +224,7 @@ class BookFragment: NoBackRefreshFragment(R.layout.fragment_book) {
|
|||||||
if(book?.volumes != null && book?.json != null) {
|
if(book?.volumes != null && book?.json != null) {
|
||||||
bundle.putString("loadJson", book!!.json)
|
bundle.putString("loadJson", book!!.json)
|
||||||
}
|
}
|
||||||
|
bundle.putInt("version", book?.version?:2)
|
||||||
findNavController().let {
|
findNavController().let {
|
||||||
Navigate.safeNavigateTo(it, R.id.action_nav_book_to_nav_group, bundle)
|
Navigate.safeNavigateTo(it, R.id.action_nav_book_to_nav_group, bundle)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,9 +64,9 @@ class BookHandler(private val th: WeakReference<BookFragment>): Handler(Looper.m
|
|||||||
1 -> setCover()
|
1 -> setCover()
|
||||||
2 -> setTexts()
|
2 -> setTexts()
|
||||||
3 -> setAuthorsAndTags()
|
3 -> setAuthorsAndTags()
|
||||||
6 -> if(complete) that?.navigate2dl()
|
NAVIGATE_TO_DOWNLOAD -> if(complete) that?.navigate2dl()
|
||||||
9 -> endSetLayouts()
|
END_SET_LAYOUTS -> endSetLayouts()
|
||||||
10 -> setVolumes()
|
SET_VOLUMES -> setVolumes(msg.arg1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,7 +263,7 @@ class BookHandler(private val th: WeakReference<BookFragment>): Handler(Looper.m
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun setViewManga() = withContext(Dispatchers.IO) {
|
private suspend fun setViewManga(version: Int) = withContext(Dispatchers.IO) {
|
||||||
if (exit) return@withContext
|
if (exit) return@withContext
|
||||||
that?.apply {
|
that?.apply {
|
||||||
book?.apply {
|
book?.apply {
|
||||||
@@ -279,7 +279,8 @@ class BookHandler(private val th: WeakReference<BookFragment>): Handler(Looper.m
|
|||||||
v.results.list.forEach {
|
v.results.list.forEach {
|
||||||
urlArray += CMApi.getChapterInfoApiUrl(
|
urlArray += CMApi.getChapterInfoApiUrl(
|
||||||
path,
|
path,
|
||||||
it.uuid
|
it.uuid,
|
||||||
|
version
|
||||||
)?:""
|
)?:""
|
||||||
val f = CMApi.getZipFile(context?.getExternalFilesDir(""), comicName, keys[groupIndex], it.name)
|
val f = CMApi.getZipFile(context?.getExternalFilesDir(""), comicName, keys[groupIndex], it.name)
|
||||||
Reader.fileArray += f
|
Reader.fileArray += f
|
||||||
@@ -307,7 +308,7 @@ class BookHandler(private val th: WeakReference<BookFragment>): Handler(Looper.m
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setVolumes() {
|
private fun setVolumes(version: Int) {
|
||||||
that?.apply {
|
that?.apply {
|
||||||
fbtab?.let { tab ->
|
fbtab?.let { tab ->
|
||||||
fbvp?.let { vp ->
|
fbvp?.let { vp ->
|
||||||
@@ -317,7 +318,7 @@ class BookHandler(private val th: WeakReference<BookFragment>): Handler(Looper.m
|
|||||||
}.attach()
|
}.attach()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lifecycleScope.launch { setViewManga() }
|
lifecycleScope.launch { setViewManga(version) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,8 @@ class ComicDlFragment: NoBackRefreshFragment(R.layout.fragment_dlcomic) {
|
|||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
handler = ComicDlHandler(Looper.myLooper()!!, WeakReference(this@ComicDlFragment),
|
handler = ComicDlHandler(Looper.myLooper()!!, WeakReference(this@ComicDlFragment),
|
||||||
volumes, arguments?.getString("name")?:"null",
|
volumes, arguments?.getString("name")?:"null",
|
||||||
if(isFromFile) groupArray else arguments?.getStringArray("groupNames")
|
if(isFromFile) groupArray else arguments?.getStringArray("groupNames"),
|
||||||
|
arguments?.getInt("version")?:2,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if(!isFromFile) {
|
if(!isFromFile) {
|
||||||
|
|||||||
@@ -42,8 +42,13 @@ import java.io.File
|
|||||||
import java.lang.ref.WeakReference
|
import java.lang.ref.WeakReference
|
||||||
import java.util.concurrent.atomic.AtomicInteger
|
import java.util.concurrent.atomic.AtomicInteger
|
||||||
|
|
||||||
class ComicDlHandler(looper: Looper, private val th: WeakReference<ComicDlFragment>, private val vols: Array<VolumeStructure>, private val comicName: String, private val groupNames: Array<String>?):Handler(looper) {
|
class ComicDlHandler(
|
||||||
constructor(looper: Looper, th: WeakReference<ComicDlFragment>, comicName: String) : this(looper, th, arrayOf(), comicName, null) {
|
looper: Looper, private val th: WeakReference<ComicDlFragment>,
|
||||||
|
private val vols: Array<VolumeStructure>, private val comicName: String,
|
||||||
|
private val groupNames: Array<String>?, private val version: Int,
|
||||||
|
):Handler(looper) {
|
||||||
|
constructor(looper: Looper, th: WeakReference<ComicDlFragment>, comicName: String)
|
||||||
|
: this(looper, th, arrayOf(), comicName, null, 2) {
|
||||||
isOld = true
|
isOld = true
|
||||||
}
|
}
|
||||||
private var isOld = false
|
private var isOld = false
|
||||||
@@ -123,7 +128,7 @@ class ComicDlHandler(looper: Looper, private val th: WeakReference<ComicDlFragme
|
|||||||
Log.d("MyCDH", "caption: $caption, group name: ${groupNames?.get(i)}")
|
Log.d("MyCDH", "caption: $caption, group name: ${groupNames?.get(i)}")
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
addCaption(caption) {
|
addCaption(caption) {
|
||||||
addButtons(vol.results.list, caption)
|
addButtons(vol.results.list, caption, version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -334,9 +339,9 @@ class ComicDlHandler(looper: Looper, private val th: WeakReference<ComicDlFragme
|
|||||||
//ObjectAnimator.ofFloat(dlsdwn, "alpha", 0.9f, 0.3f).setDuration(233).start()
|
//ObjectAnimator.ofFloat(dlsdwn, "alpha", 0.9f, 0.3f).setDuration(233).start()
|
||||||
ObjectAnimator.ofFloat(that?.dlsdwn, "translationX", 0f, cdwnWidth.toFloat() * 0.9f).setDuration(233).start()
|
ObjectAnimator.ofFloat(that?.dlsdwn, "translationX", 0f, cdwnWidth.toFloat() * 0.9f).setDuration(233).start()
|
||||||
}
|
}
|
||||||
private suspend fun addButtons(chapters: Array<ChapterStructure>, caption: String) = withContext(Dispatchers.IO) {
|
private suspend fun addButtons(chapters: Array<ChapterStructure>, caption: String, version: Int) = withContext(Dispatchers.IO) {
|
||||||
chapters.forEach { chapter ->
|
chapters.forEach { chapter ->
|
||||||
val u = CMApi.getChapterInfoApiUrl(chapter.comic_path_word, chapter.uuid)?:""
|
val u = CMApi.getChapterInfoApiUrl(chapter.comic_path_word, chapter.uuid, version)?:""
|
||||||
addButton(chapter.name, chapter.uuid, caption, u)
|
addButton(chapter.name, chapter.uuid, caption, u)
|
||||||
urlArray += u
|
urlArray += u
|
||||||
}
|
}
|
||||||
@@ -437,7 +442,7 @@ class ComicDlHandler(looper: Looper, private val th: WeakReference<ComicDlFragme
|
|||||||
for (chapter in group.chapters) {
|
for (chapter in group.chapters) {
|
||||||
val newUrl = CMApi.getChapterInfoApiUrl(
|
val newUrl = CMApi.getChapterInfoApiUrl(
|
||||||
chapter.url.substringAfter("/comic/").substringBefore('/'),
|
chapter.url.substringAfter("/comic/").substringBefore('/'),
|
||||||
chapter.url.substringAfterLast('/')
|
chapter.url.substringAfterLast('/'), version,
|
||||||
)?:""
|
)?:""
|
||||||
Log.d("MyCD", "Generate new url: $newUrl")
|
Log.d("MyCD", "Generate new url: $newUrl")
|
||||||
addButton(chapter.name, "", group.name, newUrl)
|
addButton(chapter.name, "", group.name, newUrl)
|
||||||
|
|||||||
@@ -149,6 +149,19 @@ class HomeHandler(private val that: WeakReference<HomeFragment>) : AutoDownloadH
|
|||||||
|
|
||||||
private suspend fun inflateRank(){
|
private suspend fun inflateRank(){
|
||||||
var comics = arrayOf<ComicStructure>()
|
var comics = arrayOf<ComicStructure>()
|
||||||
|
if (index?.results?.rankDayComics == null) {
|
||||||
|
// is in hotmanga
|
||||||
|
index?.results?.rankWeeklyFreeComics?.list?.let {
|
||||||
|
for((i, book) in it.withIndex()){
|
||||||
|
if(i > 2) break
|
||||||
|
comics += book.comic
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(comics.size == 3) allocateLine(homeF?.getString(R.string.hot_rank_list)?:"", R.drawable.img_novel_bill, comics) {
|
||||||
|
homeF?.findNavController()?.navigate(R.id.nav_rank)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
index?.results?.rankDayComics?.list?.let {
|
index?.results?.rankDayComics?.list?.let {
|
||||||
for((i, book) in it.withIndex()){
|
for((i, book) in it.withIndex()){
|
||||||
if(i > 2) break
|
if(i > 2) break
|
||||||
@@ -173,6 +186,18 @@ class HomeHandler(private val that: WeakReference<HomeFragment>) : AutoDownloadH
|
|||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun inflateHot(){
|
private suspend fun inflateHot(){
|
||||||
|
if (index?.results?.hotComics == null) {
|
||||||
|
// is in hotmanga
|
||||||
|
index?.results?.updateWeeklyFreeComics?.let {
|
||||||
|
var comics = arrayOf<ComicStructure>()
|
||||||
|
for((i, rec) in it.list.withIndex()){
|
||||||
|
if(i > 5) break
|
||||||
|
comics += rec.comic
|
||||||
|
}
|
||||||
|
if(comics.size == 6) allocateLine(homeF?.getString(R.string.hot_list)?:"", R.drawable.img_hot, comics)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
index?.results?.hotComics?.let {
|
index?.results?.hotComics?.let {
|
||||||
var comics = arrayOf<ComicStructure>()
|
var comics = arrayOf<ComicStructure>()
|
||||||
for((i, rec) in it.withIndex()){
|
for((i, rec) in it.withIndex()){
|
||||||
|
|||||||
@@ -134,12 +134,14 @@ class VMHandler(activity: ViewMangaActivity, private val chapterUrl: String, pri
|
|||||||
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 != null) {
|
||||||
if(m.results.chapter.words.size != m.results.chapter.contents.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) {
|
if(m.results.chapter.words.size != m.results.chapter.size) {
|
||||||
m.results.chapter.size = m.results.chapter.words.size // 有时 size 不对
|
m.results.chapter.size = m.results.chapter.words.size // 有时 size 不对
|
||||||
}
|
}
|
||||||
|
}
|
||||||
manga = m
|
manga = m
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -401,7 +401,7 @@ class ViewMangaActivity : TitleActivityTemplate() {
|
|||||||
//private fun getTempFile(position: Int) = File(cacheDir, "$position")
|
//private fun getTempFile(position: Int) = File(cacheDir, "$position")
|
||||||
|
|
||||||
private fun getImgUrl(position: Int) = mHandler.manga?.results?.chapter?.let {
|
private fun getImgUrl(position: Int) = mHandler.manga?.results?.chapter?.let {
|
||||||
it.contents[it.words.indexOf(position)].url
|
it.contents[it.words?.indexOf(position)?:position].url
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getImgUrlArray() = mHandler.manga?.results?.chapter?.let{
|
private fun getImgUrlArray() = mHandler.manga?.results?.chapter?.let{
|
||||||
|
|||||||
@@ -62,6 +62,7 @@
|
|||||||
<string name="touch_img_error">预载图片头失败</string>
|
<string name="touch_img_error">预载图片头失败</string>
|
||||||
<string name="analyze_img_size_error">读取图片大小失败</string>
|
<string name="analyze_img_size_error">读取图片大小失败</string>
|
||||||
|
|
||||||
|
<string name="networkApiUrl">https://%1$s/api/v3/system/network2?platform=3</string>
|
||||||
<string name="mainPageApiUrl">https://%1$s/api/v3/h5/homeIndex?platform=3</string>
|
<string name="mainPageApiUrl">https://%1$s/api/v3/h5/homeIndex?platform=3</string>
|
||||||
<string name="referUrl">https://%1$s</string>
|
<string name="referUrl">https://%1$s</string>
|
||||||
<string name="hostUrl">&hosturl;</string>
|
<string name="hostUrl">&hosturl;</string>
|
||||||
@@ -72,7 +73,7 @@
|
|||||||
<string name="bookInfoApiUrl">https://%1$s/api/v3/comic2/%2$s?platform=3</string>
|
<string name="bookInfoApiUrl">https://%1$s/api/v3/comic2/%2$s?platform=3</string>
|
||||||
<string name="bookUserQueryApiUrl">https://%1$s/api/v3/comic2/%2$s/query?platform=3</string>
|
<string name="bookUserQueryApiUrl">https://%1$s/api/v3/comic2/%2$s/query?platform=3</string>
|
||||||
<string name="groupInfoApiUrl">https://%1$s/api/v3/comic/%2$s/group/%3$s/chapters?limit=100&offset=%4$d&platform=3</string>
|
<string name="groupInfoApiUrl">https://%1$s/api/v3/comic/%2$s/group/%3$s/chapters?limit=100&offset=%4$d&platform=3</string>
|
||||||
<string name="chapterInfoApiUrl">https://%1$s/api/v3/comic/%2$s/chapter2/%3$s?platform=3</string>
|
<string name="chapterInfoApiUrl">https://%1$s/api/v3/comic/%2$s/chapter%3$s/%4$s?platform=3</string>
|
||||||
<string name="topicApiUrl">https://%1$s/api/v3/topic/%2$s?platform=3</string>
|
<string name="topicApiUrl">https://%1$s/api/v3/topic/%2$s?platform=3</string>
|
||||||
<string name="topicContentApiUrl">https://%1$s/api/v3/topic/%2$s/contents?type=%3$d&limit=21&offset=%4$d&platform=3</string>
|
<string name="topicContentApiUrl">https://%1$s/api/v3/topic/%2$s/contents?type=%3$d&limit=21&offset=%4$d&platform=3</string>
|
||||||
<string name="recommendApiUrl">https://%1$s/api/v3/recs?pos=3200102&limit=21&offset=%2$d&platform=3</string>
|
<string name="recommendApiUrl">https://%1$s/api/v3/recs?pos=3200102&limit=21&offset=%2$d&platform=3</string>
|
||||||
@@ -128,6 +129,7 @@
|
|||||||
<string name="topics_series">专题系列</string>
|
<string name="topics_series">专题系列</string>
|
||||||
<string name="manga_rec">漫画推荐</string>
|
<string name="manga_rec">漫画推荐</string>
|
||||||
<string name="rank_list">排行榜 ☟日周月 ☛冠亚季</string>
|
<string name="rank_list">排行榜 ☟日周月 ☛冠亚季</string>
|
||||||
|
<string name="hot_rank_list">本周排行</string>
|
||||||
<string name="hot_list">热门更新</string>
|
<string name="hot_list">热门更新</string>
|
||||||
<string name="new_list">全新上架</string>
|
<string name="new_list">全新上架</string>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user