mirror of
https://github.com/fumiama/copymanga.git
synced 2026-06-12 11:40:27 +08:00
2.0.beta13
1. 解决一些闪退 2. 增加设置页面 3. 升级ABI
This commit is contained in:
4
.idea/misc.xml
generated
4
.idea/misc.xml
generated
@@ -10,6 +10,7 @@
|
||||
<entry key="app/src/main/res/layout/activity_dlist.xml" value="0.48641304347826086" />
|
||||
<entry key="app/src/main/res/layout/activity_login.xml" value="0.49592391304347827" />
|
||||
<entry key="app/src/main/res/layout/activity_main.xml" value="0.5095108695652174" />
|
||||
<entry key="app/src/main/res/layout/activity_viewmanga.xml" value="0.5395833333333333" />
|
||||
<entry key="app/src/main/res/layout/app_bar_main.xml" value="0.5095108695652174" />
|
||||
<entry key="app/src/main/res/layout/card_book.xml" value="0.49592391304347827" />
|
||||
<entry key="app/src/main/res/layout/card_book_plain.xml" value="0.49592391304347827" />
|
||||
@@ -18,6 +19,7 @@
|
||||
<entry key="app/src/main/res/layout/fragment_chapters.xml" value="0.49592391304347827" />
|
||||
<entry key="app/src/main/res/layout/fragment_download.xml" value="0.49592391304347827" />
|
||||
<entry key="app/src/main/res/layout/fragment_home.xml" value="0.4376278118609407" />
|
||||
<entry key="app/src/main/res/layout/fragment_settings.xml" value="0.5255208333333333" />
|
||||
<entry key="app/src/main/res/layout/line_1bookline.xml" value="0.49592391304347827" />
|
||||
<entry key="app/src/main/res/layout/line_bookinfo.xml" value="0.49592391304347827" />
|
||||
<entry key="app/src/main/res/layout/line_booktandb.xml" value="0.48596014492753625" />
|
||||
@@ -28,7 +30,9 @@
|
||||
<entry key="app/src/main/res/layout/nav_header_main.xml" value="0.48596014492753625" />
|
||||
<entry key="app/src/main/res/layout/viewpage_banner.xml" value="0.49592391304347827" />
|
||||
<entry key="app/src/main/res/layout/viewpage_horizonal.xml" value="0.49592391304347827" />
|
||||
<entry key="app/src/main/res/layout/widget_infodrawer.xml" value="0.5395833333333333" />
|
||||
<entry key="app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" value="0.5572916666666666" />
|
||||
<entry key="app/src/main/res/xml/pref_setting.xml" value="0.6289537712895377" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
@@ -3,12 +3,12 @@ apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
|
||||
android {
|
||||
compileSdkVersion 31
|
||||
compileSdkVersion 33
|
||||
|
||||
defaultConfig {
|
||||
applicationId 'top.fumiama.copymanga'
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 31
|
||||
targetSdkVersion 33
|
||||
versionCode 24
|
||||
versionName '2.0.beta12'
|
||||
resConfigs "zh", "zh-rCN"
|
||||
@@ -53,18 +53,17 @@ android {
|
||||
dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
implementation 'androidx.core:core-ktx:1.7.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.4.1'
|
||||
implementation 'androidx.core:core-ktx:1.9.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.5.1'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'com.google.android.material:material:1.5.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.4.1'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.4.1'
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.4.1'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.4.1'
|
||||
implementation 'com.google.android.material:material:1.6.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.2'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.5.2'
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.2'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.5.2'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
implementation "androidx.preference:preference-ktx:1.2.0"
|
||||
implementation 'com.afollestad.material-dialogs:input:3.3.0'
|
||||
implementation 'com.github.yalantis:ucrop:2.2.6'
|
||||
implementation 'com.to.aboomy:pager2banner:1.0.1'
|
||||
|
||||
@@ -28,7 +28,6 @@ open class MangaPagesFragmentTemplate(inflateRes:Int, val isLazy: Boolean = true
|
||||
var isRefresh = false
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@ExperimentalStdlibApi
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.lang.ref.WeakReference
|
||||
open class InfoCardLoader(inflateRes:Int, private val navId:Int, private val isTypeBook: Boolean = false): MangaPagesFragmentTemplate(inflateRes) {
|
||||
var offset = 0
|
||||
private val subUrl get() = getApiUrl()
|
||||
private var ad: AutoDownloadThread? = null
|
||||
var ad: AutoDownloadThread? = null
|
||||
init {
|
||||
pageHandler = object : PageHandler {
|
||||
override fun addPage(){
|
||||
@@ -32,6 +32,7 @@ open class InfoCardLoader(inflateRes:Int, private val navId:Int, private val isT
|
||||
if(results.offset < results.total) {
|
||||
if(code == 200) {
|
||||
results.list.forEach { book ->
|
||||
if(ad?.exit == true) return@AutoDownloadThread
|
||||
cardList.addCard(book.comic.name, null, book.comic.cover, book.comic.path_word, null, null, false)
|
||||
}
|
||||
offset += results.list.size
|
||||
@@ -46,6 +47,7 @@ open class InfoCardLoader(inflateRes:Int, private val navId:Int, private val isT
|
||||
if(results.offset < results.total) {
|
||||
if(code == 200) {
|
||||
results.list.forEach{ book ->
|
||||
if(ad?.exit == true) return@AutoDownloadThread
|
||||
cardList.addCard(book.name, null, book.cover, book.path_word, null, null, false)
|
||||
}
|
||||
offset += results.list.size
|
||||
|
||||
@@ -3,7 +3,7 @@ package top.fumiama.copymanga.tools.api
|
||||
import com.bumptech.glide.load.model.LazyHeaders
|
||||
import top.fumiama.dmzj.copymanga.R
|
||||
import top.fumiama.copymanga.MainActivity
|
||||
import top.fumiama.copymanga.json.Chapter2Return
|
||||
import top.fumiama.copymanga.ui.settings.SettingsFragment.Companion.settingsPref
|
||||
import java.io.File
|
||||
|
||||
object CMApi {
|
||||
@@ -15,7 +15,7 @@ object CMApi {
|
||||
.addHeader("User-Agent", MainActivity.mainWeakReference?.get()?.getString(R.string.pc_ua)!!)
|
||||
.addHeader("source", "copyApp")
|
||||
.addHeader("webp", "1")
|
||||
.addHeader("region", "1")
|
||||
.addHeader("region", if(settingsPref?.getBoolean("", false) == false) "1" else "0")
|
||||
.addHeader("platform", "3")
|
||||
.build()
|
||||
return field
|
||||
|
||||
@@ -29,13 +29,13 @@ class DownloadPool(folder: String) {
|
||||
}
|
||||
|
||||
operator fun plusAssign(quest: Quest) {
|
||||
packZipFile(quest.fileName, quest.imgUrl, quest.refer?:"")
|
||||
packZipFile(quest.fileName, quest.imgUrl, quest.refer)
|
||||
}
|
||||
|
||||
operator fun plusAssign(quests: Array<Quest>) {
|
||||
Thread{
|
||||
quests.forEach { quest ->
|
||||
packZipFile(quest.fileName, quest.imgUrl, quest.refer?:"")
|
||||
packZipFile(quest.fileName, quest.imgUrl, quest.refer)
|
||||
sleep(1000)
|
||||
}
|
||||
}.start()
|
||||
@@ -49,7 +49,7 @@ class DownloadPool(folder: String) {
|
||||
mOnPageDownloadListener = onPageDownloadListener
|
||||
}
|
||||
|
||||
private fun packZipFile(fileName: String, imgUrls: Array<String>, refer: String) {
|
||||
private fun packZipFile(fileName: String, imgUrls: Array<String>, refer: String?) {
|
||||
Thread{
|
||||
File(saveFolder, fileName).let { f ->
|
||||
f.parentFile?.let { if(!it.exists()) it.mkdirs() }
|
||||
|
||||
@@ -3,6 +3,7 @@ package top.fumiama.copymanga.tools.http
|
||||
import android.util.Log
|
||||
import top.fumiama.copymanga.tools.ssl.AllTrustManager
|
||||
import top.fumiama.copymanga.tools.ssl.IgnoreHostNameVerifier
|
||||
import top.fumiama.copymanga.ui.settings.SettingsFragment.Companion.settingsPref
|
||||
import java.io.File
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
@@ -44,7 +45,7 @@ object DownloadTools {
|
||||
refer?.let { setRequestProperty("referer", it) }
|
||||
setRequestProperty("source", "copyApp")
|
||||
setRequestProperty("webp", "1")
|
||||
setRequestProperty("region", "0")
|
||||
setRequestProperty("region", if(settingsPref?.getBoolean("", false) == false) "1" else "0")
|
||||
setRequestProperty("authorization", "Token")
|
||||
setRequestProperty("platform", "3")
|
||||
ua?.let { setRequestProperty("User-agent", it) }
|
||||
|
||||
@@ -232,9 +232,11 @@ class BookHandler(that: WeakReference<BookFragment>, private val path: String)
|
||||
that?.apply {
|
||||
book?.results?.apply {
|
||||
mainWeakReference?.get()?.runOnUiThread{
|
||||
if(exit) return@runOnUiThread
|
||||
ViewMangaActivity.fileArray = arrayOf()
|
||||
ViewMangaActivity.urlArray = arrayOf()
|
||||
vols?.forEachIndexed { iv, v ->
|
||||
if(exit) return@runOnUiThread
|
||||
fbl.addView(layoutInflater.inflate(R.layout.div_h, fbl, false))
|
||||
val t = layoutInflater.inflate(R.layout.line_caption, fbl, false)
|
||||
t.tcptn.text = keys[iv]
|
||||
|
||||
@@ -36,8 +36,10 @@ class SortFragment : InfoCardLoader(R.layout.fragment_sort, R.id.action_nav_sort
|
||||
setUpdate()
|
||||
setHot()
|
||||
AutoDownloadThread(getString(R.string.filterApiUrl)) {
|
||||
if(ad?.exit == true) return@AutoDownloadThread
|
||||
it?.let {
|
||||
filter = Gson().fromJson(it.inputStream().reader(), FilterStructure::class.java)
|
||||
if(ad?.exit == true) return@AutoDownloadThread
|
||||
mainWeakReference?.get()?.runOnUiThread{
|
||||
setClasses()
|
||||
}
|
||||
@@ -53,6 +55,7 @@ class SortFragment : InfoCardLoader(R.layout.fragment_sort, R.id.action_nav_sort
|
||||
}
|
||||
|
||||
private fun setUpdate(){
|
||||
if(ad?.exit == true) return
|
||||
line_sort_time.apt.setText(R.string.menu_update_time)
|
||||
line_sort_time.setOnClickListener {
|
||||
sortValue = if(it.apim.rotation == 0f) {
|
||||
@@ -71,6 +74,7 @@ class SortFragment : InfoCardLoader(R.layout.fragment_sort, R.id.action_nav_sort
|
||||
|
||||
private fun setClasses(){
|
||||
filter?.results?.theme?.let { items ->
|
||||
if(ad?.exit == true) return@let
|
||||
line_sort_class.apt.text = "全部"
|
||||
line_sort_class.setOnClickListener {
|
||||
val popupMenu = popupMenu {
|
||||
@@ -108,6 +112,7 @@ class SortFragment : InfoCardLoader(R.layout.fragment_sort, R.id.action_nav_sort
|
||||
}
|
||||
|
||||
private fun setHot() {
|
||||
if(ad?.exit == true) return
|
||||
line_sort_hot.apt.setText(R.string.menu_hot)
|
||||
line_sort_hot.setOnClickListener {
|
||||
sortValue = if (it.apim.rotation == 0f) {
|
||||
|
||||
@@ -25,10 +25,12 @@ class TopicFragment : InfoCardLoader(R.layout.fragment_topic, R.id.action_nav_to
|
||||
AutoDownloadThread(getString(R.string.topicApiUrl).let {
|
||||
String.format(it, arguments?.getString("path"))
|
||||
}) {
|
||||
if(ad?.exit == true) return@AutoDownloadThread
|
||||
it?.apply {
|
||||
val r = inputStream().reader()
|
||||
val topic = Gson().fromJson(r, TopicStructure::class.java)
|
||||
topic?.apply {
|
||||
if(ad?.exit == true) return@AutoDownloadThread
|
||||
mainWeakReference?.get()?.let {
|
||||
it.runOnUiThread {
|
||||
it.toolbar.title = results.title
|
||||
|
||||
@@ -1,7 +1,20 @@
|
||||
package top.fumiama.copymanga.ui.settings
|
||||
|
||||
import android.content.SharedPreferences
|
||||
import android.os.Bundle
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import androidx.preference.PreferenceManager
|
||||
import androidx.preference.SeekBarPreference
|
||||
import top.fumiama.dmzj.copymanga.R
|
||||
import top.fumiama.copymanga.template.general.NoBackRefreshFragment
|
||||
|
||||
class SettingsFragment: NoBackRefreshFragment(R.layout.fragment_settings) {
|
||||
}
|
||||
class SettingsFragment: PreferenceFragmentCompat() {
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
setPreferencesFromResource(R.xml.pref_setting, rootKey)
|
||||
settingsPref = context?.let { PreferenceManager.getDefaultSharedPreferences(it) }
|
||||
}
|
||||
|
||||
companion object {
|
||||
var settingsPref: SharedPreferences? = null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,14 +120,12 @@ class VMHandler(activity: ViewMangaActivity, url: String) : AutoDownloadHandler(
|
||||
wv.get()?.toolsBox?.toastError("下载章节信息失败")
|
||||
}
|
||||
|
||||
@ExperimentalStdlibApi
|
||||
override fun doWhenFinishDownload() {
|
||||
super.doWhenFinishDownload()
|
||||
if(exit) return
|
||||
prepareManga()
|
||||
}
|
||||
|
||||
@ExperimentalStdlibApi
|
||||
fun loadFromFile(file: File): Boolean {
|
||||
return try {
|
||||
val jsonFile = File(file.parentFile, "${file.nameWithoutExtension}.json")
|
||||
@@ -157,7 +155,6 @@ class VMHandler(activity: ViewMangaActivity, url: String) : AutoDownloadHandler(
|
||||
}
|
||||
}
|
||||
|
||||
@ExperimentalStdlibApi
|
||||
private fun prepareManga(){
|
||||
if(comicName == null) {
|
||||
comicName = manga?.results?.comic?.name
|
||||
|
||||
@@ -87,7 +87,6 @@ class ViewMangaActivity : TitleActivityTemplate() {
|
||||
private var pm: PagesManager? = null
|
||||
val realCount get() = if(cut) indexMap.size else count
|
||||
|
||||
@ExperimentalStdlibApi
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
setContentView(R.layout.activity_viewmanga)
|
||||
@@ -131,7 +130,7 @@ class ViewMangaActivity : TitleActivityTemplate() {
|
||||
}
|
||||
}
|
||||
|
||||
@ExperimentalStdlibApi
|
||||
@OptIn(ExperimentalStdlibApi::class)
|
||||
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
|
||||
var flag = false
|
||||
if(volTurnPage) when(keyCode) {
|
||||
@@ -220,7 +219,7 @@ class ViewMangaActivity : TitleActivityTemplate() {
|
||||
}
|
||||
}
|
||||
|
||||
@ExperimentalStdlibApi
|
||||
@OptIn(ExperimentalStdlibApi::class)
|
||||
fun initManga(){
|
||||
handler.manga?.results?.chapter?.uuid?.let {
|
||||
pn = getPreferences(MODE_PRIVATE).getInt(it, pn)
|
||||
@@ -230,7 +229,6 @@ class ViewMangaActivity : TitleActivityTemplate() {
|
||||
if (!isVertical) restorePN()
|
||||
}
|
||||
|
||||
@ExperimentalStdlibApi
|
||||
private fun prepareImgFromWeb() {
|
||||
if(!noCellarAlert && toolsBox.netinfo == "移动数据") alertCellar()
|
||||
else handler.startLoad()
|
||||
@@ -244,7 +242,6 @@ class ViewMangaActivity : TitleActivityTemplate() {
|
||||
return op.outWidth.toFloat() / op.outHeight.toFloat() > 1
|
||||
}
|
||||
|
||||
@ExperimentalStdlibApi
|
||||
fun countZipEntries(doWhenFinish : (count: Int) -> Unit) = Thread{
|
||||
if (zipFile != null) try {
|
||||
Log.d("Myvm", "zip: $zipFile")
|
||||
|
||||
@@ -698,7 +698,7 @@ class ScaleImageView : ImageView {
|
||||
private val isBig: Boolean
|
||||
get() = getMatrixScale(mOuterMatrix)[0] > 1f
|
||||
|
||||
@ExperimentalStdlibApi
|
||||
@OptIn(ExperimentalStdlibApi::class)
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
override fun onTouchEvent(event: MotionEvent): Boolean {
|
||||
super.onTouchEvent(event)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<top.fumiama.copymanga.ui.settings.SettingsFragment
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</top.fumiama.copymanga.ui.settings.SettingsFragment>
|
||||
@@ -80,4 +80,16 @@
|
||||
|
||||
<string name="author">作者</string>
|
||||
<string name="caption">标签</string>
|
||||
|
||||
<string name="settings_cat_net">网络</string>
|
||||
<string name="settings_cat_net_sw_use_foreign">使用海外线路</string>
|
||||
<string name="settings_cat_net_sm_use_foreign">不管使用什么线路, API访问均是海外, 只有图片CDN可能会变化, 请酌情选择使用</string>
|
||||
|
||||
<string name="settings_cat_vm">漫画浏览</string>
|
||||
<string name="settings_cat_vm_sw_vol_turn">音量键翻页</string>
|
||||
<string name="settings_cat_vm_sm_vol_turn">使用音量上下键前后翻页</string>
|
||||
<string name="settings_cat_vm_sb_vertical_max">竖向翻页一次加载页数</string>
|
||||
<string name="settings_cat_vm_sm_vertical_max">默认为20</string>
|
||||
<string name="settings_cat_vm_sb_quality">图片质量</string>
|
||||
<string name="settings_cat_vm_sm_quality">默认为100</string>
|
||||
</resources>
|
||||
40
app/src/main/res/xml/pref_setting.xml
Normal file
40
app/src/main/res/xml/pref_setting.xml
Normal file
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<PreferenceCategory
|
||||
app:iconSpaceReserved="false"
|
||||
app:title="@string/settings_cat_net">
|
||||
<SwitchPreferenceCompat
|
||||
app:iconSpaceReserved="false"
|
||||
app:key="settings_cat_net_sw_use_foreign"
|
||||
app:selectable="true"
|
||||
app:summary="@string/settings_cat_net_sm_use_foreign"
|
||||
app:title="@string/settings_cat_net_sw_use_foreign" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory
|
||||
app:iconSpaceReserved="false"
|
||||
app:title="@string/settings_cat_vm">
|
||||
<SwitchPreferenceCompat
|
||||
app:iconSpaceReserved="false"
|
||||
app:key="settings_cat_vm_sw_vol_turn"
|
||||
app:selectable="true"
|
||||
app:summary="@string/settings_cat_vm_sm_vol_turn"
|
||||
app:title="@string/settings_cat_vm_sw_vol_turn" />
|
||||
<SeekBarPreference
|
||||
android:defaultValue="20"
|
||||
app:defaultValue="true"
|
||||
app:iconSpaceReserved="false"
|
||||
app:key="settings_cat_vm_sb_vertical_max"
|
||||
app:showSeekBarValue="true"
|
||||
app:summary="@string/settings_cat_vm_sm_vertical_max"
|
||||
app:title="@string/settings_cat_vm_sb_vertical_max" />
|
||||
<SeekBarPreference
|
||||
android:defaultValue="100"
|
||||
app:defaultValue="true"
|
||||
app:iconSpaceReserved="false"
|
||||
app:key="settings_cat_vm_sb_quality"
|
||||
app:showSeekBarValue="true"
|
||||
app:summary="@string/settings_cat_vm_sm_quality"
|
||||
app:title="@string/settings_cat_vm_sb_quality" />
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
@@ -1,6 +1,6 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.5.31'
|
||||
ext.kotlin_version = '1.6.10'
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
|
||||
Reference in New Issue
Block a user