mirror of
https://github.com/fumiama/copymanga.git
synced 2026-06-26 13:57:53 +08:00
v2.2.1
新增 1. 支持无网络时从下载访问漫画详情页 修复 1. 保存封面超时时间过短 2. 竖向翻页回到上一段闪退 3. 无动画阅览时加载下一页闪屏 4. 排行页快速点击tab时显示错乱 优化 1. 我的下载页的无用代码
This commit is contained in:
@@ -8,7 +8,7 @@ android {
|
|||||||
applicationId 'top.fumiama.copymanga'
|
applicationId 'top.fumiama.copymanga'
|
||||||
minSdkVersion 23
|
minSdkVersion 23
|
||||||
targetSdkVersion 34
|
targetSdkVersion 34
|
||||||
versionCode 48
|
versionCode 49
|
||||||
versionName '2.2.1'
|
versionName '2.2.1'
|
||||||
resourceConfigurations += ['zh', 'zh-rCN']
|
resourceConfigurations += ['zh', 'zh-rCN']
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
android:usesCleartextTraffic="true">
|
android:usesCleartextTraffic="true">
|
||||||
<provider
|
<provider
|
||||||
android:name="androidx.core.content.FileProvider"
|
android:name="androidx.core.content.FileProvider"
|
||||||
android:authorities="${applicationId}.fileprovider"
|
android:authorities="top.fumiama.copymanga.fileprovider"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:grantUriPermissions="true">
|
android:grantUriPermissions="true">
|
||||||
<meta-data
|
<meta-data
|
||||||
@@ -22,25 +22,24 @@
|
|||||||
android:resource="@xml/provider_paths" />
|
android:resource="@xml/provider_paths" />
|
||||||
</provider>
|
</provider>
|
||||||
<activity
|
<activity
|
||||||
android:name="${applicationId}.MainActivity"
|
android:name="top.fumiama.copymanga.MainActivity"
|
||||||
android:theme="@style/AppTheme.NoActionBar"
|
android:theme="@style/AppTheme.NoActionBar"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
<action android:name="${applicationId}.SHARE"/>
|
<action android:name="top.fumiama.copymanga.SHARE"/>
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="${applicationId}.LoginActivity"
|
android:name="top.fumiama.copymanga.LoginActivity"
|
||||||
android:theme="@style/AppTheme.NoActionBar"/>
|
android:theme="@style/AppTheme.NoActionBar"/>
|
||||||
<activity
|
<activity
|
||||||
android:name="com.yalantis.ucrop.UCropActivity"
|
android:name="com.yalantis.ucrop.UCropActivity"
|
||||||
android:screenOrientation="fullSensor"
|
|
||||||
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
|
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
|
||||||
<activity
|
<activity
|
||||||
android:name="${applicationId}.ui.vm.ViewMangaActivity"
|
android:name="top.fumiama.copymanga.ui.vm.ViewMangaActivity"
|
||||||
android:theme="@style/AppTheme.NoActionBar"/>
|
android:theme="@style/AppTheme.NoActionBar"/>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import kotlinx.android.synthetic.main.activity_main.*
|
|||||||
import kotlinx.android.synthetic.main.app_bar_main.*
|
import kotlinx.android.synthetic.main.app_bar_main.*
|
||||||
import kotlinx.android.synthetic.main.nav_header_main.*
|
import kotlinx.android.synthetic.main.nav_header_main.*
|
||||||
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.manga.Shelf
|
import top.fumiama.copymanga.manga.Shelf
|
||||||
@@ -130,7 +131,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
Log.d("MyMA", "start menu waiting")
|
Log.d("MyMA", "start menu waiting")
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
sleep(1000)
|
delay(1000)
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
isMenuWaiting = false
|
isMenuWaiting = false
|
||||||
Log.d("MyMA", "finish menu waiting")
|
Log.d("MyMA", "finish menu waiting")
|
||||||
|
|||||||
@@ -5,10 +5,13 @@ import com.google.gson.Gson
|
|||||||
import kotlinx.android.synthetic.main.card_book.*
|
import kotlinx.android.synthetic.main.card_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.launch
|
||||||
|
import kotlinx.coroutines.runBlocking
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import top.fumiama.copymanga.json.BookInfoStructure
|
import top.fumiama.copymanga.json.BookInfoStructure
|
||||||
import top.fumiama.copymanga.json.ThemeStructure
|
import top.fumiama.copymanga.json.ThemeStructure
|
||||||
import top.fumiama.copymanga.json.VolumeStructure
|
import top.fumiama.copymanga.json.VolumeStructure
|
||||||
|
import top.fumiama.copymanga.template.http.PausableDownloader
|
||||||
import top.fumiama.copymanga.tools.api.CMApi
|
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
|
||||||
@@ -107,7 +110,9 @@ class Book(val path: String, private val getString: (Int) -> String, private val
|
|||||||
mGroupPathWords.forEachIndexed { i, g ->
|
mGroupPathWords.forEachIndexed { i, g ->
|
||||||
Volume(path, g, getString) {
|
Volume(path, g, getString) {
|
||||||
return@Volume exit
|
return@Volume exit
|
||||||
}.updateChapters(mCounts[i])?.let { volumes += it }
|
}.updateChapters(mCounts[i])?.let {
|
||||||
|
volumes += it
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!exit && volumes.size == mGroupPathWords.size) {
|
if (!exit && volumes.size == mGroupPathWords.size) {
|
||||||
@@ -127,9 +132,11 @@ class Book(val path: String, private val getString: (Int) -> String, private val
|
|||||||
File(mangaFolder, "info.json").writeText(mJsonString)
|
File(mangaFolder, "info.json").writeText(mJsonString)
|
||||||
File(mangaFolder, "grps.json").writeText(Gson().toJson(mKeys))
|
File(mangaFolder, "grps.json").writeText(Gson().toJson(mKeys))
|
||||||
(cover?.let { CMApi.proxy?.wrap(it) } ?:cover)?.let {
|
(cover?.let { CMApi.proxy?.wrap(it) } ?:cover)?.let {
|
||||||
DownloadTools.getHttpContent(it, null, mUserAgent)
|
Thread {
|
||||||
}?.let { data ->
|
DownloadTools.getHttpContent(it, -1)?.let { data ->
|
||||||
File(mangaFolder, "head.jpg").writeBytes(data)
|
File(mangaFolder, "head.jpg").writeBytes(data)
|
||||||
|
}
|
||||||
|
}.start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import androidx.lifecycle.LifecycleOwner
|
|||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
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.Companion.mainWeakReference
|
import top.fumiama.copymanga.MainActivity.Companion.mainWeakReference
|
||||||
@@ -94,13 +95,13 @@ open class AutoDownloadHandler(
|
|||||||
}
|
}
|
||||||
fi.close()
|
fi.close()
|
||||||
if(!pass) {
|
if(!pass) {
|
||||||
sleep(2000)
|
delay(2000)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
sleep(2000)
|
delay(2000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package top.fumiama.copymanga.template.http
|
|||||||
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import top.fumiama.copymanga.MainActivity.Companion.mainWeakReference
|
import top.fumiama.copymanga.MainActivity.Companion.mainWeakReference
|
||||||
import top.fumiama.copymanga.tools.http.DownloadTools
|
import top.fumiama.copymanga.tools.http.DownloadTools
|
||||||
@@ -23,7 +24,7 @@ class PausableDownloader(private val url: String, private val waitMilliseconds:
|
|||||||
break
|
break
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
if (waitMilliseconds > 0) sleep(200+Random.nextLong(waitMilliseconds))
|
if (waitMilliseconds > 0) delay(200+Random.nextLong(waitMilliseconds))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log.d("MyPD", "found exit = $exit")
|
Log.d("MyPD", "found exit = $exit")
|
||||||
|
|||||||
@@ -73,11 +73,18 @@ class BookFragment: NoBackRefreshFragment(R.layout.fragment_book) {
|
|||||||
return@launch
|
return@launch
|
||||||
}
|
}
|
||||||
Log.d("MyBF", "read path: ${book?.path}")
|
Log.d("MyBF", "read path: ${book?.path}")
|
||||||
for (i in 1..4) {
|
for (i in 1..3) {
|
||||||
mBookHandler?.sendEmptyMessageDelayed(i, (100*i).toLong())
|
mBookHandler?.sendEmptyMessage(i)
|
||||||
}
|
}
|
||||||
book?.updateVolumes {
|
try {
|
||||||
mBookHandler?.sendEmptyMessage(10)
|
book?.updateVolumes {
|
||||||
|
mBookHandler?.sendEmptyMessage(10)
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
Toast.makeText(context, R.string.null_volume, Toast.LENGTH_SHORT).show()
|
||||||
|
findNavController().popBackStack()
|
||||||
|
return@launch
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import kotlinx.android.synthetic.main.line_caption.view.*
|
|||||||
import kotlinx.android.synthetic.main.line_chapter.view.*
|
import kotlinx.android.synthetic.main.line_chapter.view.*
|
||||||
import kotlinx.android.synthetic.main.page_nested_list.view.*
|
import kotlinx.android.synthetic.main.page_nested_list.view.*
|
||||||
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.Companion.mainWeakReference
|
import top.fumiama.copymanga.MainActivity.Companion.mainWeakReference
|
||||||
@@ -83,7 +84,7 @@ class BookHandler(private val th: WeakReference<BookFragment>): Handler(Looper.m
|
|||||||
if (book?.cover != null)
|
if (book?.cover != null)
|
||||||
GlideUrl(CMApi.proxy?.wrap(book?.cover!!)?:book?.cover!!, CMApi.myGlideHeaders)
|
GlideUrl(CMApi.proxy?.wrap(book?.cover!!)?:book?.cover!!, CMApi.myGlideHeaders)
|
||||||
else book?.cachedCover
|
else book?.cachedCover
|
||||||
).timeout(10000).addListener(GlideHideLottieViewListener(WeakReference(laic)))
|
).addListener(GlideHideLottieViewListener(WeakReference(laic)))
|
||||||
load.into(imic)
|
load.into(imic)
|
||||||
context?.let { it1 -> GlideBlurTransformation(it1) }
|
context?.let { it1 -> GlideBlurTransformation(it1) }
|
||||||
?.let { it2 -> RequestOptions.bitmapTransform(it2) }
|
?.let { it2 -> RequestOptions.bitmapTransform(it2) }
|
||||||
@@ -199,7 +200,7 @@ class BookHandler(private val th: WeakReference<BookFragment>): Handler(Looper.m
|
|||||||
val f = CMApi.getZipFile(context?.getExternalFilesDir(""), comicName, keys[p], it.name)
|
val f = CMApi.getZipFile(context?.getExternalFilesDir(""), comicName, keys[p], it.name)
|
||||||
//Log.d("MyBH", "i = $i, last=$last, add chapter ${it.name}, line is null: ${line == null}")
|
//Log.d("MyBH", "i = $i, last=$last, add chapter ${it.name}, line is null: ${line == null}")
|
||||||
that?.isOnPause?.let { isOnPause ->
|
that?.isOnPause?.let { isOnPause ->
|
||||||
while (isOnPause && !exit) sleep(500)
|
while (isOnPause && !exit) delay(500)
|
||||||
if (exit) return@withContext
|
if (exit) return@withContext
|
||||||
}?:return@withContext
|
}?:return@withContext
|
||||||
if(line == null) {
|
if(line == null) {
|
||||||
@@ -260,7 +261,7 @@ class BookHandler(private val th: WeakReference<BookFragment>): Handler(Looper.m
|
|||||||
chapterNames += it.name
|
chapterNames += it.name
|
||||||
ViewMangaActivity.uuidArray += it.uuid
|
ViewMangaActivity.uuidArray += it.uuid
|
||||||
that?.isOnPause?.let { isOnPause ->
|
that?.isOnPause?.let { isOnPause ->
|
||||||
while (isOnPause && !exit) sleep(500)
|
while (isOnPause && !exit) delay(500)
|
||||||
if (exit) return@withContext
|
if (exit) return@withContext
|
||||||
}?:return@withContext
|
}?:return@withContext
|
||||||
i++
|
i++
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.google.android.material.tabs.TabLayout
|
|||||||
import kotlinx.android.synthetic.main.fragment_rank.*
|
import kotlinx.android.synthetic.main.fragment_rank.*
|
||||||
import kotlinx.android.synthetic.main.line_rank.view.*
|
import kotlinx.android.synthetic.main.line_rank.view.*
|
||||||
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.template.ui.InfoCardLoader
|
import top.fumiama.copymanga.template.ui.InfoCardLoader
|
||||||
@@ -75,7 +76,7 @@ class RankFragment : InfoCardLoader(R.layout.fragment_rank, R.id.action_nav_rank
|
|||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
isLoading = true
|
isLoading = true
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
sleep(400)
|
delay(400)
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
reset()
|
reset()
|
||||||
addPage()
|
addPage()
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import androidx.navigation.fragment.findNavController
|
|||||||
import kotlinx.android.synthetic.main.anchor_popular.view.*
|
import kotlinx.android.synthetic.main.anchor_popular.view.*
|
||||||
import kotlinx.android.synthetic.main.line_shelf.*
|
import kotlinx.android.synthetic.main.line_shelf.*
|
||||||
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
|
||||||
@@ -122,7 +123,7 @@ class ShelfFragment : InfoCardLoader(R.layout.fragment_shelf, R.id.action_nav_su
|
|||||||
private fun resetDelayed() {
|
private fun resetDelayed() {
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
sleep(400)
|
delay(400)
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
reset()
|
reset()
|
||||||
addPage()
|
addPage()
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.google.gson.Gson
|
|||||||
import kotlinx.android.synthetic.main.anchor_popular.view.*
|
import kotlinx.android.synthetic.main.anchor_popular.view.*
|
||||||
import kotlinx.android.synthetic.main.line_sort.*
|
import kotlinx.android.synthetic.main.line_sort.*
|
||||||
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.json.FilterStructure
|
import top.fumiama.copymanga.json.FilterStructure
|
||||||
@@ -69,7 +70,7 @@ class SortFragment : StatusCardFlow(0, R.id.action_nav_sort_to_nav_book, R.layou
|
|||||||
private fun suspendReset() {
|
private fun suspendReset() {
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
sleep(400)
|
delay(400)
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
reset()
|
reset()
|
||||||
addPage()
|
addPage()
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import androidx.navigation.fragment.findNavController
|
|||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import kotlinx.android.synthetic.main.fragment_dlcomic.*
|
import kotlinx.android.synthetic.main.fragment_dlcomic.*
|
||||||
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.json.VolumeStructure
|
import top.fumiama.copymanga.json.VolumeStructure
|
||||||
@@ -30,7 +31,7 @@ class ComicDlFragment: NoBackRefreshFragment(R.layout.fragment_dlcomic) {
|
|||||||
arguments?.getBoolean("callFromOldDL", false) == true -> initOldComicData()
|
arguments?.getBoolean("callFromOldDL", false) == true -> initOldComicData()
|
||||||
arguments?.containsKey("loadJson") == true -> context?.getExternalFilesDir("")?.let { home ->
|
arguments?.containsKey("loadJson") == true -> context?.getExternalFilesDir("")?.let { home ->
|
||||||
arguments?.getString("name")?.let {
|
arguments?.getString("name")?.let {
|
||||||
sleep(600)
|
delay(600)
|
||||||
Log.d("MyCDF", "loadJson by arguments")
|
Log.d("MyCDF", "loadJson by arguments")
|
||||||
start2load(
|
start2load(
|
||||||
loadFromJson(arguments?.getString("loadJson")!!),
|
loadFromJson(arguments?.getString("loadJson")!!),
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import kotlinx.android.synthetic.main.fragment_home.*
|
|||||||
import kotlinx.android.synthetic.main.line_word.view.*
|
import kotlinx.android.synthetic.main.line_word.view.*
|
||||||
import kotlinx.android.synthetic.main.viewpage_horizonal.view.*
|
import kotlinx.android.synthetic.main.viewpage_horizonal.view.*
|
||||||
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
|
||||||
@@ -163,10 +164,10 @@ class HomeFragment : NoBackRefreshFragment(R.layout.fragment_home) {
|
|||||||
lifecycleScope.launch{
|
lifecycleScope.launch{
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
homeHandler.obtainMessage(-1, true).sendToTarget()
|
homeHandler.obtainMessage(-1, true).sendToTarget()
|
||||||
while(!MainActivity.isDrawerClosed) sleep(233)
|
while(!MainActivity.isDrawerClosed) delay(233)
|
||||||
//homeHandler.sendEmptyMessage(6) //removeAllViews
|
//homeHandler.sendEmptyMessage(6) //removeAllViews
|
||||||
homeHandler.fhib = null
|
homeHandler.fhib = null
|
||||||
sleep(600)
|
delay(600)
|
||||||
homeHandler.startLoad()
|
homeHandler.startLoad()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -196,7 +197,7 @@ class HomeFragment : NoBackRefreshFragment(R.layout.fragment_home) {
|
|||||||
//Log.d("MyHomeFVP", "Load img: $it")
|
//Log.d("MyHomeFVP", "Load img: $it")
|
||||||
Glide.with(this@HomeFragment).load(
|
Glide.with(this@HomeFragment).load(
|
||||||
GlideUrl(CMApi.proxy?.wrap(it)?:it, CMApi.myGlideHeaders)
|
GlideUrl(CMApi.proxy?.wrap(it)?:it, CMApi.myGlideHeaders)
|
||||||
).addListener(GlideHideLottieViewListener(WeakReference(holder.itemView.lai))).timeout(10000).into(holder.itemView.vpi)
|
).addListener(GlideHideLottieViewListener(WeakReference(holder.itemView.lai))).into(holder.itemView.vpi)
|
||||||
}
|
}
|
||||||
holder.itemView.vpt.text = thisBanner?.brief
|
holder.itemView.vpt.text = thisBanner?.brief
|
||||||
holder.itemView.vpc.setOnClickListener {
|
holder.itemView.vpc.setOnClickListener {
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import kotlinx.android.synthetic.main.card_book.view.*
|
|||||||
import kotlinx.android.synthetic.main.fragment_home.*
|
import kotlinx.android.synthetic.main.fragment_home.*
|
||||||
import kotlinx.android.synthetic.main.line_1bookline.view.*
|
import kotlinx.android.synthetic.main.line_1bookline.view.*
|
||||||
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.json.ComicStructure
|
import top.fumiama.copymanga.json.ComicStructure
|
||||||
@@ -36,6 +37,7 @@ import top.fumiama.copymanga.tools.ui.UITools
|
|||||||
import top.fumiama.dmzj.copymanga.R
|
import top.fumiama.dmzj.copymanga.R
|
||||||
import java.lang.Thread.sleep
|
import java.lang.Thread.sleep
|
||||||
import java.lang.ref.WeakReference
|
import java.lang.ref.WeakReference
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger
|
||||||
|
|
||||||
class HomeHandler(private val that: WeakReference<HomeFragment>) : AutoDownloadHandler(
|
class HomeHandler(private val that: WeakReference<HomeFragment>) : AutoDownloadHandler(
|
||||||
that.get()?.getString(R.string.mainPageApiUrl)!!.format(CMApi.myHostApiUrl),
|
that.get()?.getString(R.string.mainPageApiUrl)!!.format(CMApi.myHostApiUrl),
|
||||||
@@ -225,7 +227,7 @@ class HomeHandler(private val that: WeakReference<HomeFragment>) : AutoDownloadH
|
|||||||
inflateRank()
|
inflateRank()
|
||||||
for(i in indexLines.indices) {
|
for(i in indexLines.indices) {
|
||||||
obtainMessage(8, i, 0).sendToTarget()
|
obtainMessage(8, i, 0).sendToTarget()
|
||||||
sleep(512)
|
delay(512)
|
||||||
}
|
}
|
||||||
obtainMessage(-1, false).sendToTarget() //closeLoad
|
obtainMessage(-1, false).sendToTarget() //closeLoad
|
||||||
}
|
}
|
||||||
@@ -271,7 +273,7 @@ class HomeHandler(private val that: WeakReference<HomeFragment>) : AutoDownloadH
|
|||||||
//fhib = null
|
//fhib = null
|
||||||
indexLines = arrayOf()
|
indexLines = arrayOf()
|
||||||
this@HomeHandler.sendEmptyMessage(6) //removeAllViews
|
this@HomeHandler.sendEmptyMessage(6) //removeAllViews
|
||||||
sleep(300)
|
delay(300)
|
||||||
this@HomeHandler.sendEmptyMessage(0) //setLayouts
|
this@HomeHandler.sendEmptyMessage(0) //setLayouts
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -319,13 +321,21 @@ class HomeHandler(private val that: WeakReference<HomeFragment>) : AutoDownloadH
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var cardLoadingWaits = AtomicInteger()
|
||||||
|
|
||||||
private suspend fun setCards(cv: CardView, pw: String, name: String, img: String, isFinal: Boolean, isTopic: Boolean) = withContext(Dispatchers.Main) {
|
private suspend fun setCards(cv: CardView, pw: String, name: String, img: String, isFinal: Boolean, isTopic: Boolean) = withContext(Dispatchers.Main) {
|
||||||
cv.tic.text = name
|
cv.tic.text = name
|
||||||
homeF?.let {
|
homeF?.let {
|
||||||
if(img.startsWith("http")) {
|
if(img.startsWith("http")) {
|
||||||
Glide.with(it).load(GlideUrl(CMApi.proxy?.wrap(img)?:img, CMApi.myGlideHeaders))
|
Log.d("MyHH", "load card image: $img")
|
||||||
.addListener(GlideHideLottieViewListener(WeakReference(cv.laic)))
|
val waitMillis = cardLoadingWaits.getAndIncrement().toLong()*200
|
||||||
.timeout(20000).into(cv.imic)
|
val g = Glide.with(it).load(GlideUrl(CMApi.proxy?.wrap(img)?:img, CMApi.myGlideHeaders))
|
||||||
|
.addListener(GlideHideLottieViewListener(WeakReference(cv.laic)) {
|
||||||
|
cardLoadingWaits.decrementAndGet()
|
||||||
|
})
|
||||||
|
if (waitMillis > 0) cv.imic.postDelayed({
|
||||||
|
g.into(cv.imic)
|
||||||
|
}, waitMillis) else g.into(cv.imic)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isFinal) cv.sgnic.visibility = View.VISIBLE
|
if (isFinal) cv.sgnic.visibility = View.VISIBLE
|
||||||
|
|||||||
@@ -7,22 +7,30 @@ import android.util.Log
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.Window
|
import android.view.Window
|
||||||
import androidx.annotation.Keep
|
import androidx.annotation.Keep
|
||||||
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.preference.EditTextPreference
|
import androidx.preference.EditTextPreference
|
||||||
import androidx.preference.EditTextPreferenceDialogFragmentCompat
|
import androidx.preference.EditTextPreferenceDialogFragmentCompat
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.async
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
import top.fumiama.copymanga.tools.ui.UITools
|
import top.fumiama.copymanga.tools.ui.UITools
|
||||||
import top.fumiama.dmzj.copymanga.R
|
import top.fumiama.dmzj.copymanga.R
|
||||||
import java.lang.Thread.sleep
|
import java.lang.Thread.sleep
|
||||||
|
|
||||||
class SettingsFragment: PreferenceFragmentCompat() {
|
class SettingsFragment: PreferenceFragmentCompat() {
|
||||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||||
Thread {
|
lifecycleScope.launch {
|
||||||
sleep(300)
|
withContext(Dispatchers.IO) {
|
||||||
activity?.runOnUiThread {
|
delay(300)
|
||||||
setPreferencesFromResource(R.xml.pref_setting, rootKey)
|
withContext(Dispatchers.Main) {
|
||||||
|
setPreferencesFromResource(R.xml.pref_setting, rootKey)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}.start()
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
|||||||
@@ -245,14 +245,14 @@ class ViewMangaActivity : TitleActivityTemplate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ExperimentalStdlibApi
|
@ExperimentalStdlibApi
|
||||||
private fun doPrepareWebImg() {
|
private fun doPrepareWebImg() = Thread {
|
||||||
getImgUrlArray()?.apply {
|
getImgUrlArray()?.apply {
|
||||||
if(cut) {
|
if(cut) {
|
||||||
Log.d("MyVM", "is cut, load all pages...")
|
Log.d("MyVM", "is cut, load all pages...")
|
||||||
handler.sendEmptyMessage(VMHandler.DIALOG_SHOW) //showDl
|
handler.sendEmptyMessage(VMHandler.DIALOG_SHOW) //showDl
|
||||||
isCut = BooleanArray(size)
|
isCut = BooleanArray(size)
|
||||||
val analyzedCnt = BooleanArray(size)
|
val analyzedCnt = BooleanArray(size)
|
||||||
forEachIndexed{ i, it ->
|
forEachIndexed { i, it ->
|
||||||
if(it != null) {
|
if(it != null) {
|
||||||
Thread{
|
Thread{
|
||||||
DownloadTools.getHttpContent(CMApi.resolution.wrap(CMApi.proxy?.wrap(it)?:it), 1024)?.inputStream()?.let {
|
DownloadTools.getHttpContent(CMApi.resolution.wrap(CMApi.proxy?.wrap(it)?:it), 1024)?.inputStream()?.let {
|
||||||
@@ -276,7 +276,7 @@ class ViewMangaActivity : TitleActivityTemplate() {
|
|||||||
runOnUiThread { prepareItems() }
|
runOnUiThread { prepareItems() }
|
||||||
if (notUseVP) prepareDownloadTasks()
|
if (notUseVP) prepareDownloadTasks()
|
||||||
}
|
}
|
||||||
}
|
}.start()
|
||||||
|
|
||||||
@OptIn(ExperimentalStdlibApi::class)
|
@OptIn(ExperimentalStdlibApi::class)
|
||||||
fun initManga() {
|
fun initManga() {
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
<string name="load_home_error">加载主页控件出错</string>
|
<string name="load_home_error">加载主页控件出错</string>
|
||||||
<string name="text_null">N/A</string>
|
<string name="text_null">N/A</string>
|
||||||
<string name="null_book">获取图书信息失败</string>
|
<string name="null_book">获取图书信息失败</string>
|
||||||
|
<string name="null_volume">获取图书分卷失败</string>
|
||||||
<string name="web_error">网络错误</string>
|
<string name="web_error">网络错误</string>
|
||||||
<string name="download_cover_failed">保存封面失败</string>
|
<string name="download_cover_failed">保存封面失败</string>
|
||||||
<string name="download_cover_timeout">保存封面超时</string>
|
<string name="download_cover_timeout">保存封面超时</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user