Skip to content

Commit 555d78a

Browse files
committed
v1.5.2
新增 1. 检测更新 修复 1. 漫画阅读页点击配置黑屏 优化 1. 隐藏搜索页 ranobe 升级 1. SDK 版本到 36
1 parent dbb0b9d commit 555d78a

36 files changed

+892
-530
lines changed

.idea/.name

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/dictionaries/fumiama.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/kotlinc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
plugins {
22
id 'com.android.application'
33
id 'kotlin-android'
4-
id 'kotlin-android-extensions'
54
id 'kotlin-kapt'
65
}
76

87
android {
98
defaultConfig {
10-
compileSdk 34
9+
compileSdk 36
1110
applicationId "top.fumiama.copymangaweb"
1211
minSdkVersion 23
13-
//noinspection OldTargetApi
14-
targetSdkVersion 34
15-
versionCode 14
16-
versionName '1.5.1'
12+
targetSdkVersion 36
13+
versionCode 15
14+
versionName '1.5.2'
1715
resConfigs "zh", "zh-rCN"
1816

1917
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -67,6 +65,9 @@ android {
6765
viewBinding {
6866
enabled = true
6967
}
68+
dataBinding {
69+
enable = true
70+
}
7071
bundle{
7172
density{
7273
enableSplit = true
@@ -96,7 +97,9 @@ if (propFile.canRead()){
9697
dependencies {
9798
implementation fileTree(dir: "libs", include: ["*.jar"])
9899
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
99-
implementation 'androidx.core:core-ktx:1.12.0'
100+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"
101+
implementation 'androidx.core:core-ktx:1.16.0'
102+
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.9.1'
100103
implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
101104
implementation 'androidx.cardview:cardview:1.0.0'
102105
implementation 'androidx.viewpager2:viewpager2:1.1.0'
@@ -106,4 +109,5 @@ dependencies {
106109
implementation 'com.github.bumptech.glide:glide:4.16.0'
107110
annotationProcessor 'com.github.bumptech.glide:compiler:4.16.0'
108111
implementation 'com.google.code.gson:gson:2.13.1'
112+
implementation 'top.fumiama:sdict:0.1.1'
109113
}

app/src/main/AndroidManifest.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,23 @@
22

33
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
44
<uses-permission android:name="android.permission.INTERNET" />
5+
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
56
<application
67
android:allowBackup="true"
78
android:icon="@mipmap/ic_launcher"
89
android:label="@string/app_name"
910
android:roundIcon="@mipmap/ic_launcher"
1011
android:supportsRtl="true"
1112
android:theme="@style/AppTheme" >
13+
<provider
14+
android:name="androidx.core.content.FileProvider"
15+
android:authorities="top.fumiama.copymangaweb.fileprovider"
16+
android:exported="false"
17+
android:grantUriPermissions="true">
18+
<meta-data
19+
android:name="android.support.FILE_PROVIDER_PATHS"
20+
android:resource="@xml/provider_paths" />
21+
</provider>
1222
<activity android:name=".activity.MainActivity" android:exported="true">
1323
<intent-filter>
1424
<action android:name="android.intent.action.MAIN" />

app/src/main/assets/i.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ if (typeof (loaded) == "undefined") {
4949
invoke.hideRanobeTab();
5050
invoke.hideRanobeRack();
5151
}
52+
else if (url.indexOf("/searchContent") > 0) {
53+
invoke.hideRanobeRack();
54+
}
5255
else if (url.indexOf("/comicContent/") > 0) setTimeout(function () { invoke.loadChapter() }, 1000);
5356
else if (url.indexOf("/details/comic/") > 0) GM.loadComic(url);
5457
else if (url.indexOf("/personal") > 0) {

app/src/main/java/top/fumiama/copymangaweb/activity/DlActivity.kt

Lines changed: 73 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,11 @@ import android.os.Looper
88
import android.view.View
99
import android.view.ViewGroup
1010
import android.view.ViewTreeObserver
11+
import android.widget.LinearLayout
12+
import android.widget.TextView
1113
import android.widget.Toast
1214
import android.widget.ToggleButton
1315
import com.google.gson.Gson
14-
import kotlinx.android.synthetic.main.activity_dl.*
15-
import kotlinx.android.synthetic.main.button_tbutton.view.*
16-
import kotlinx.android.synthetic.main.line_caption.view.*
17-
import kotlinx.android.synthetic.main.line_horizonal.view.*
18-
import kotlinx.android.synthetic.main.widget_downloadbar.*
19-
import kotlinx.android.synthetic.main.widget_titlebar.*
2016
import top.fumiama.copymangaweb.R
2117
import top.fumiama.copymangaweb.activity.MainActivity.Companion.mh
2218
import top.fumiama.copymangaweb.activity.template.ToolsBoxActivity
@@ -33,6 +29,7 @@ import java.io.File
3329
import java.lang.Thread.sleep
3430

3531
class DlActivity : ToolsBoxActivity() {
32+
lateinit var mBinding: ActivityDlBinding
3633
private var tbtncnt = 0
3734
private var isNewTitle = false
3835
var haveSElectAll = false
@@ -52,11 +49,11 @@ class DlActivity : ToolsBoxActivity() {
5249
@SuppressLint("SetTextI18n")
5350
override fun onCreate(savedInstanceState: Bundle?) {
5451
super.onCreate(savedInstanceState)
55-
val binding = ActivityDlBinding.inflate(layoutInflater)
56-
setContentView(binding.root)
52+
mBinding = ActivityDlBinding.inflate(layoutInflater)
53+
setContentView(mBinding.root)
5754
mh?.saveUrlsOnly = true
5855
mangaDlTools = MangaDlTools(this)
59-
dwh.apply { post {
56+
mBinding.dwh.apply { post {
6057
settings.userAgentString = getString(R.string.pc_ua)
6158
webChromeClient = WebChromeClient()
6259
setWebViewClient("h.js")
@@ -72,16 +69,24 @@ class DlActivity : ToolsBoxActivity() {
7269
super.onDestroy()
7370
}
7471

75-
private fun showDlCard(){
76-
//ObjectAnimator.ofFloat(csdwn, "alpha", 0.3f, 0.9f).setDuration(233).start()
77-
ObjectAnimator.ofFloat(csdwn, "translationX", cdwnWidth.toFloat() * 0.9f, 0f).setDuration(
72+
private fun showDlCard() {
73+
ObjectAnimator.ofFloat(
74+
mBinding.dldlbar.csdwn,
75+
"translationX",
76+
cdwnWidth.toFloat() * 0.9f,
77+
0f
78+
).setDuration(
7879
233
7980
).start()
8081
}
8182

82-
private fun hideDlCard(){
83-
//ObjectAnimator.ofFloat(csdwn, "alpha", 0.9f, 0.3f).setDuration(233).start()
84-
ObjectAnimator.ofFloat(csdwn, "translationX", 0f, cdwnWidth.toFloat() * 0.9f).setDuration(
83+
private fun hideDlCard() {
84+
ObjectAnimator.ofFloat(
85+
mBinding.dldlbar.csdwn,
86+
"translationX",
87+
0f,
88+
cdwnWidth.toFloat() * 0.9f
89+
).setDuration(
8590
233
8691
).start()
8792
}
@@ -112,28 +117,28 @@ class DlActivity : ToolsBoxActivity() {
112117

113118
@SuppressLint("SetTextI18n")
114119
fun setLayouts() {
115-
ttitle.apply { post { text = comicName } }
120+
mBinding.dtitle.ttitle.apply { post { text = comicName } }
116121
val widthData = toolsBox.calcWidthFromDp(8, 64)
117122
btnNumPerRow = widthData[0]
118123
btnw = widthData[1]
119-
csdwn.apply { post { viewTreeObserver.addOnGlobalLayoutListener(object :
124+
mBinding.dldlbar.csdwn.apply { post { viewTreeObserver.addOnGlobalLayoutListener(object :
120125
ViewTreeObserver.OnGlobalLayoutListener {
121126
override fun onGlobalLayout() {
122-
cdwnWidth = csdwn.width
127+
cdwnWidth = width
123128
viewTreeObserver.removeOnGlobalLayoutListener(this)
124129
}
125130
}) } }
126-
dllazys.onScrollListener = object : LazyScrollView.OnScrollListener {
131+
mBinding.dllazys.onScrollListener = object : LazyScrollView.OnScrollListener {
127132
override fun onBottom() {}
128-
override fun onScroll() { if (csdwn.translationX == 0f) hideDlCard() }
133+
override fun onScroll() { if (mBinding.dldlbar.csdwn.translationX == 0f) hideDlCard() }
129134
override fun onTop() {}
130135
}
131-
cdwn.let { it.post {
136+
mBinding.dldlbar.cdwn.let { it.post {
132137
it.setOnClickListener {
133-
if (csdwn.translationX != 0f) showDlCard()
138+
if (mBinding.dldlbar.csdwn.translationX != 0f) showDlCard()
134139
else if (checkedChapter == 0) hideDlCard()
135140
else {
136-
pdwn.progress = 0
141+
mBinding.dldlbar.pdwn.progress = 0
137142
if (canDl || checkedChapter == 0) canDl = false
138143
else {
139144
haveDlStarted = true
@@ -152,7 +157,9 @@ class DlActivity : ToolsBoxActivity() {
152157
return@setOnLongClickListener true
153158
}
154159
} }
155-
isearch.apply { post { setOnClickListener { showMultiSelectInfo() } } }
160+
mBinding.dtitle.isearch.apply { post {
161+
setOnClickListener { showMultiSelectInfo() }
162+
} }
156163
Thread{ analyzeStructure() }.start()
157164
}
158165

@@ -165,9 +172,9 @@ class DlActivity : ToolsBoxActivity() {
165172
ViewMangaActivity.zipList = arrayOf()
166173
Gson().fromJson(json?.reader(), Array<ComicStructure>::class.java)?.let {
167174
for (group in it) {
168-
val tc = layoutInflater.inflate(R.layout.line_caption, ldwn, false)
169-
tc.tcptn.text = group.name
170-
ldwn.apply { post {
175+
val tc = layoutInflater.inflate(R.layout.line_caption, mBinding.ldwn, false)
176+
tc.findViewById<TextView>(R.id.tcptn).text = group.name
177+
mBinding.ldwn.apply { post {
171178
addView(
172179
tc,
173180
ViewGroup.LayoutParams(
@@ -176,7 +183,7 @@ class DlActivity : ToolsBoxActivity() {
176183
)
177184
)
178185
addView(
179-
layoutInflater.inflate(R.layout.div_h, ldwn, false),
186+
layoutInflater.inflate(R.layout.div_h, mBinding.ldwn, false),
180187
ViewGroup.LayoutParams(
181188
ViewGroup.LayoutParams.MATCH_PARENT,
182189
ViewGroup.LayoutParams.WRAP_CONTENT
@@ -227,53 +234,60 @@ class DlActivity : ToolsBoxActivity() {
227234
@SuppressLint("SetTextI18n")
228235
fun addToggleButton(title: String, url: String, caption: String) {
229236
if ((tbtncnt % btnNumPerRow == 0) || isNewTitle) {
230-
toggleButtonLine = layoutInflater.inflate(R.layout.line_horizonal, ldwn, false)
231-
ldwn.apply {
237+
toggleButtonLine = layoutInflater.inflate(R.layout.line_horizonal, mBinding.ldwn, false)
238+
mBinding.ldwn.apply {
232239
val t = toggleButtonLine
233240
post { addView(t) }
234241
}
235242
tbtncnt = 0
236243
isNewTitle = false
237244
}
238-
val tbv = layoutInflater.inflate(R.layout.button_tbutton, toggleButtonLine.ltbtn, false)
239-
tbv.tbtn.index = tbtnlist.size
240-
tbtnlist += tbv.tbtn
241-
tbv.tbtn.url = url
245+
val tbv = layoutInflater.inflate(R.layout.button_tbutton, toggleButtonLine.findViewById(R.id.ltbtn), false)
246+
val tbvTbtn = tbv.findViewById<ChapterToggleButton>(R.id.tbtn)?:return
247+
tbvTbtn.index = tbtnlist.size
248+
tbtnlist += tbvTbtn
249+
tbvTbtn.url = url
242250
tbtncnt++
243251
val zipPosition = ViewMangaActivity.zipList?.size
244252
ViewMangaActivity.zipList = ViewMangaActivity.zipList?.plus("$title.zip")
245-
tbv.tbtn.textOff = title
246-
tbv.tbtn.textOn = title
247-
tbv.tbtn.text = title
248-
tbv.tbtn.hint = caption
249-
tbv.tbtn.layoutParams.width = btnw
253+
tbvTbtn.textOff = title
254+
tbvTbtn.textOn = title
255+
tbvTbtn.text = title
256+
tbvTbtn.hint = caption
257+
tbvTbtn.layoutParams.width = btnw
250258
val zipFile = File("${getExternalFilesDir("")}/$comicName/$caption/$title.zip")
251259
if (zipFile.exists()) {
252-
tbv.tbtn.setBackgroundResource(R.drawable.rndbg_checked)
253-
tbv.tbtn.isChecked = false
254-
tbv.tbtn.freezesText = true
260+
tbvTbtn.setBackgroundResource(R.drawable.rndbg_checked)
261+
tbvTbtn.isChecked = false
262+
tbvTbtn.freezesText = true
255263
}
256264
toggleButtonLine.apply { post {
257-
ltbtn.addView(tbv)
265+
findViewById<LinearLayout>(R.id.ltbtn)?.addView(tbv)
258266
invalidate()
259267
} }
260-
tbv.tbtn.setOnClickListener { v ->
268+
tbvTbtn.setOnClickListener { v ->
261269
val normalAct = (multiSelect && zipFile.exists()) || !zipFile.exists()
262-
if (zipFile.exists() && !v.tbtn.isChecked) v.tbtn.apply { post { setBackgroundResource(R.drawable.rndbg_checked) } }
263-
else if(normalAct) v.tbtn.apply { post { setBackgroundResource(R.drawable.toggle_button) } }
270+
val tbtn = v.findViewById<ChapterToggleButton>(R.id.tbtn)?:return@setOnClickListener
271+
if (zipFile.exists() && !tbtn.isChecked) tbtn.apply { post { setBackgroundResource(R.drawable.rndbg_checked) } }
272+
else if(normalAct) tbtn.apply { post { setBackgroundResource(R.drawable.toggle_button) } }
264273
if (normalAct) {
265-
if (v.tbtn.isChecked) tdwn.apply { post { text = "$dldChapter/${++checkedChapter}" } }
266-
else tdwn.apply { post { text = "$dldChapter/${--checkedChapter}" } }
267-
} else if(v.tbtn.isChecked) {
268-
v.tbtn.apply { post {
274+
mBinding.dldlbar.tdwn.apply {
275+
if (tbtn.isChecked) post {
276+
text = "$dldChapter/${++checkedChapter}"
277+
} else post {
278+
text = "$dldChapter/${--checkedChapter}"
279+
}
280+
}
281+
} else if(tbtn.isChecked) {
282+
tbtn.apply { post {
269283
isChecked = false
270284
zipPosition?.let { Thread {
271285
callVM(title, zipFile, it)
272286
}.start() }
273287
} }
274288
}
275289
}
276-
tbv.tbtn.setOnLongClickListener {
290+
tbvTbtn.setOnLongClickListener {
277291
if (zipFile.exists()) {
278292
toolsBox.buildInfo("确认删除这些章节?",
279293
"该操作将不可撤销",
@@ -282,8 +296,10 @@ class DlActivity : ToolsBoxActivity() {
282296
"取消",
283297
{
284298
if (checkedChapter == 0) {
285-
it.tbtn.apply { post { isChecked = true } }
286-
tdwn.apply { post { text = "$dldChapter/${++checkedChapter}" } }
299+
tbvTbtn.apply { post { isChecked = true } }
300+
mBinding.dldlbar.tdwn.apply { post {
301+
text = "$dldChapter/${++checkedChapter}"
302+
} }
287303
}
288304
handler.sendEmptyMessage(7)
289305
})
@@ -324,7 +340,9 @@ class DlActivity : ToolsBoxActivity() {
324340

325341
@SuppressLint("SetTextI18n")
326342
fun updateProgressBar() {
327-
tdwn.apply { post { text = "${++dldChapter}/$checkedChapter" } }
343+
mBinding.dldlbar.tdwn.apply { post {
344+
text = "${++dldChapter}/$checkedChapter"
345+
} }
328346
setProgress2(dldChapter * 100 / checkedChapter, 233)
329347
}
330348

@@ -336,6 +354,7 @@ class DlActivity : ToolsBoxActivity() {
336354
}
337355

338356
fun setProgress2(end: Int, duration: Long) {
357+
val pdwn = mBinding.dldlbar.pdwn
339358
ObjectAnimator.ofInt(
340359
pdwn,
341360
"progress",

0 commit comments

Comments
 (0)