From 555d78a58fd44e814c47d62afbec061adc7d4e3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Sun, 6 Jul 2025 00:17:55 +0900 Subject: [PATCH] =?UTF-8?q?v1.5.2=20=E6=96=B0=E5=A2=9E=201.=20=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E6=9B=B4=E6=96=B0=20=E4=BF=AE=E5=A4=8D=201.=20?= =?UTF-8?q?=E6=BC=AB=E7=94=BB=E9=98=85=E8=AF=BB=E9=A1=B5=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E9=BB=91=E5=B1=8F=20=E4=BC=98=E5=8C=96=201.?= =?UTF-8?q?=20=E9=9A=90=E8=97=8F=E6=90=9C=E7=B4=A2=E9=A1=B5=20ranobe=20?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=201.=20SDK=20=E7=89=88=E6=9C=AC=E5=88=B0=203?= =?UTF-8?q?6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/.name | 2 +- .idea/dictionaries/fumiama.xml | 4 + .idea/kotlinc.xml | 2 +- app/build.gradle | 18 +- app/src/main/AndroidManifest.xml | 10 + app/src/main/assets/i.js | 3 + .../copymangaweb/activity/DlActivity.kt | 127 +++++++------ .../copymangaweb/activity/DlListActivity.kt | 15 +- .../copymangaweb/activity/MainActivity.kt | 42 +++-- .../activity/ViewMangaActivity.kt | 150 +++++++-------- .../activity/template/ToolsBoxActivity.kt | 38 +++- .../fumiama/copymangaweb/handler/DlHandler.kt | 76 +++++--- .../copymangaweb/handler/MainHandler.kt | 35 +++- .../copymangaweb/tool/DownloadTools.kt | 6 +- .../fumiama/copymangaweb/tool/MangaDlTools.kt | 15 +- .../fumiama/copymangaweb/tool/PagesManager.kt | 12 +- .../fumiama/copymangaweb/tool/Resolution.kt | 5 + .../top/fumiama/copymangaweb/tool/ToolsBox.kt | 27 ++- .../top/fumiama/copymangaweb/tool/Updater.kt | 124 ++++++++++++ .../fumiama/copymangaweb/view/JSWebView.kt | 2 +- .../copymangaweb/view/LazyScrollView.kt | 12 +- .../fumiama/copymangaweb/web/WebViewClient.kt | 5 +- app/src/main/res/drawable-anydpi/ic_dere.xml | 10 + app/src/main/res/layout/activity_dl.xml | 1 + .../main/res/layout/activity_viewmanga.xml | 107 +++++------ app/src/main/res/layout/dialog_progress.xml | 42 +++++ app/src/main/res/layout/page_imgview.xml | 24 +-- .../main/res/layout/widget_downloadbar.xml | 124 ++++++------ app/src/main/res/layout/widget_infodrawer.xml | 178 +++++++++--------- app/src/main/res/layout/widget_titlebar.xml | 102 +++++----- .../main/res/layout/widget_viewmangainfo.xml | 82 ++++---- app/src/main/res/values/strings.xml | 11 ++ app/src/main/res/xml/provider_paths.xml | 5 + build.gradle | 2 +- gradle.properties | 2 +- gradle/wrapper/gradle-wrapper.properties | 4 +- 36 files changed, 893 insertions(+), 531 deletions(-) create mode 100644 app/src/main/java/top/fumiama/copymangaweb/tool/Resolution.kt create mode 100644 app/src/main/java/top/fumiama/copymangaweb/tool/Updater.kt create mode 100644 app/src/main/res/drawable-anydpi/ic_dere.xml create mode 100644 app/src/main/res/layout/dialog_progress.xml create mode 100644 app/src/main/res/xml/provider_paths.xml diff --git a/.idea/.name b/.idea/.name index f2f9484..d3eb060 100644 --- a/.idea/.name +++ b/.idea/.name @@ -1 +1 @@ -拷贝漫画Lite \ No newline at end of file +拷贝Lite \ No newline at end of file diff --git a/.idea/dictionaries/fumiama.xml b/.idea/dictionaries/fumiama.xml index e4e746f..7c9f9f0 100644 --- a/.idea/dictionaries/fumiama.xml +++ b/.idea/dictionaries/fumiama.xml @@ -2,7 +2,11 @@ copymanga + dere lowpan + pdwn + reilia + tbtn volturn diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index b1077fb..bb44937 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index f487321..54b05ba 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,19 +1,17 @@ plugins { id 'com.android.application' id 'kotlin-android' - id 'kotlin-android-extensions' id 'kotlin-kapt' } android { defaultConfig { - compileSdk 34 + compileSdk 36 applicationId "top.fumiama.copymangaweb" minSdkVersion 23 - //noinspection OldTargetApi - targetSdkVersion 34 - versionCode 14 - versionName '1.5.1' + targetSdkVersion 36 + versionCode 15 + versionName '1.5.2' resConfigs "zh", "zh-rCN" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -67,6 +65,9 @@ android { viewBinding { enabled = true } + dataBinding { + enable = true + } bundle{ density{ enableSplit = true @@ -96,7 +97,9 @@ if (propFile.canRead()){ dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.core:core-ktx:1.12.0' + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3" + implementation 'androidx.core:core-ktx:1.16.0' + implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.9.1' implementation 'androidx.constraintlayout:constraintlayout:2.2.1' implementation 'androidx.cardview:cardview:1.0.0' implementation 'androidx.viewpager2:viewpager2:1.1.0' @@ -106,4 +109,5 @@ dependencies { implementation 'com.github.bumptech.glide:glide:4.16.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.16.0' implementation 'com.google.code.gson:gson:2.13.1' + implementation 'top.fumiama:sdict:0.1.1' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 23d17c8..15dafde 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,6 +2,7 @@ + + + + diff --git a/app/src/main/assets/i.js b/app/src/main/assets/i.js index 7de5a41..ff7a21e 100644 --- a/app/src/main/assets/i.js +++ b/app/src/main/assets/i.js @@ -49,6 +49,9 @@ if (typeof (loaded) == "undefined") { invoke.hideRanobeTab(); invoke.hideRanobeRack(); } + else if (url.indexOf("/searchContent") > 0) { + invoke.hideRanobeRack(); + } else if (url.indexOf("/comicContent/") > 0) setTimeout(function () { invoke.loadChapter() }, 1000); else if (url.indexOf("/details/comic/") > 0) GM.loadComic(url); else if (url.indexOf("/personal") > 0) { diff --git a/app/src/main/java/top/fumiama/copymangaweb/activity/DlActivity.kt b/app/src/main/java/top/fumiama/copymangaweb/activity/DlActivity.kt index 2d55340..d005e2a 100644 --- a/app/src/main/java/top/fumiama/copymangaweb/activity/DlActivity.kt +++ b/app/src/main/java/top/fumiama/copymangaweb/activity/DlActivity.kt @@ -8,15 +8,11 @@ import android.os.Looper import android.view.View import android.view.ViewGroup import android.view.ViewTreeObserver +import android.widget.LinearLayout +import android.widget.TextView import android.widget.Toast import android.widget.ToggleButton import com.google.gson.Gson -import kotlinx.android.synthetic.main.activity_dl.* -import kotlinx.android.synthetic.main.button_tbutton.view.* -import kotlinx.android.synthetic.main.line_caption.view.* -import kotlinx.android.synthetic.main.line_horizonal.view.* -import kotlinx.android.synthetic.main.widget_downloadbar.* -import kotlinx.android.synthetic.main.widget_titlebar.* import top.fumiama.copymangaweb.R import top.fumiama.copymangaweb.activity.MainActivity.Companion.mh import top.fumiama.copymangaweb.activity.template.ToolsBoxActivity @@ -33,6 +29,7 @@ import java.io.File import java.lang.Thread.sleep class DlActivity : ToolsBoxActivity() { + lateinit var mBinding: ActivityDlBinding private var tbtncnt = 0 private var isNewTitle = false var haveSElectAll = false @@ -52,11 +49,11 @@ class DlActivity : ToolsBoxActivity() { @SuppressLint("SetTextI18n") override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - val binding = ActivityDlBinding.inflate(layoutInflater) - setContentView(binding.root) + mBinding = ActivityDlBinding.inflate(layoutInflater) + setContentView(mBinding.root) mh?.saveUrlsOnly = true mangaDlTools = MangaDlTools(this) - dwh.apply { post { + mBinding.dwh.apply { post { settings.userAgentString = getString(R.string.pc_ua) webChromeClient = WebChromeClient() setWebViewClient("h.js") @@ -72,16 +69,24 @@ class DlActivity : ToolsBoxActivity() { super.onDestroy() } - private fun showDlCard(){ - //ObjectAnimator.ofFloat(csdwn, "alpha", 0.3f, 0.9f).setDuration(233).start() - ObjectAnimator.ofFloat(csdwn, "translationX", cdwnWidth.toFloat() * 0.9f, 0f).setDuration( + private fun showDlCard() { + ObjectAnimator.ofFloat( + mBinding.dldlbar.csdwn, + "translationX", + cdwnWidth.toFloat() * 0.9f, + 0f + ).setDuration( 233 ).start() } - private fun hideDlCard(){ - //ObjectAnimator.ofFloat(csdwn, "alpha", 0.9f, 0.3f).setDuration(233).start() - ObjectAnimator.ofFloat(csdwn, "translationX", 0f, cdwnWidth.toFloat() * 0.9f).setDuration( + private fun hideDlCard() { + ObjectAnimator.ofFloat( + mBinding.dldlbar.csdwn, + "translationX", + 0f, + cdwnWidth.toFloat() * 0.9f + ).setDuration( 233 ).start() } @@ -112,28 +117,28 @@ class DlActivity : ToolsBoxActivity() { @SuppressLint("SetTextI18n") fun setLayouts() { - ttitle.apply { post { text = comicName } } + mBinding.dtitle.ttitle.apply { post { text = comicName } } val widthData = toolsBox.calcWidthFromDp(8, 64) btnNumPerRow = widthData[0] btnw = widthData[1] - csdwn.apply { post { viewTreeObserver.addOnGlobalLayoutListener(object : + mBinding.dldlbar.csdwn.apply { post { viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener { override fun onGlobalLayout() { - cdwnWidth = csdwn.width + cdwnWidth = width viewTreeObserver.removeOnGlobalLayoutListener(this) } }) } } - dllazys.onScrollListener = object : LazyScrollView.OnScrollListener { + mBinding.dllazys.onScrollListener = object : LazyScrollView.OnScrollListener { override fun onBottom() {} - override fun onScroll() { if (csdwn.translationX == 0f) hideDlCard() } + override fun onScroll() { if (mBinding.dldlbar.csdwn.translationX == 0f) hideDlCard() } override fun onTop() {} } - cdwn.let { it.post { + mBinding.dldlbar.cdwn.let { it.post { it.setOnClickListener { - if (csdwn.translationX != 0f) showDlCard() + if (mBinding.dldlbar.csdwn.translationX != 0f) showDlCard() else if (checkedChapter == 0) hideDlCard() else { - pdwn.progress = 0 + mBinding.dldlbar.pdwn.progress = 0 if (canDl || checkedChapter == 0) canDl = false else { haveDlStarted = true @@ -152,7 +157,9 @@ class DlActivity : ToolsBoxActivity() { return@setOnLongClickListener true } } } - isearch.apply { post { setOnClickListener { showMultiSelectInfo() } } } + mBinding.dtitle.isearch.apply { post { + setOnClickListener { showMultiSelectInfo() } + } } Thread{ analyzeStructure() }.start() } @@ -165,9 +172,9 @@ class DlActivity : ToolsBoxActivity() { ViewMangaActivity.zipList = arrayOf() Gson().fromJson(json?.reader(), Array::class.java)?.let { for (group in it) { - val tc = layoutInflater.inflate(R.layout.line_caption, ldwn, false) - tc.tcptn.text = group.name - ldwn.apply { post { + val tc = layoutInflater.inflate(R.layout.line_caption, mBinding.ldwn, false) + tc.findViewById(R.id.tcptn).text = group.name + mBinding.ldwn.apply { post { addView( tc, ViewGroup.LayoutParams( @@ -176,7 +183,7 @@ class DlActivity : ToolsBoxActivity() { ) ) addView( - layoutInflater.inflate(R.layout.div_h, ldwn, false), + layoutInflater.inflate(R.layout.div_h, mBinding.ldwn, false), ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT @@ -227,45 +234,52 @@ class DlActivity : ToolsBoxActivity() { @SuppressLint("SetTextI18n") fun addToggleButton(title: String, url: String, caption: String) { if ((tbtncnt % btnNumPerRow == 0) || isNewTitle) { - toggleButtonLine = layoutInflater.inflate(R.layout.line_horizonal, ldwn, false) - ldwn.apply { + toggleButtonLine = layoutInflater.inflate(R.layout.line_horizonal, mBinding.ldwn, false) + mBinding.ldwn.apply { val t = toggleButtonLine post { addView(t) } } tbtncnt = 0 isNewTitle = false } - val tbv = layoutInflater.inflate(R.layout.button_tbutton, toggleButtonLine.ltbtn, false) - tbv.tbtn.index = tbtnlist.size - tbtnlist += tbv.tbtn - tbv.tbtn.url = url + val tbv = layoutInflater.inflate(R.layout.button_tbutton, toggleButtonLine.findViewById(R.id.ltbtn), false) + val tbvTbtn = tbv.findViewById(R.id.tbtn)?:return + tbvTbtn.index = tbtnlist.size + tbtnlist += tbvTbtn + tbvTbtn.url = url tbtncnt++ val zipPosition = ViewMangaActivity.zipList?.size ViewMangaActivity.zipList = ViewMangaActivity.zipList?.plus("$title.zip") - tbv.tbtn.textOff = title - tbv.tbtn.textOn = title - tbv.tbtn.text = title - tbv.tbtn.hint = caption - tbv.tbtn.layoutParams.width = btnw + tbvTbtn.textOff = title + tbvTbtn.textOn = title + tbvTbtn.text = title + tbvTbtn.hint = caption + tbvTbtn.layoutParams.width = btnw val zipFile = File("${getExternalFilesDir("")}/$comicName/$caption/$title.zip") if (zipFile.exists()) { - tbv.tbtn.setBackgroundResource(R.drawable.rndbg_checked) - tbv.tbtn.isChecked = false - tbv.tbtn.freezesText = true + tbvTbtn.setBackgroundResource(R.drawable.rndbg_checked) + tbvTbtn.isChecked = false + tbvTbtn.freezesText = true } toggleButtonLine.apply { post { - ltbtn.addView(tbv) + findViewById(R.id.ltbtn)?.addView(tbv) invalidate() } } - tbv.tbtn.setOnClickListener { v -> + tbvTbtn.setOnClickListener { v -> val normalAct = (multiSelect && zipFile.exists()) || !zipFile.exists() - if (zipFile.exists() && !v.tbtn.isChecked) v.tbtn.apply { post { setBackgroundResource(R.drawable.rndbg_checked) } } - else if(normalAct) v.tbtn.apply { post { setBackgroundResource(R.drawable.toggle_button) } } + val tbtn = v.findViewById(R.id.tbtn)?:return@setOnClickListener + if (zipFile.exists() && !tbtn.isChecked) tbtn.apply { post { setBackgroundResource(R.drawable.rndbg_checked) } } + else if(normalAct) tbtn.apply { post { setBackgroundResource(R.drawable.toggle_button) } } if (normalAct) { - if (v.tbtn.isChecked) tdwn.apply { post { text = "$dldChapter/${++checkedChapter}" } } - else tdwn.apply { post { text = "$dldChapter/${--checkedChapter}" } } - } else if(v.tbtn.isChecked) { - v.tbtn.apply { post { + mBinding.dldlbar.tdwn.apply { + if (tbtn.isChecked) post { + text = "$dldChapter/${++checkedChapter}" + } else post { + text = "$dldChapter/${--checkedChapter}" + } + } + } else if(tbtn.isChecked) { + tbtn.apply { post { isChecked = false zipPosition?.let { Thread { callVM(title, zipFile, it) @@ -273,7 +287,7 @@ class DlActivity : ToolsBoxActivity() { } } } } - tbv.tbtn.setOnLongClickListener { + tbvTbtn.setOnLongClickListener { if (zipFile.exists()) { toolsBox.buildInfo("确认删除这些章节?", "该操作将不可撤销", @@ -282,8 +296,10 @@ class DlActivity : ToolsBoxActivity() { "取消", { if (checkedChapter == 0) { - it.tbtn.apply { post { isChecked = true } } - tdwn.apply { post { text = "$dldChapter/${++checkedChapter}" } } + tbvTbtn.apply { post { isChecked = true } } + mBinding.dldlbar.tdwn.apply { post { + text = "$dldChapter/${++checkedChapter}" + } } } handler.sendEmptyMessage(7) }) @@ -324,7 +340,9 @@ class DlActivity : ToolsBoxActivity() { @SuppressLint("SetTextI18n") fun updateProgressBar() { - tdwn.apply { post { text = "${++dldChapter}/$checkedChapter" } } + mBinding.dldlbar.tdwn.apply { post { + text = "${++dldChapter}/$checkedChapter" + } } setProgress2(dldChapter * 100 / checkedChapter, 233) } @@ -336,6 +354,7 @@ class DlActivity : ToolsBoxActivity() { } fun setProgress2(end: Int, duration: Long) { + val pdwn = mBinding.dldlbar.pdwn ObjectAnimator.ofInt( pdwn, "progress", diff --git a/app/src/main/java/top/fumiama/copymangaweb/activity/DlListActivity.kt b/app/src/main/java/top/fumiama/copymangaweb/activity/DlListActivity.kt index 2f02a76..90e4221 100644 --- a/app/src/main/java/top/fumiama/copymangaweb/activity/DlListActivity.kt +++ b/app/src/main/java/top/fumiama/copymangaweb/activity/DlListActivity.kt @@ -7,8 +7,6 @@ import android.os.Bundle import android.os.Looper import android.widget.ArrayAdapter import android.widget.Toast -import kotlinx.android.synthetic.main.activity_dlist.* -import kotlinx.android.synthetic.main.widget_titlebar.* import top.fumiama.copymangaweb.R import top.fumiama.copymangaweb.databinding.ActivityDlistBinding import top.fumiama.copymangaweb.handler.DlLHandler @@ -17,14 +15,15 @@ import java.util.regex.Pattern import java.util.zip.ZipInputStream class DlListActivity: Activity() { + private lateinit var mBinding: ActivityDlistBinding private var nullZipDirStr = emptyArray() private var handler: DlLHandler? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - val binding = ActivityDlistBinding.inflate(layoutInflater) - setContentView(binding.root) - ttitle.text = intent.getStringExtra("title") + mBinding = ActivityDlistBinding.inflate(layoutInflater) + setContentView(mBinding.root) + mBinding.myt.ttitle.text = intent.getStringExtra("title") handler = DlLHandler(Looper.myLooper()!!, this) handler?.obtainMessage(3, currentDir)?.sendToTarget() //call scanFile } @@ -42,8 +41,8 @@ class DlListActivity: Activity() { if(o1.endsWith(".zip") && o2.endsWith(".zip")) (10000*getFloat(o1) - 10000*getFloat(o2) + 0.5).toInt() else o1[0] - o2[0] }?.let { - mylv.adapter = ArrayAdapter(this, android.R.layout.simple_list_item_1, it) - mylv.setOnItemClickListener { _, _, position, _ -> + mBinding.mylv.adapter = ArrayAdapter(this, android.R.layout.simple_list_item_1, it) + mBinding.mylv.setOnItemClickListener { _, _, position, _ -> val chosenFile = File(cd, it[position]) val chosenJson = File(chosenFile, "info.bin") //Toast.makeText(this, "进入$chosenFile", Toast.LENGTH_SHORT).show() @@ -69,7 +68,7 @@ class DlListActivity: Activity() { } } } - mylv.setOnItemLongClickListener { _, _, position, _ -> + mBinding.mylv.setOnItemLongClickListener { _, _, position, _ -> val chosenFile = File(cd, it[position]) AlertDialog.Builder(this) .setIcon(R.drawable.ic_launcher_foreground).setMessage("在此执行删除/查错?") diff --git a/app/src/main/java/top/fumiama/copymangaweb/activity/MainActivity.kt b/app/src/main/java/top/fumiama/copymangaweb/activity/MainActivity.kt index 78d3fca..4783c28 100644 --- a/app/src/main/java/top/fumiama/copymangaweb/activity/MainActivity.kt +++ b/app/src/main/java/top/fumiama/copymangaweb/activity/MainActivity.kt @@ -1,7 +1,6 @@ package top.fumiama.copymangaweb.activity import android.annotation.SuppressLint -import android.app.Dialog import android.content.Intent import android.net.Uri import android.os.Bundle @@ -9,14 +8,17 @@ import android.os.Looper import android.view.View import android.webkit.ValueCallback import android.webkit.WebView -import kotlinx.android.synthetic.main.activity_main.fab -import kotlinx.android.synthetic.main.activity_main.w -import kotlinx.android.synthetic.main.activity_main.wh +import androidx.lifecycle.lifecycleScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext +import top.fumiama.copymangaweb.BuildConfig import top.fumiama.copymangaweb.R import top.fumiama.copymangaweb.activity.template.ToolsBoxActivity import top.fumiama.copymangaweb.databinding.ActivityMainBinding import top.fumiama.copymangaweb.handler.MainHandler import top.fumiama.copymangaweb.tool.SetDraggable +import top.fumiama.copymangaweb.tool.Updater import top.fumiama.copymangaweb.web.JS import top.fumiama.copymangaweb.web.JSHidden import top.fumiama.copymangaweb.web.WebChromeClient @@ -24,16 +26,13 @@ import java.lang.ref.WeakReference class MainActivity: ToolsBoxActivity() { var uploadMessageAboveL: ValueCallback>? = null - var dialog: Dialog? = null + lateinit var mBinding: ActivityMainBinding @SuppressLint("JavascriptInterface") override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - val binding = ActivityMainBinding.inflate(layoutInflater) - setContentView(binding.root) - - dialog = Dialog(this) - dialog?.setContentView(R.layout.dialog_unzipping) + mBinding = ActivityMainBinding.inflate(layoutInflater) + setContentView(mBinding.root) wm = WeakReference(this) mh = MainHandler(Looper.myLooper()!!) @@ -43,27 +42,33 @@ class MainActivity: ToolsBoxActivity() { return@let } + lifecycleScope.launch { + withContext(Dispatchers.IO) { + goCheckUpdate(false) + } + } + WebView.setWebContentsDebuggingEnabled(true) - w.apply { post { + mBinding.w.apply { post { setWebViewClient("i.js") webChromeClient = WebChromeClient() loadJSInterface(JS()) loadUrl(getString(R.string.web_home)) } } - wh.apply { post { + mBinding.wh.apply { post { settings.userAgentString = getString(R.string.pc_ua) webChromeClient = WebChromeClient() setWebViewClient("h.js") loadJSInterface(JSHidden()) } } } - SetDraggable().with(this).onto(fab) + SetDraggable().with(this).onto(mBinding.fab) } @Deprecated("Deprecated in Java") override fun onBackPressed() { - if(w.canGoBack()) w.goBack() + if(mBinding.w.canGoBack()) mBinding.w.goBack() else super.onBackPressed() } @@ -95,6 +100,15 @@ class MainActivity: ToolsBoxActivity() { } } + private suspend fun goCheckUpdate(ignoreSkip: Boolean) { + Updater( + WeakReference(this), + toolsBox, + ignoreSkip, + getPreferences(MODE_PRIVATE).getInt("skipVersion", 0) + ).check(BuildConfig.VERSION_CODE) + } + fun onFabClicked(v: View){ DlListActivity.currentDir = getExternalFilesDir("") startActivity( diff --git a/app/src/main/java/top/fumiama/copymangaweb/activity/ViewMangaActivity.kt b/app/src/main/java/top/fumiama/copymangaweb/activity/ViewMangaActivity.kt index b5139c5..8a566a1 100644 --- a/app/src/main/java/top/fumiama/copymangaweb/activity/ViewMangaActivity.kt +++ b/app/src/main/java/top/fumiama/copymangaweb/activity/ViewMangaActivity.kt @@ -20,23 +20,6 @@ import android.widget.Toast import androidx.recyclerview.widget.RecyclerView import androidx.viewpager2.widget.ViewPager2 import com.bumptech.glide.Glide -import kotlinx.android.synthetic.main.activity_main.w -import kotlinx.android.synthetic.main.activity_viewmanga.infcard -import kotlinx.android.synthetic.main.activity_viewmanga.oneinfo -import kotlinx.android.synthetic.main.activity_viewmanga.vone -import kotlinx.android.synthetic.main.activity_viewmanga.vp -import kotlinx.android.synthetic.main.page_imgview.onei -import kotlinx.android.synthetic.main.page_imgview.view.onei -import kotlinx.android.synthetic.main.widget_infodrawer.idtblr -import kotlinx.android.synthetic.main.widget_infodrawer.idtbvh -import kotlinx.android.synthetic.main.widget_infodrawer.idtbvolturn -import kotlinx.android.synthetic.main.widget_infodrawer.idtbvp -import kotlinx.android.synthetic.main.widget_infodrawer.idtime -import kotlinx.android.synthetic.main.widget_infodrawer.view.idc -import kotlinx.android.synthetic.main.widget_titlebar.isearch -import kotlinx.android.synthetic.main.widget_titlebar.ttitle -import kotlinx.android.synthetic.main.widget_viewmangainfo.infseek -import kotlinx.android.synthetic.main.widget_viewmangainfo.inftxtprogress import top.fumiama.copymangaweb.R import top.fumiama.copymangaweb.activity.MainActivity.Companion.wm import top.fumiama.copymangaweb.activity.template.ToolsBoxActivity @@ -44,6 +27,7 @@ import top.fumiama.copymangaweb.databinding.ActivityViewmangaBinding import top.fumiama.copymangaweb.handler.TimeThread import top.fumiama.copymangaweb.tool.PropertiesTools import top.fumiama.copymangaweb.tool.ToolsBox +import top.fumiama.copymangaweb.view.ScaleImageView import java.io.File import java.lang.ref.WeakReference import java.text.SimpleDateFormat @@ -54,6 +38,7 @@ import java.util.zip.ZipInputStream class ViewMangaActivity : ToolsBoxActivity() { lateinit var handler: Handler lateinit var tt: TimeThread + lateinit var mBinding: ActivityViewmangaBinding var count = 0 var clicked = false @@ -90,13 +75,13 @@ class ViewMangaActivity : ToolsBoxActivity() { @SuppressLint("SetTextI18n") override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - val binding = ActivityViewmangaBinding.inflate(layoutInflater) - setContentView(binding.root) + mBinding = ActivityViewmangaBinding.inflate(layoutInflater) + setContentView(mBinding.root) va = WeakReference(this) p = PropertiesTools(File("$filesDir/settings.properties")) r2l = p["r2l"] == "true" notUseVP = p["noAnimation"] == "true" - handler = MyHandler(infcard, toolsBox) + handler = MyHandler(toolsBox) tt = TimeThread(handler, 22) tt.canDo = true tt.start() @@ -105,7 +90,7 @@ class ViewMangaActivity : ToolsBoxActivity() { setContentView(R.layout.dialog_unzipping) show() } - ttitle.apply { post { text = titleText } } + mBinding.oneinfo.inftitle.ttitle.apply { post { text = titleText } } Log.d("MyVM", "dlZip2View: $dlZip2View, mangaZip: $mangaZip") if(dlZip2View && mangaZip?.exists() != true) toolsBox.toastError("已经到头了~") else Thread { @@ -121,7 +106,7 @@ class ViewMangaActivity : ToolsBoxActivity() { if(pn > 0) { pageNum = pn pn = -1 - }else if(pn == -2){ + } else if(pn == -2){ pageNum = count pn = -1 } @@ -129,7 +114,8 @@ class ViewMangaActivity : ToolsBoxActivity() { e.printStackTrace() toolsBox.toastError("准备控件错误") } finally { - dialog?.hide() + dialog?.dismiss() + dialog = null } } }.start() @@ -158,13 +144,13 @@ class ViewMangaActivity : ToolsBoxActivity() { } private fun getPageNumber(): Int { - return if (r2l && !notUseVP) count - vp.currentItem - else (if (notUseVP) currentItem else vp.currentItem) + 1 + return if (r2l && !notUseVP) count - mBinding.vp.currentItem + else (if (notUseVP) currentItem else mBinding.vp.currentItem) + 1 } private fun setPageNumber(num: Int) { - if (r2l && !notUseVP) vp.apply { post { currentItem = count - num } } - else if (notUseVP) currentItem = num - 1 else vp.currentItem = num - 1 + if (r2l && !notUseVP) mBinding.vp.apply { post { currentItem = count - num } } + else if (notUseVP) currentItem = num - 1 else mBinding.vp.currentItem = num - 1 } private fun getImgBitmap(position: Int): Bitmap? { @@ -176,18 +162,18 @@ class ViewMangaActivity : ToolsBoxActivity() { } private fun loadOneImg() { - if(dlZip2View) onei.apply { post { setImageBitmap(getImgBitmap(currentItem)) } } + if(dlZip2View) mBinding.vone.onei.apply { post { setImageBitmap(getImgBitmap(currentItem)) } } else Glide.with(this@ViewMangaActivity) - .load(imgUrls[currentItem]) + .load(toolsBox.resolution.wrap(imgUrls[currentItem])) .placeholder(R.drawable.ic_dl) .dontAnimate() - .into(onei) + .into(mBinding.vone.onei) updateSeekBar() } private fun setIdPosition(position: Int) { infoDrawerDelta = position.toFloat() - infcard.apply { post { translationY = infoDrawerDelta } } + mBinding.infcard.root.apply { post { translationY = infoDrawerDelta } } } @SuppressLint("SetTextI18n") @@ -202,10 +188,10 @@ class ViewMangaActivity : ToolsBoxActivity() { } private fun prepareIdBtLR() { - idtblr.apply { post { + mBinding.infcard.idtblr.apply { post { isChecked = r2l setOnClickListener { - if (idtblr.isChecked) p["r2l"] = "true" + if (mBinding.infcard.idtblr.isChecked) p["r2l"] = "true" else p["r2l"] = "false" Toast.makeText(this@ViewMangaActivity, "下次浏览生效", Toast.LENGTH_SHORT).show() } @@ -213,10 +199,10 @@ class ViewMangaActivity : ToolsBoxActivity() { } private fun prepareIdBtVP() { - idtbvp.apply { post { + mBinding.infcard.idtbvp.apply { post { isChecked = notUseVP setOnClickListener { - if (idtbvp.isChecked) p["noAnimation"] = "true" + if (mBinding.infcard.idtbvp.isChecked) p["noAnimation"] = "true" else p["noAnimation"] = "false" Toast.makeText(this@ViewMangaActivity, "下次浏览生效", Toast.LENGTH_SHORT).show() } @@ -225,10 +211,10 @@ class ViewMangaActivity : ToolsBoxActivity() { private fun prepareVP() { if (notUseVP) { - vp.apply { post { visibility = View.INVISIBLE } } - vone.apply { post { visibility = View.VISIBLE } } + mBinding.vp.apply { post { visibility = View.INVISIBLE } } + mBinding.vone.root.apply { post { visibility = View.VISIBLE } } } else { - vp.apply { post { + mBinding.vp.apply { post { visibility = View.VISIBLE adapter = ViewData(this).RecyclerViewAdapter() registerOnPageChangeCallback(object : ViewPager2.OnPageChangeCallback() { @@ -239,7 +225,7 @@ class ViewMangaActivity : ToolsBoxActivity() { }) if (r2l) currentItem = count - 1 } } - vone.apply { post { visibility = View.INVISIBLE } } + mBinding.vone.root.apply { post { visibility = View.INVISIBLE } } } } @@ -251,8 +237,8 @@ class ViewMangaActivity : ToolsBoxActivity() { @SuppressLint("SetTextI18n") private fun prepareInfoBar(size: Int) { - oneinfo.apply { post { alpha = 0F } } - infseek.apply { post { + mBinding.oneinfo.root.apply { post { alpha = 0F } } + mBinding.oneinfo.infseek.apply { post { visibility = View.INVISIBLE setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener { override fun onProgressChanged(p0: SeekBar?, p1: Int, isHuman: Boolean) { @@ -271,36 +257,38 @@ class ViewMangaActivity : ToolsBoxActivity() { } }) } } - isearch.apply { post { + mBinding.oneinfo.inftitle.isearch.apply { post { visibility = View.INVISIBLE setOnClickListener { - handler.sendEmptyMessage(3) + this@ViewMangaActivity.handler.sendEmptyMessage(3) } } } - inftxtprogress.apply { post { text = "$pageNum/$size" } } + mBinding.oneinfo.inftxtprogress.apply { post { text = "$pageNum/$size" } } } private fun prepareIdBtVH() { - idtbvh.apply { post { + mBinding.infcard.idtbvh.apply { post { isChecked = p["vertical"] == "true" setOnClickListener { - if (idtbvh.isChecked) { - vp.apply { post { orientation = ViewPager2.ORIENTATION_VERTICAL } } + if (mBinding.infcard.idtbvh.isChecked) { + mBinding.vp.apply { post { orientation = ViewPager2.ORIENTATION_VERTICAL } } p["vertical"] = "true" } else { - vp.apply { post { orientation = ViewPager2.ORIENTATION_HORIZONTAL } } + mBinding.vp.apply { post { orientation = ViewPager2.ORIENTATION_HORIZONTAL } } p["vertical"] = "false" } } + if (isChecked) mBinding.vp.apply { post { + orientation = ViewPager2.ORIENTATION_VERTICAL + } } } } - if (idtbvh.isChecked) vp.apply { post { orientation = ViewPager2.ORIENTATION_VERTICAL } } } private fun prepareIdBtVolTurn() { - idtbvolturn.apply { post { + mBinding.infcard.idtbvolturn.apply { post { isChecked = volTurnPage setOnClickListener { - if (idtbvolturn.isChecked) p["volturn"] = "true" + if (mBinding.infcard.idtbvolturn.isChecked) p["volturn"] = "true" else p["volturn"] = "false" } } } @@ -333,17 +321,17 @@ class ViewMangaActivity : ToolsBoxActivity() { @SuppressLint("SetTextI18n") private fun updateSeekText() { - inftxtprogress.apply { post { text = "$pageNum/$count" } } + mBinding.oneinfo.inftxtprogress.apply { post { text = "$pageNum/$count" } } } private fun updateSeekProgress() { - infseek.apply { post { progress = pageNum * 100 / count } } + mBinding.oneinfo.infseek.apply { post { progress = pageNum * 100 / count } } } @Deprecated("Deprecated in Java") override fun onBackPressed() { tt.canDo = false - wm?.get()?.w?.goBack() + wm?.get()?.mBinding?.w?.goBack() super.onBackPressed() } @@ -366,11 +354,16 @@ class ViewMangaActivity : ToolsBoxActivity() { @SuppressLint("ClickableViewAccessibility", "SetTextI18n") override fun onBindViewHolder(holder: ViewData, position: Int) { val pos = if (r2l) count - position - 1 else position - if(dlZip2View) getImgBitmap(pos)?.let { - //Glide.with(this@ViewMangaActivity).load(it).placeholder(R.drawable.bg_comment).into(holder.itemView.onei) - holder.itemView.onei.setImageBitmap(it) + holder.itemView.findViewById(R.id.onei)?.let { oneImage -> + if(dlZip2View) getImgBitmap(pos)?.let { + //Glide.with(this@ViewMangaActivity).load(it).placeholder(R.drawable.bg_comment).into(holder.itemView.onei) + oneImage.setImageBitmap(it) + } + else Glide.with(this@ViewMangaActivity) + .load(toolsBox.resolution.wrap(imgUrls[pos])).placeholder(R.drawable.ic_dl) + .dontAnimate().timeout(10000) + .into(oneImage) } - else Glide.with(this@ViewMangaActivity).load(imgUrls[pos]).placeholder(R.drawable.ic_dl).dontAnimate().timeout(10000).into(holder.itemView.onei) } override fun getItemCount(): Int { @@ -380,34 +373,35 @@ class ViewMangaActivity : ToolsBoxActivity() { } fun showSettings() { - infseek.visibility = View.VISIBLE - isearch.visibility = View.VISIBLE + mBinding.oneinfo.infseek.visibility = View.VISIBLE + mBinding.oneinfo.inftitle.isearch.visibility = View.VISIBLE + val v = mBinding.oneinfo.root ObjectAnimator.ofFloat( - oneinfo, + v, "alpha", - oneinfo.alpha, + v.alpha, 1F ).setDuration(233).start() clicked = true } fun hideSettings() { + val v = mBinding.oneinfo.root ObjectAnimator.ofFloat( - oneinfo, + v, "alpha", - oneinfo.alpha, + v.alpha, 0F ).setDuration(233).start() clicked = false - infseek.postDelayed({ - infseek.visibility = View.INVISIBLE - isearch.visibility = View.INVISIBLE + mBinding.oneinfo.infseek.postDelayed({ + mBinding.oneinfo.infseek.visibility = View.INVISIBLE + mBinding.oneinfo.inftitle.isearch.visibility = View.INVISIBLE }, 300) handler.sendEmptyMessage(1) } class MyHandler( - private val infoCard: View, private val toolsBox: ToolsBox ) : Handler(Looper.myLooper()!!) { private var infoShown = false @@ -432,19 +426,27 @@ class ViewMangaActivity : ToolsBoxActivity() { } else { showInfCard(); true } - 22 -> toolsBox.zis?.idtime?.text = - SimpleDateFormat("HH:mm").format(Date()) + toolsBox.week + toolsBox.netInfo + 22 -> (toolsBox.zis as? ViewMangaActivity)?.mBinding?.infcard?.idtime?.apply { post { + text = SimpleDateFormat("HH:mm") + .format(Date()) + toolsBox.week + toolsBox.netInfo + } } } } private fun showInfCard() { - ObjectAnimator.ofFloat(infoCard.idc, "alpha", 0.3F, 0.8F).setDuration(233).start() - ObjectAnimator.ofFloat(infoCard, "translationY", delta, 0F).setDuration(233).start() + Log.d("MyVM", "showInfCard delta $delta") + va?.get()?.mBinding?.infcard?.apply { + ObjectAnimator.ofFloat(idc, "alpha", 0.3F, 0.8F).setDuration(233).start() + ObjectAnimator.ofFloat(root, "translationY", delta, 0F).setDuration(233).start() + } } private fun hideInfCard() { - ObjectAnimator.ofFloat(infoCard.idc, "alpha", 0.8F, 0.3F).setDuration(233).start() - ObjectAnimator.ofFloat(infoCard, "translationY", 0F, delta).setDuration(233).start() + Log.d("MyVM", "hideInfCard delta $delta") + va?.get()?.mBinding?.infcard?.apply { + ObjectAnimator.ofFloat(idc, "alpha", 0.8F, 0.3F).setDuration(233).start() + ObjectAnimator.ofFloat(root, "translationY", 0F, delta).setDuration(233).start() + } } } diff --git a/app/src/main/java/top/fumiama/copymangaweb/activity/template/ToolsBoxActivity.kt b/app/src/main/java/top/fumiama/copymangaweb/activity/template/ToolsBoxActivity.kt index efd8d7c..2725f57 100644 --- a/app/src/main/java/top/fumiama/copymangaweb/activity/template/ToolsBoxActivity.kt +++ b/app/src/main/java/top/fumiama/copymangaweb/activity/template/ToolsBoxActivity.kt @@ -2,14 +2,50 @@ package top.fumiama.copymangaweb.activity.template import android.app.Activity import android.os.Bundle +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.LifecycleOwner +import androidx.lifecycle.LifecycleRegistry import top.fumiama.copymangaweb.tool.ToolsBox import java.lang.ref.WeakReference -open class ToolsBoxActivity: Activity() { +open class ToolsBoxActivity: Activity(), LifecycleOwner { lateinit var toolsBox: ToolsBox + private lateinit var lifecycleRegistry: LifecycleRegistry override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + lifecycleRegistry = LifecycleRegistry(this) + lifecycleRegistry.currentState = Lifecycle.State.CREATED + lifecycleRegistry.currentState = Lifecycle.State.STARTED + toolsBox = ToolsBox(WeakReference(this)) } + + override fun onStart() { + super.onStart() + lifecycleRegistry.currentState = Lifecycle.State.STARTED + } + + override fun onResume() { + super.onResume() + lifecycleRegistry.currentState = Lifecycle.State.RESUMED + } + + override fun onPause() { + lifecycleRegistry.currentState = Lifecycle.State.STARTED + super.onPause() + } + + override fun onStop() { + lifecycleRegistry.currentState = Lifecycle.State.CREATED + super.onStop() + } + + override fun onDestroy() { + lifecycleRegistry.currentState = Lifecycle.State.DESTROYED + super.onDestroy() + } + + override val lifecycle: Lifecycle + get() = lifecycleRegistry } diff --git a/app/src/main/java/top/fumiama/copymangaweb/handler/DlHandler.kt b/app/src/main/java/top/fumiama/copymangaweb/handler/DlHandler.kt index 567e98f..a5688ec 100644 --- a/app/src/main/java/top/fumiama/copymangaweb/handler/DlHandler.kt +++ b/app/src/main/java/top/fumiama/copymangaweb/handler/DlHandler.kt @@ -6,7 +6,6 @@ import android.os.Looper import android.os.Message import android.widget.Toast import android.widget.ToggleButton -import kotlinx.android.synthetic.main.widget_downloadbar.* import top.fumiama.copymangaweb.R import top.fumiama.copymangaweb.activity.DlActivity import top.fumiama.copymangaweb.tool.MangaDlTools.Companion.wmdlt @@ -24,41 +23,52 @@ class DlHandler(activity: DlActivity, looper: Looper) : Handler(looper) { when (msg.what) { -2 -> d?.setLayouts() 1 -> { - d?.tbtnlist?.get(msg.arg1)?.setBackgroundResource(R.drawable.rndbg_checked) - d?.tbtnlist?.get(msg.arg1)?.isChecked = false - d?.updateProgressBar() - if (d?.haveDlStarted == false) { - d?.dldChapter = 0 - d?.checkedChapter = 0 - this.postDelayed({ - d?.setProgress2(0, 233) - d?.tdwn?.text = "0/0" - }, 400) - } + d?.tbtnlist?.get(msg.arg1)?.apply { post { + setBackgroundResource(R.drawable.rndbg_checked) + isChecked = false + d?.updateProgressBar() + if (d?.haveDlStarted == false) { + d?.dldChapter = 0 + d?.checkedChapter = 0 + postDelayed({ + d?.setProgress2(0, 233) + d?.mBinding?.dldlbar?.tdwn?.apply { post { + text = d?.getString(R.string.zero_per_zero) + } } + }, 400) + } + } } } -1 -> { - d?.tbtnlist?.get(msg.arg1)?.setBackgroundResource(R.drawable.rndbg_error) - d!!.dldChapter-- - Toast.makeText(d, "下载${d?.tbtnlist?.get(msg.arg1)?.textOn}失败", Toast.LENGTH_SHORT).show() - d?.updateProgressBar() + d?.tbtnlist?.get(msg.arg1)?.apply { post { + setBackgroundResource(R.drawable.rndbg_error) + d!!.dldChapter-- + Toast.makeText(d, "下载${d?.tbtnlist?.get(msg.arg1)?.textOn}失败", Toast.LENGTH_SHORT).show() + d?.updateProgressBar() + } } } 4 -> { - d?.pdwn?.progress = 0 + d?.mBinding?.dldlbar?.pdwn?.apply { post { progress = 0 } } val selectDownloaded = d?.multiSelect?:false if (d?.haveSElectAll == true) { d?.tbtnlist?.forEach { i -> - if(i.freezesText) i.setBackgroundResource(R.drawable.rndbg_checked) else i.setBackgroundResource(R.drawable.toggle_button) - i.isChecked = false + i.apply { post { + if(freezesText) setBackgroundResource(R.drawable.rndbg_checked) + else setBackgroundResource(R.drawable.toggle_button) + isChecked = false + } } } d?.haveSElectAll = false d?.checkedChapter = 0 d?.dldChapter = 0 } else { d?.let { - val checkBtn = { i: ToggleButton, it: DlActivity -> - i.setBackgroundResource(R.drawable.toggle_button) - i.isChecked = true - it.checkedChapter++ + val checkBtn = { i: ToggleButton, a: DlActivity -> + i.apply { post { + setBackgroundResource(R.drawable.toggle_button) + isChecked = true + a.checkedChapter++ + } } } for (i in it.tbtnlist) { if(selectDownloaded) checkBtn(i, it) @@ -67,7 +77,9 @@ class DlHandler(activity: DlActivity, looper: Looper) : Handler(looper) { } d?.haveSElectAll = true } - d?.tdwn?.text = "${d?.dldChapter}/${d?.checkedChapter}" + d?.mBinding?.dldlbar?.tdwn?.apply { post { + text = "${d?.dldChapter}/${d?.checkedChapter}" + } } } 5 -> { setSize(msg.arg2, msg.arg1) @@ -75,14 +87,20 @@ class DlHandler(activity: DlActivity, looper: Looper) : Handler(looper) { if (!(msg.obj as Boolean)) { Toast.makeText(d, "下载${d?.tbtnlist?.get(msg.arg1)?.textOn}的第${msg.arg2}页失败", Toast.LENGTH_SHORT).show() }else{ - val progressTxt = d?.tdwn?.text.toString() - d?.tdwn?.text = "${progressTxt.substringBefore(' ')} 的 ${msg.arg2}/${size} 页" + val progressTxt = d?.mBinding?.dldlbar?.tdwn?.text.toString() + d?.mBinding?.dldlbar?.tdwn?.apply { post { + text = "${progressTxt.substringBefore(' ')} 的 ${msg.arg2}/${size} 页" + } } } } - 6 -> d?.tdwn?.text = "${d?.dldChapter}/${d?.checkedChapter}" + 6 -> d?.mBinding?.dldlbar?.tdwn?.apply { post { text = "${d?.dldChapter}/${d?.checkedChapter}" } } 7 -> d?.deleteChapters() - 8 -> d?.resources?.getColor(R.color.colorBlue)?.let { d?.cdwn?.setCardBackgroundColor(it) } - 9 -> d?.resources?.getColor(R.color.colorRed)?.let { d?.cdwn?.setCardBackgroundColor(it) } + 8 -> d?.resources?.getColor(R.color.colorBlue)?.let { d?.mBinding?.dldlbar?.cdwn?.apply { post { + setCardBackgroundColor(it) + } } } + 9 -> d?.resources?.getColor(R.color.colorRed)?.let { d?.mBinding?.dldlbar?.cdwn?.apply { post { + setCardBackgroundColor(it) + } } } 10 -> Toast.makeText(d, "下载${d?.tbtnlist?.get(msg.arg1)?.textOn}的第${msg.arg2}页失败,尝试重新下载...", Toast.LENGTH_SHORT).show() } } diff --git a/app/src/main/java/top/fumiama/copymangaweb/handler/MainHandler.kt b/app/src/main/java/top/fumiama/copymangaweb/handler/MainHandler.kt index bd9ee68..fac91c3 100644 --- a/app/src/main/java/top/fumiama/copymangaweb/handler/MainHandler.kt +++ b/app/src/main/java/top/fumiama/copymangaweb/handler/MainHandler.kt @@ -1,13 +1,14 @@ package top.fumiama.copymangaweb.handler import android.animation.ObjectAnimator +import android.app.Dialog import android.content.Intent import android.os.Handler import android.os.Looper import android.os.Message import android.view.View -import kotlinx.android.synthetic.main.activity_main.* -import kotlinx.android.synthetic.main.dialog_unzipping.* +import android.widget.TextView +import top.fumiama.copymangaweb.R import top.fumiama.copymangaweb.activity.DlActivity.Companion.json import top.fumiama.copymangaweb.activity.MainActivity.Companion.wm import top.fumiama.copymangaweb.activity.ViewMangaActivity @@ -16,6 +17,7 @@ import top.fumiama.copymangaweb.tool.MangaDlTools.Companion.wmdlt class MainHandler(looper: Looper):Handler(looper) { var saveUrlsOnly = false var showDlList = false + private var dialog: Dialog? = null override fun handleMessage(msg: Message) { super.handleMessage(msg) @@ -26,12 +28,27 @@ class MainHandler(looper: Looper):Handler(looper) { SET_FAB -> setFab(msg.obj as String) HIDE_FAB -> hideFab() SET_FAB_TO_DOWNLOAD_LIST -> setFab2DlList() - SHOW_LOADING_DIALOG -> wm?.get()?.dialog?.show() - HIDE_LOADING_DIALOG -> wm?.get()?.dialog?.hide() - SET_LOADING_DIALOG_TEXT -> wm?.get()?.dialog?.tunz?.text = msg.obj as String + SHOW_LOADING_DIALOG -> { + wm?.get()?.apply { + (dialog?:Dialog(this).also { + it.setContentView(R.layout.dialog_unzipping) + dialog = it + }).show() + } + } + HIDE_LOADING_DIALOG -> { + dialog?.dismiss() + dialog = null + } + SET_LOADING_DIALOG_TEXT -> { + val t = msg.obj as? String?:return + dialog?.findViewById(R.id.tunz)?.apply { post { + text = t + } } + } } } - private fun loadUrlInHiddenWebView(url: String) { wm?.get()?.wh?.apply { post { loadUrl(url) } } } + private fun loadUrlInHiddenWebView(url: String) { wm?.get()?.mBinding?.wh?.apply { post { loadUrl(url) } } } private fun callViewManga(content: String) = Thread{ val listChapter = content.split('\n') if(!saveUrlsOnly) { @@ -48,7 +65,7 @@ class MainHandler(looper: Looper):Handler(looper) { } }.start() private fun updateLoadProgress(p: Int) { - wm?.get()?.pw?.apply { post { + wm?.get()?.mBinding?.pw?.apply { post { if(progress == 100 && p < 100) { progress = 0 visibility = View.VISIBLE @@ -57,8 +74,8 @@ class MainHandler(looper: Looper):Handler(looper) { if(p == 100) postDelayed({ visibility = View.GONE }, 500) } } } - private fun showFab() { wm?.get()?.fab?.apply { post { visibility = View.VISIBLE } } } - private fun hideFab() { wm?.get()?.fab?.apply { post { visibility = View.GONE } } } + private fun showFab() { wm?.get()?.mBinding?.fab?.apply { post { visibility = View.VISIBLE } } } + private fun hideFab() { wm?.get()?.mBinding?.fab?.apply { post { visibility = View.GONE } } } private fun setFab(content: String) { //Log.d("MyMH", "Get chapter json: $content") showDlList = false diff --git a/app/src/main/java/top/fumiama/copymangaweb/tool/DownloadTools.kt b/app/src/main/java/top/fumiama/copymangaweb/tool/DownloadTools.kt index 130eb44..e16dd9f 100644 --- a/app/src/main/java/top/fumiama/copymangaweb/tool/DownloadTools.kt +++ b/app/src/main/java/top/fumiama/copymangaweb/tool/DownloadTools.kt @@ -7,12 +7,12 @@ import java.util.concurrent.Callable import java.util.concurrent.FutureTask class DownloadTools { - fun getHttpContent(Url: String, refer: String? = null, ua: String? = null): ByteArray? { - Log.d("Mydl", "getHttp: $Url") + fun getHttpContent(u: String, refer: String? = null, ua: String? = null): ByteArray? { + Log.d("Mydl", "getHttp: $u") var ret: ByteArray? = null val task = FutureTask(Callable { try { - val connection = URL(Url).openConnection() as HttpURLConnection + val connection = URL(u).openConnection() as HttpURLConnection connection.requestMethod = "GET" connection.connectTimeout = 10000 connection.readTimeout = 10000 diff --git a/app/src/main/java/top/fumiama/copymangaweb/tool/MangaDlTools.kt b/app/src/main/java/top/fumiama/copymangaweb/tool/MangaDlTools.kt index b3ff842..a16112f 100644 --- a/app/src/main/java/top/fumiama/copymangaweb/tool/MangaDlTools.kt +++ b/app/src/main/java/top/fumiama/copymangaweb/tool/MangaDlTools.kt @@ -2,7 +2,6 @@ package top.fumiama.copymangaweb.tool import top.fumiama.copymangaweb.R import top.fumiama.copymangaweb.activity.DlActivity -import kotlinx.android.synthetic.main.activity_dl.* import java.io.File import java.lang.Thread.sleep import java.lang.ref.WeakReference @@ -16,7 +15,7 @@ class MangaDlTools(activity: DlActivity) { var exit = false private val sem = Semaphore(1) private val da = WeakReference(activity) - private val d = da.get() + private val d get() = da.get() private val p = PropertiesTools(File("${d?.filesDir}/chapters.hash")) private var imgUrlsList: Array?>? = null private var chaptersCount = 0 @@ -38,7 +37,7 @@ class MangaDlTools(activity: DlActivity) { sem.acquire() da.get()?.apply { p[url.substringAfterLast("/")] = (chaptersCount++).toString() - runOnUiThread { dwh.loadUrl(url) } + runOnUiThread { mBinding.dwh.apply { post { loadUrl(url) } } } } } @@ -48,7 +47,7 @@ class MangaDlTools(activity: DlActivity) { } fun dlChapterAndPackIntoZip(zipf: File, hash: String){ - imgUrlsList?.get(p[hash].toInt())?.let { + imgUrlsList?.get(p[hash].toInt())?.let { images -> val dl = DownloadTools() zipf.parentFile?.let { if (!it.exists()) it.mkdirs() } if (zipf.exists()) zipf.delete() @@ -56,12 +55,16 @@ class MangaDlTools(activity: DlActivity) { val zip = ZipOutputStream(CheckedOutputStream(zipf.outputStream(), CRC32())) zip.setLevel(9) var succeed = true - for (i in it.indices) { + for (i in images.indices) { zip.putNextEntry(ZipEntry("$i.webp")) var tryTimes = 3 var s = false while (!s && tryTimes-- > 0){ - s = dl.getHttpContent(it[i], d?.getString(R.string.web_home_www), d?.getString(R.string.pc_ua))?.let { zip.write(it); true } ?: false + s = d?.toolsBox?.resolution?.wrap(images[i])?.let { u -> + dl.getHttpContent(u, d?.getString(R.string.web_home_www), + d?.getString(R.string.pc_ua) + )?.let { zip.write(it); true } ?: false + } ?: false if (!s) { onDownloadedListener?.handleMessage(i + 1) sleep(2000) diff --git a/app/src/main/java/top/fumiama/copymangaweb/tool/PagesManager.kt b/app/src/main/java/top/fumiama/copymangaweb/tool/PagesManager.kt index 2baf6a8..dcb02b2 100644 --- a/app/src/main/java/top/fumiama/copymangaweb/tool/PagesManager.kt +++ b/app/src/main/java/top/fumiama/copymangaweb/tool/PagesManager.kt @@ -2,7 +2,6 @@ package top.fumiama.copymangaweb.tool import android.content.Intent import android.widget.Toast -import kotlinx.android.synthetic.main.activity_main.* import top.fumiama.copymangaweb.activity.MainActivity.Companion.wm import top.fumiama.copymangaweb.activity.ViewMangaActivity import java.io.File @@ -14,8 +13,8 @@ class PagesManager(w: WeakReference) { private var isEndR = false fun toPreviousPage(){ toPage(v?.r2l==true) } fun toNextPage(){ toPage(v?.r2l!=true) } - private fun judgePrevious() = v?.pageNum?:0 > 1 - private fun judgeNext() = v?.pageNum?:0 < v?.count?:0 + private fun judgePrevious() = (v?.pageNum ?: 0) > 1 + private fun judgeNext() = (v?.pageNum ?: 0) < (v?.count ?: 0) private fun toPage(goNext:Boolean){ if (v?.clicked == false) { if (if(goNext)judgeNext() else judgePrevious()) { @@ -31,13 +30,16 @@ class PagesManager(w: WeakReference) { if (chapterUrl != null) { if (if(goNext)isEndR else isEndL) { if(!goNext) ViewMangaActivity.pn = -2 - wm?.get()?.w?.loadUrl("javascript:invoke.clickClass(\"comicControlBottomTopClick\",${if(goNext)1 else 0});") + wm?.get()?.mBinding?.w?.apply { post { + loadUrl("javascript:invoke.clickClass(\"comicControlBottomTopClick\",${if(goNext)1 else 0});") + } } v.tt.canDo = false v.finish() } else doubleTapToast(goNext) } else { val newZipPosition = ViewMangaActivity.zipPosition + (if(goNext) 1 else -1) - if(v.dlZip2View && newZipPosition >= 0 && newZipPosition < ViewMangaActivity.zipList?.size?:0){ + if(v.dlZip2View && newZipPosition >= 0 && newZipPosition < + (ViewMangaActivity.zipList?.size ?: 0)){ if (if(goNext)isEndR else isEndL){ if(!goNext) ViewMangaActivity.pn = -2 ViewMangaActivity.zipPosition = newZipPosition diff --git a/app/src/main/java/top/fumiama/copymangaweb/tool/Resolution.kt b/app/src/main/java/top/fumiama/copymangaweb/tool/Resolution.kt new file mode 100644 index 0000000..e78ff70 --- /dev/null +++ b/app/src/main/java/top/fumiama/copymangaweb/tool/Resolution.kt @@ -0,0 +1,5 @@ +package top.fumiama.copymangaweb.tool + +class Resolution(private val original: Regex) { + fun wrap(u: String) : String = u.replace(original, "c1500x.") +} diff --git a/app/src/main/java/top/fumiama/copymangaweb/tool/ToolsBox.kt b/app/src/main/java/top/fumiama/copymangaweb/tool/ToolsBox.kt index 4c37ad2..dc55945 100644 --- a/app/src/main/java/top/fumiama/copymangaweb/tool/ToolsBox.kt +++ b/app/src/main/java/top/fumiama/copymangaweb/tool/ToolsBox.kt @@ -5,14 +5,15 @@ import android.app.AlertDialog import android.content.Context import android.net.ConnectivityManager import android.net.NetworkCapabilities +import android.view.View import android.widget.Toast import top.fumiama.copymangaweb.R import java.lang.ref.WeakReference import java.util.Calendar import kotlin.math.sqrt -class ToolsBox(w: WeakReference) { - val zis = w.get() +class ToolsBox(private val w: WeakReference) { + val zis get () = w.get() val week: String get() { val cal = Calendar.getInstance() @@ -43,6 +44,8 @@ class ToolsBox(w: WeakReference) { } } ?: "错误" } + val resolution = Resolution(Regex("c\\d+x\\.")) + fun toastError(s: String, willFinish: Boolean = true) { Toast.makeText(zis?.applicationContext, s, Toast.LENGTH_SHORT).show() if (willFinish) zis?.finish() @@ -66,6 +69,26 @@ class ToolsBox(w: WeakReference) { txtN?.let { info.setNeutralButton(it) { _, _ -> neutral?.let { it() } } } info.show() } + fun buildAlertWithView( + title: String, + view: View, + txtOk: String? = null, + txtN: String? = null, + txtCancel: String? = null, + ok: (() -> Unit)? = null, + neutral: (() -> Unit)? = null, + cancel: (() -> Unit)? = null + ): AlertDialog { + val info = AlertDialog.Builder(zis) + info.setIcon(R.drawable.ic_launcher_foreground) + info.setTitle(title) + + info.setView(view) + txtOk?.let { info.setPositiveButton(it) { _, _ -> ok?.let { it() } } } + txtCancel?.let { info.setNegativeButton(it) { _, _ -> cancel?.let { it() } } } + txtN?.let { info.setNeutralButton(it) { _, _ -> neutral?.let { it() } } } + return info.show() + } fun dp2px(dp:Int):Int?{ return zis?.resources?.displayMetrics?.density?.let { (dp * it + 0.5).toInt()} } diff --git a/app/src/main/java/top/fumiama/copymangaweb/tool/Updater.kt b/app/src/main/java/top/fumiama/copymangaweb/tool/Updater.kt new file mode 100644 index 0000000..8ad0f46 --- /dev/null +++ b/app/src/main/java/top/fumiama/copymangaweb/tool/Updater.kt @@ -0,0 +1,124 @@ +package top.fumiama.copymangaweb.tool + +import android.app.Activity +import android.app.AlertDialog +import android.content.Context.MODE_PRIVATE +import android.content.Intent +import android.net.Uri +import android.os.Build +import android.util.Log +import android.widget.ProgressBar +import android.widget.Toast +import androidx.core.content.FileProvider +import androidx.core.content.edit +import androidx.lifecycle.lifecycleScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext +import top.fumiama.copymangaweb.R +import top.fumiama.copymangaweb.activity.template.ToolsBoxActivity +import top.fumiama.sdict.ApkUpdater +import top.fumiama.sdict.io.Client +import java.io.File +import java.lang.ref.WeakReference + +class Updater( + private val a: WeakReference, private val toolsBox: ToolsBox, + private val ignoreSkip: Boolean, private val skipNum: Int, +): ApkUpdater("reilia.fumiama.top", 13213, "fumiama") { + private var mInfo: AlertDialog? = null + set(value) { + field?.dismiss() + field = value + } + + override suspend fun onCheckLatestVersion(version: Int) { + super.onCheckLatestVersion(version) + a.get()?.apply { + if (ignoreSkip) withContext(Dispatchers.Main) { + Toast.makeText(this@apply, "无更新", Toast.LENGTH_SHORT).show() + } + } + } + + override suspend fun onCheckNewVersion(version: Int, message: String, md5: String?) { + super.onCheckNewVersion(version, message, md5) + if (md5 == null) { + withContext(Dispatchers.Main) { + toolsBox.buildInfo("看板", message, "知道了") + } + return + } + if(skipNum < version || ignoreSkip) { + val progressBar = + a.get()?.layoutInflater?.inflate(R.layout.dialog_progress, null, false) ?: return + val progressHandler = object : Client.Progress { + override fun notify(progressPercentage: Int) { + Log.d("MyUP", "Set progress: $progressPercentage") + progressBar.findViewById(R.id.dpp)?.progress = progressPercentage + } + } + withContext(Dispatchers.Main) { + toolsBox.buildInfo("看板", message, "下载新版", "跳过该版", "取消", { + mInfo = toolsBox.buildAlertWithView("下载进度", progressBar, "隐藏") + a.get()?.lifecycleScope?.launch { withContext(Dispatchers.IO) { + download(md5, progressHandler) + } } + }, { + a.get()?.apply { + getPreferences(MODE_PRIVATE).edit { + putInt("skipVersion", version) + apply() + } + } + }) + } + } + } + + override suspend fun onDownloadNewVersionFailed(cause: Int) { + super.onDownloadNewVersionFailed(cause) + withContext(Dispatchers.Main) { + mInfo?.dismiss() + mInfo = null + when (cause) { + UPDATE_FAIL_NETWORK -> a.get()?.apply { + Toast.makeText(this@apply, "网络错误", Toast.LENGTH_SHORT).show() + } + UPDATE_FAIL_FILE_CORRUPT -> a.get()?.apply { + Toast.makeText(this@apply, "文件损坏", Toast.LENGTH_SHORT).show() + } + else -> {} + } + } + } + + override suspend fun onDownloadNewVersionSuccess(data: ByteArray) { + super.onDownloadNewVersionSuccess(data) + withContext(Dispatchers.Main) { + mInfo?.dismiss() + mInfo = null + a.get()?.apply { + Toast.makeText(this@apply, "下载成功", Toast.LENGTH_SHORT).show() + install(data, this) + } + } + } + + private suspend fun install(data: ByteArray, activity: Activity) = activity.apply { + withContext(Dispatchers.IO) { + val f = File(externalCacheDir, "new.apk") + f.writeBytes(data) + val intent = Intent(Intent.ACTION_VIEW) + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) + val contentUri: Uri = FileProvider.getUriForFile(this@apply, "$packageName.fileprovider", f) + intent.setDataAndType(contentUri, "application/vnd.android.package-archive") + } else intent.setDataAndType(Uri.fromFile(f), "application/vnd.android.package-archive") + withContext(Dispatchers.Main) { + startActivity(intent) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/top/fumiama/copymangaweb/view/JSWebView.kt b/app/src/main/java/top/fumiama/copymangaweb/view/JSWebView.kt index 679f1aa..e052993 100644 --- a/app/src/main/java/top/fumiama/copymangaweb/view/JSWebView.kt +++ b/app/src/main/java/top/fumiama/copymangaweb/view/JSWebView.kt @@ -7,7 +7,7 @@ import android.util.Log import android.webkit.WebView import top.fumiama.copymangaweb.web.WebViewClient -@SuppressLint("JavascriptInterface") +@SuppressLint("JavascriptInterface", "SetJavaScriptEnabled") class JSWebView : WebView { constructor(context: Context): super(context) constructor(context: Context, attributeSet: AttributeSet): super(context, attributeSet) diff --git a/app/src/main/java/top/fumiama/copymangaweb/view/LazyScrollView.kt b/app/src/main/java/top/fumiama/copymangaweb/view/LazyScrollView.kt index f490982..76b9d73 100644 --- a/app/src/main/java/top/fumiama/copymangaweb/view/LazyScrollView.kt +++ b/app/src/main/java/top/fumiama/copymangaweb/view/LazyScrollView.kt @@ -21,13 +21,11 @@ class LazyScrollView : ScrollView { when (event.action) { MotionEvent.ACTION_UP -> this.postDelayed({ if (view != null && onScrollListener != null) { - if (onScrollListener != null) { - //Log.d("MyS", "view?.measuredHeight: ${view?.measuredHeight}, scrollY: $scrollY, height: $height") - when { - view?.measuredHeight?:0 <= scrollY + height -> onScrollListener?.onBottom() - scrollY == 0 -> onScrollListener?.onTop() - else -> onScrollListener?.onScroll() - } + //Log.d("MyS", "view?.measuredHeight: ${view?.measuredHeight}, scrollY: $scrollY, height: $height") + when { + (view?.measuredHeight ?: 0) <= scrollY + height -> onScrollListener?.onBottom() + scrollY == 0 -> onScrollListener?.onTop() + else -> onScrollListener?.onScroll() } } }, 233) diff --git a/app/src/main/java/top/fumiama/copymangaweb/web/WebViewClient.kt b/app/src/main/java/top/fumiama/copymangaweb/web/WebViewClient.kt index f8dc83c..5f958c9 100644 --- a/app/src/main/java/top/fumiama/copymangaweb/web/WebViewClient.kt +++ b/app/src/main/java/top/fumiama/copymangaweb/web/WebViewClient.kt @@ -2,9 +2,10 @@ package top.fumiama.copymangaweb.web import android.content.Context import android.graphics.Bitmap -import android.net.http.SslError import android.util.Log -import android.webkit.* +import android.webkit.WebResourceRequest +import android.webkit.WebResourceResponse +import android.webkit.WebView import android.webkit.WebViewClient import android.widget.Toast import top.fumiama.copymangaweb.R diff --git a/app/src/main/res/drawable-anydpi/ic_dere.xml b/app/src/main/res/drawable-anydpi/ic_dere.xml new file mode 100644 index 0000000..d1eb1c3 --- /dev/null +++ b/app/src/main/res/drawable-anydpi/ic_dere.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_dl.xml b/app/src/main/res/layout/activity_dl.xml index a0d9adf..622c440 100644 --- a/app/src/main/res/layout/activity_dl.xml +++ b/app/src/main/res/layout/activity_dl.xml @@ -50,6 +50,7 @@ - - - - - - + + android:layout_height="match_parent"> - + - + - \ No newline at end of file + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_progress.xml b/app/src/main/res/layout/dialog_progress.xml new file mode 100644 index 0000000..3ff07dd --- /dev/null +++ b/app/src/main/res/layout/dialog_progress.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/page_imgview.xml b/app/src/main/res/layout/page_imgview.xml index db257b5..b9e4645 100644 --- a/app/src/main/res/layout/page_imgview.xml +++ b/app/src/main/res/layout/page_imgview.xml @@ -1,14 +1,16 @@ - - - + + android:layout_height="match_parent"> - \ No newline at end of file + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/widget_downloadbar.xml b/app/src/main/res/layout/widget_downloadbar.xml index bdb32d2..64578a9 100644 --- a/app/src/main/res/layout/widget_downloadbar.xml +++ b/app/src/main/res/layout/widget_downloadbar.xml @@ -1,69 +1,71 @@ - + xmlns:tools="http://schemas.android.com/tools"> + - + - + - + - + - - - + + + - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/widget_infodrawer.xml b/app/src/main/res/layout/widget_infodrawer.xml index 44d1070..5821780 100644 --- a/app/src/main/res/layout/widget_infodrawer.xml +++ b/app/src/main/res/layout/widget_infodrawer.xml @@ -1,97 +1,99 @@ - + xmlns:tools="http://schemas.android.com/tools"> + - + - + - + - + - + - + - - - - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/widget_titlebar.xml b/app/src/main/res/layout/widget_titlebar.xml index 322afe1..1741b9a 100644 --- a/app/src/main/res/layout/widget_titlebar.xml +++ b/app/src/main/res/layout/widget_titlebar.xml @@ -1,60 +1,62 @@ - - - + + android:layout_height="match_parent"> - + android:layout_height="48dp" + android:foreground="?android:attr/selectableItemBackground" + app:cardBackgroundColor="#FFFFFF" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> - + - + - + - + - - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/widget_viewmangainfo.xml b/app/src/main/res/layout/widget_viewmangainfo.xml index cbae99d..8c71e5d 100644 --- a/app/src/main/res/layout/widget_viewmangainfo.xml +++ b/app/src/main/res/layout/widget_viewmangainfo.xml @@ -1,52 +1,54 @@ - - - - + xmlns:tools="http://schemas.android.com/tools"> + tools:viewBindingIgnore="true" + android:layout_width="match_parent" + android:layout_height="match_parent"> - - + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/inftitle"> + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b00d931..547bc4c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -7,4 +7,15 @@ Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36 Edg/86.0.622.38 已屏蔽其他网站页面 + 加载中… + 音量翻页关 + 音量翻页开 + 横向 + 竖向 + 动画开 + 动画关 + ←前 后→ + ←后 前→ + 0/0 + 单击此处下载/暂停 长按此处全选/清空 长按某话删除 \ No newline at end of file diff --git a/app/src/main/res/xml/provider_paths.xml b/app/src/main/res/xml/provider_paths.xml new file mode 100644 index 0000000..c1a5d89 --- /dev/null +++ b/app/src/main/res/xml/provider_paths.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 33274a9..03aeebc 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { maven { url "https://jitpack.io" } } dependencies { - classpath 'com.android.tools.build:gradle:8.3.2' + classpath 'com.android.tools.build:gradle:8.6.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong diff --git a/gradle.properties b/gradle.properties index 26f80b4..c743e44 100644 --- a/gradle.properties +++ b/gradle.properties @@ -23,4 +23,4 @@ android.enableR8.fullMode=true android.defaults.buildfeatures.buildconfig=true android.nonTransitiveRClass=false android.nonFinalResIds=false -cm_kotlin_version=1.7.10 \ No newline at end of file +cm_kotlin_version=2.1.0 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 9b0e40c..0c1324d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Sep 04 18:15:43 CST 2020 +#Sun Jun 22 01:57:19 JST 2025 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip \ No newline at end of file