1
0
mirror of https://github.com/fumiama/copymanga.git synced 2026-06-17 15:10:24 +08:00

fix: 保存封面超市导致的闪退

顺便更新 targetSdkVersion 到 34
This commit is contained in:
源文雨
2023-10-30 22:13:22 +09:00
parent 3d52eaa9d5
commit 870551a67c
3 changed files with 7 additions and 7 deletions

View File

@@ -7,7 +7,7 @@ android {
compileSdk 34 compileSdk 34
applicationId 'top.fumiama.copymanga' applicationId 'top.fumiama.copymanga'
minSdkVersion 23 minSdkVersion 23
targetSdkVersion 33 targetSdkVersion 34
versionCode 37 versionCode 37
versionName '2.0.1' versionName '2.0.1'
resConfigs 'zh', 'zh-rCN' resConfigs 'zh', 'zh-rCN'

View File

@@ -80,7 +80,7 @@ class BookHandler(private val th: WeakReference<BookFragment>, val path: String)
override fun onError() { override fun onError() {
super.onError() super.onError()
if(exit) return if(exit) return
if(!hasToastedError) { if(!hasToastedError) that?.activity?.runOnUiThread {
Toast.makeText(that?.context, R.string.null_book, Toast.LENGTH_SHORT).show() Toast.makeText(that?.context, R.string.null_book, Toast.LENGTH_SHORT).show()
that?.apply { findNavController().popBackStack() } that?.apply { findNavController().popBackStack() }
} }
@@ -318,9 +318,9 @@ class BookHandler(private val th: WeakReference<BookFragment>, val path: String)
val times = counts[i] / 100 val times = counts[i] / 100
val remain = counts[i] % 100 val remain = counts[i] % 100
val re = arrayOfNulls<VolumeStructure>(if(remain != 0) (times+1) else (times)) val re = arrayOfNulls<VolumeStructure>(if(remain != 0) (times+1) else (times))
if (re.isEmpty()) { if (re.isEmpty()) that?.activity?.runOnUiThread {
Toast.makeText(that?.context, "获取${gpw}失败", Toast.LENGTH_SHORT).show() Toast.makeText(that?.context, "获取${gpw}失败", Toast.LENGTH_SHORT).show()
return@forEachIndexed return@runOnUiThread
} }
Log.d("MyBFH", "${i}卷共${if(times == 0) 1 else times}次加载") Log.d("MyBFH", "${i}卷共${if(times == 0) 1 else times}次加载")
do { do {
@@ -393,8 +393,8 @@ class BookHandler(private val th: WeakReference<BookFragment>, val path: String)
imic.drawable.toBitmap().compress(Bitmap.CompressFormat.JPEG, 90, fo) imic.drawable.toBitmap().compress(Bitmap.CompressFormat.JPEG, 90, fo)
} catch (e: Exception) { } catch (e: Exception) {
e.printStackTrace() e.printStackTrace()
mainWeakReference?.get()?.apply { that?.activity?.runOnUiThread {
Toast.makeText(this, R.string.download_cover_error, Toast.LENGTH_SHORT).show() Toast.makeText(that?.context, R.string.download_cover_timeout, Toast.LENGTH_SHORT).show()
} }
} }
fo.close() fo.close()

View File

@@ -37,7 +37,7 @@
<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="web_error">网络错误</string> <string name="web_error">网络错误</string>
<string name="download_cover_error">保存封面出错</string> <string name="download_cover_timeout">保存封面超时</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>