mirror of
https://github.com/fumiama/copymanga.git
synced 2026-06-09 01:10:28 +08:00
2.0.beta10
1. 修复安卓7及以下主页无限弹出搜索框 2. 修复记录历史错误
This commit is contained in:
3
.idea/misc.xml
generated
3
.idea/misc.xml
generated
@@ -3,6 +3,7 @@
|
||||
<component name="DesignSurface">
|
||||
<option name="filePathToZoomLevelMap">
|
||||
<map>
|
||||
<entry key="../../.gradle/caches/transforms-3/530137dbe1613faf299d06bd64f02665/transformed/jetified-search-2.4.1/res/layout/search_view.xml" value="0.46557971014492755" />
|
||||
<entry key="app/src/main/res/drawable-anydpi/ic_like.xml" value="0.5572916666666666" />
|
||||
<entry key="app/src/main/res/drawable-anydpi/ic_setting_search.xml" value="0.5572916666666666" />
|
||||
<entry key="app/src/main/res/layout/activity_login.xml" value="0.49592391304347827" />
|
||||
@@ -14,7 +15,7 @@
|
||||
<entry key="app/src/main/res/layout/fragment_book.xml" value="0.49592391304347827" />
|
||||
<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.5095108695652174" />
|
||||
<entry key="app/src/main/res/layout/fragment_home.xml" value="0.4376278118609407" />
|
||||
<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" />
|
||||
|
||||
@@ -9,8 +9,8 @@ android {
|
||||
applicationId 'top.fumiama.copymanga'
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 31
|
||||
versionCode 21
|
||||
versionName '2.0.beta9'
|
||||
versionCode 22
|
||||
versionName '2.0.beta10'
|
||||
resConfigs "zh", "zh-rCN"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
@@ -58,10 +58,10 @@ dependencies {
|
||||
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.3.5'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
|
||||
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'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
|
||||
35
app/src/main/java/top/fumiama/copymanga/manga/Reader.kt
Normal file
35
app/src/main/java/top/fumiama/copymanga/manga/Reader.kt
Normal file
@@ -0,0 +1,35 @@
|
||||
package top.fumiama.copymanga.manga
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import androidx.core.content.edit
|
||||
import top.fumiama.copymanga.MainActivity.Companion.mainWeakReference
|
||||
import top.fumiama.copymanga.ui.vm.ViewMangaActivity
|
||||
|
||||
object Reader {
|
||||
fun viewMangaAt(name: String, pos: Int, from_first_page: Boolean = false) {
|
||||
mainWeakReference?.get()?.apply {
|
||||
getPreferences(Context.MODE_PRIVATE)?.edit {
|
||||
putInt(name, pos)
|
||||
apply()
|
||||
}
|
||||
ViewMangaActivity.dlhandler = null
|
||||
ViewMangaActivity.position = pos
|
||||
ViewMangaActivity.comicName = name
|
||||
val zipf = ViewMangaActivity.fileArray[pos]
|
||||
val intent = Intent(this, ViewMangaActivity::class.java)
|
||||
if(!from_first_page) {
|
||||
intent.putExtra("function", "log")
|
||||
ViewMangaActivity.pn = -2
|
||||
}
|
||||
if (zipf.exists()) {
|
||||
ViewMangaActivity.zipFile = zipf
|
||||
intent.putExtra("callFrom", "zipFirst")
|
||||
startActivity(intent)
|
||||
} else {
|
||||
ViewMangaActivity.zipFile = null
|
||||
startActivity(intent)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,6 @@ object CMApi {
|
||||
.build()
|
||||
return field
|
||||
}
|
||||
fun getImgZipFileFromVM(exDir: File?, chapter2Return: Chapter2Return?) = File(exDir, "${chapter2Return?.results?.comic?.name}/${chapter2Return?.results?.chapter?.group_path_word}/${chapter2Return?.results?.chapter?.name}.zip")
|
||||
fun getZipFile(exDir: File?, manga: String, caption: CharSequence, name: CharSequence) = File(exDir, "$manga/$caption/$name.zip")
|
||||
fun getApiUrl(id: Int, arg1: String?, arg2: String?) = MainActivity.mainWeakReference?.get()?.getString(id)?.let { String.format(it, arg1, arg2) }
|
||||
fun getApiUrl(id: Int, arg1: String?, arg2: String?, arg3: Int? = 0) = MainActivity.mainWeakReference?.get()?.getString(id)?.let { String.format(it, arg1, arg2, arg3) }
|
||||
|
||||
@@ -10,6 +10,7 @@ import kotlinx.android.synthetic.main.app_bar_main.*
|
||||
import kotlinx.android.synthetic.main.line_booktandb.*
|
||||
import top.fumiama.dmzj.copymanga.R
|
||||
import top.fumiama.copymanga.MainActivity.Companion.mainWeakReference
|
||||
import top.fumiama.copymanga.manga.Reader
|
||||
import top.fumiama.copymanga.template.general.NoBackRefreshFragment
|
||||
import java.lang.Thread.sleep
|
||||
import java.lang.ref.WeakReference
|
||||
@@ -54,8 +55,8 @@ class BookFragment: NoBackRefreshFragment(R.layout.fragment_book) {
|
||||
|
||||
fun setStartRead() {
|
||||
mainWeakReference?.get()?.apply {
|
||||
bookHandler.book?.results?.comic?.name?.let {
|
||||
getPreferences(MODE_PRIVATE).getInt(it, -1).let { p ->
|
||||
bookHandler.book?.results?.comic?.name?.let { name ->
|
||||
getPreferences(MODE_PRIVATE).getInt(name, -1).let { p ->
|
||||
this@BookFragment.lbbstart.apply {
|
||||
var i = 0
|
||||
if(p >= 0) {
|
||||
@@ -63,7 +64,7 @@ class BookFragment: NoBackRefreshFragment(R.layout.fragment_book) {
|
||||
i = p
|
||||
}
|
||||
setOnClickListener {
|
||||
bookHandler.callViewManga(i)
|
||||
Reader.viewMangaAt(name, i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import top.fumiama.copymanga.json.BookInfoStructure
|
||||
import top.fumiama.copymanga.json.ChapterStructure
|
||||
import top.fumiama.copymanga.json.ThemeStructure
|
||||
import top.fumiama.copymanga.json.VolumeStructure
|
||||
import top.fumiama.copymanga.manga.Reader
|
||||
import top.fumiama.copymanga.template.http.AutoDownloadHandler
|
||||
import top.fumiama.copymanga.template.http.AutoDownloadThread
|
||||
import top.fumiama.copymanga.tools.api.CMApi
|
||||
@@ -249,19 +250,19 @@ class BookHandler(that: WeakReference<BookFragment>, private val path: String)
|
||||
line = layoutInflater.inflate(R.layout.line_chapter, that.fbl, false)
|
||||
line?.lcc?.apply {
|
||||
lct.text = it.name
|
||||
setOnClickListener { callViewManga(i) }
|
||||
setOnClickListener { _ -> Reader.viewMangaAt(it.name, i) }
|
||||
}
|
||||
fbl?.addView(line)
|
||||
} else {
|
||||
line = layoutInflater.inflate(R.layout.line_2chapters, that.fbl, false)
|
||||
line?.l2cl?.apply {
|
||||
lct.text = it.name
|
||||
setOnClickListener { callViewManga( i) }
|
||||
setOnClickListener { _ -> Reader.viewMangaAt(it.name, i) }
|
||||
}
|
||||
}
|
||||
} else line?.l2cr?.apply {
|
||||
lct.text = it.name
|
||||
setOnClickListener { callViewManga(i) }
|
||||
setOnClickListener { _ -> Reader.viewMangaAt(it.name, i) }
|
||||
fbl?.addView(line)
|
||||
line = null
|
||||
}
|
||||
@@ -362,26 +363,4 @@ class BookHandler(that: WeakReference<BookFragment>, private val path: String)
|
||||
}
|
||||
vols = volumes
|
||||
}
|
||||
|
||||
fun callViewManga(pos: Int) {
|
||||
book?.results?.comic?.name?.let {
|
||||
mainWeakReference?.get()?.getPreferences(MODE_PRIVATE)?.edit {
|
||||
putInt(it, pos)
|
||||
apply()
|
||||
}
|
||||
}
|
||||
ViewMangaActivity.dlhandler = null
|
||||
ViewMangaActivity.position = pos
|
||||
val zipf = ViewMangaActivity.fileArray[pos]
|
||||
if (zipf.exists()) {
|
||||
ViewMangaActivity.zipFile = zipf
|
||||
that?.startActivity(
|
||||
Intent(that.context, ViewMangaActivity::class.java)
|
||||
.putExtra("callFrom", "zipFirst").putExtra("function", "log")
|
||||
)
|
||||
} else {
|
||||
ViewMangaActivity.zipFile = null
|
||||
that?.startActivity(Intent(that.context, ViewMangaActivity::class.java).putExtra("function", "log"))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -102,6 +102,7 @@ class HomeFragment : NoBackRefreshFragment(R.layout.fragment_home) {
|
||||
|
||||
setOnFocusChangeListener(object : SearchLayout.OnFocusChangeListener {
|
||||
override fun onFocusChange(hasFocus: Boolean) {
|
||||
Log.d("MyHF", "fhs onFocusChange: $hasFocus")
|
||||
navigationIconSupport = if (hasFocus) SearchLayout.NavigationIconSupport.ARROW
|
||||
else {
|
||||
micView.postDelayed({ micView.visibility = View.VISIBLE }, 233)
|
||||
@@ -110,7 +111,8 @@ class HomeFragment : NoBackRefreshFragment(R.layout.fragment_home) {
|
||||
}
|
||||
})
|
||||
|
||||
fhns.setOnTouchListener { _, e ->
|
||||
setOnTouchListener { _, e ->
|
||||
Log.d("MyHF", "fhns on touch")
|
||||
if (e.action == MotionEvent.ACTION_UP && mSearchEditText?.text?.isNotEmpty() == true) {
|
||||
ime?.hideSoftInputFromWindow(mainWeakReference?.get()?.window?.decorView?.windowToken, 0)
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package top.fumiama.copymanga.ui.vm
|
||||
|
||||
import android.content.Intent
|
||||
import android.widget.Toast
|
||||
import top.fumiama.copymanga.ui.vm.ViewMangaActivity.Companion.fileArray
|
||||
import top.fumiama.copymanga.manga.Reader
|
||||
import top.fumiama.copymanga.ui.vm.ViewMangaActivity.Companion.comicName
|
||||
import top.fumiama.copymanga.ui.vm.ViewMangaActivity.Companion.position
|
||||
import top.fumiama.copymanga.ui.vm.ViewMangaActivity.Companion.urlArray
|
||||
import top.fumiama.copymanga.ui.vm.ViewMangaActivity.Companion.zipFile
|
||||
import java.lang.ref.WeakReference
|
||||
|
||||
class PagesManager(w: WeakReference<ViewMangaActivity>) {
|
||||
@@ -38,18 +37,10 @@ class PagesManager(w: WeakReference<ViewMangaActivity>) {
|
||||
urlArray.let {
|
||||
if(chapterPosition >= 0 && chapterPosition < it.size) it[chapterPosition].let {
|
||||
if (if(goNext)isEndR else isEndL) {
|
||||
val f = fileArray[chapterPosition]
|
||||
val intent = Intent(v, ViewMangaActivity::class.java)
|
||||
//if(v.zipFirst) intent.putExtra("callFrom", "zipFirst")
|
||||
if(!goNext){
|
||||
ViewMangaActivity.pn = -2
|
||||
intent.putExtra("function", "log")
|
||||
}
|
||||
zipFile = if (f.exists()) f else null
|
||||
position = chapterPosition
|
||||
v.tt.canDo = false
|
||||
//ViewMangaActivity.dlhandler = null
|
||||
v.startActivity(intent)
|
||||
comicName?.let { it1 -> Reader.viewMangaAt(it1, chapterPosition, goNext) }
|
||||
v.finish()
|
||||
} else {
|
||||
val hint = if(goNext) '下' else '上'
|
||||
|
||||
@@ -155,7 +155,9 @@ class VMHandler(activity: ViewMangaActivity, url: String) : AutoDownloadHandler(
|
||||
|
||||
@ExperimentalStdlibApi
|
||||
private fun prepareManga(){
|
||||
comicName = manga?.results?.comic?.name
|
||||
if(comicName == null) {
|
||||
comicName = manga?.results?.comic?.name
|
||||
}
|
||||
wv.get()?.count = manga?.results?.chapter?.size?:0
|
||||
wv.get()?.initManga()
|
||||
wv.get()?.vprog?.visibility = View.GONE
|
||||
|
||||
@@ -1,55 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="top.fumiama.copymanga.ui.home.HomeFragment">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/fhns"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="top.fumiama.copymanga.ui.home.HomeFragment"
|
||||
android:focusableInTouchMode="true">
|
||||
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swiperefresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true">
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="64dp">
|
||||
|
||||
<LinearLayout
|
||||
<top.fumiama.copymanga.views.ScrollRefreshView
|
||||
android:id="@+id/fhov"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="SpeakableTextPresentCheck">
|
||||
|
||||
<com.lapism.search.widget.MaterialSearchView
|
||||
android:id="@+id/fhs"
|
||||
<LinearLayout
|
||||
android:id="@+id/fhl"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_behavior="com.lapism.search.widget.SearchBehavior">
|
||||
android:orientation="vertical">
|
||||
|
||||
</com.lapism.search.widget.MaterialSearchView>
|
||||
</LinearLayout>
|
||||
</top.fumiama.copymanga.views.ScrollRefreshView>
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swiperefresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<com.lapism.search.widget.MaterialSearchView
|
||||
android:id="@+id/fhs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_behavior="com.lapism.search.widget.SearchBehavior">
|
||||
|
||||
<top.fumiama.copymanga.views.ScrollRefreshView
|
||||
android:id="@+id/fhov"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/fhl"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
</LinearLayout>
|
||||
</top.fumiama.copymanga.views.ScrollRefreshView>
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</com.lapism.search.widget.MaterialSearchView>
|
||||
</FrameLayout>
|
||||
Reference in New Issue
Block a user