diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 61a9130..fb7f4a8 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.idea/markdown-navigator-enh.xml b/.idea/markdown-navigator-enh.xml
new file mode 100644
index 0000000..a8fcc84
--- /dev/null
+++ b/.idea/markdown-navigator-enh.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/markdown-navigator.xml b/.idea/markdown-navigator.xml
new file mode 100644
index 0000000..a2fc086
--- /dev/null
+++ b/.idea/markdown-navigator.xml
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index d5d35ec..860da66 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,6 +1,6 @@
-
+
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
new file mode 100644
index 0000000..797acea
--- /dev/null
+++ b/.idea/runConfigurations.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/.gitignore b/app/.gitignore
index 42afabf..956c004 100644
--- a/app/.gitignore
+++ b/app/.gitignore
@@ -1 +1,2 @@
-/build
\ No newline at end of file
+/build
+/release
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 3ffefd1..89c9583 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -11,8 +11,8 @@ android {
applicationId "top.fumiama.copymanga"
minSdkVersion 23
targetSdkVersion 30
- versionCode 10
- versionName '1.3.2'
+ versionCode 11
+ versionName '1.3.3'
resConfigs "zh", "zh-rCN"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -42,6 +42,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}*/
}
+
+ viewBinding {
+ enabled = true
+ }
}
dependencies {
@@ -53,11 +57,11 @@ dependencies {
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
//implementation 'com.google.android.material:material:1.2.1'
- testImplementation 'junit:junit:4.13.1'
+ testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
- implementation 'com.github.bumptech.glide:glide:4.11.0'
- annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
+ implementation 'com.github.bumptech.glide:glide:4.12.0'
+ annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
implementation 'com.google.code.gson:gson:2.8.6'
//implementation 'com.liaoinstan.springview:library:1.7.0'
}
@@ -94,8 +98,8 @@ andResGuard {
"*.gif",
]
sevenzip {
- artifact = 'com.tencent.mm:SevenZip:1.2.20'
- //path = "/usr/local/bin/7za"
+ //artifact = 'com.tencent.mm:SevenZip:1.2.21'
+ path = "7za"
}
/**
diff --git a/app/release/app-release.apk b/app/release/app-release.apk
new file mode 100644
index 0000000..3b9d722
Binary files /dev/null and b/app/release/app-release.apk differ
diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json
new file mode 100644
index 0000000..9b9acea
--- /dev/null
+++ b/app/release/output-metadata.json
@@ -0,0 +1,18 @@
+{
+ "version": 2,
+ "artifactType": {
+ "type": "APK",
+ "kind": "Directory"
+ },
+ "applicationId": "top.fumiama.copymanga",
+ "variantName": "release",
+ "elements": [
+ {
+ "type": "SINGLE",
+ "filters": [],
+ "versionCode": 11,
+ "versionName": "1.3.3",
+ "outputFile": "app-release.apk"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/app/src/main/assets/h.js b/app/src/main/assets/h.js
index e748a43..fcb8b87 100644
--- a/app/src/main/assets/h.js
+++ b/app/src/main/assets/h.js
@@ -1,8 +1,8 @@
javascript:
if (typeof (loaded) == "undefined"){
var loaded = true;
- function scanChapters(chapter){
- var chapterList = chapter.getElementsByClassName("table-all")[0].getElementsByTagName("a");
+ function scanChapters(chapter) {
+ var chapterList = chapter.getElementsByClassName("tab-pane fade show active")[0].getElementsByTagName("ul")[0].getElementsByTagName("a");
var chapterArr = Array();
for(var i = 0; i < chapterList.length; i++){
chapterArr.push(JSON.constructor());
@@ -11,7 +11,7 @@ if (typeof (loaded) == "undefined"){
}
return chapterArr;
}
- function modify(){
+ function modify() {
var url = location.href;
if(url.indexOf("/chapter/")>0){
var imglist = document.getElementsByClassName("container-fluid comicContent")[0].getElementsByTagName("li");
@@ -22,7 +22,7 @@ if (typeof (loaded) == "undefined"){
var liststr = document.title.split(" - ")[1] + " " + location.href.substring(location.href.lastIndexOf("/")+1) + "\n" + nextChapter + "\n" + prevChapter;
for(var i = 0; i < imglist.length; i++) liststr += "\n" + imglist[i].getElementsByTagName("img")[0].dataset.src;
GM.loadChapter(liststr);
- }else {
+ } else {
var json = Array();
var chapters = document.getElementsByClassName("upLoop")[0].children;
var newObj = null;
diff --git a/app/src/main/java/top/fumiama/copymanga/activity/DlActivity.kt b/app/src/main/java/top/fumiama/copymanga/activity/DlActivity.kt
index 6e6302c..99bfc82 100644
--- a/app/src/main/java/top/fumiama/copymanga/activity/DlActivity.kt
+++ b/app/src/main/java/top/fumiama/copymanga/activity/DlActivity.kt
@@ -21,6 +21,7 @@ import kotlinx.android.synthetic.main.widget_titlebar.*
import top.fumiama.copymanga.R
import top.fumiama.copymanga.activity.MainActivity.Companion.mh
import top.fumiama.copymanga.data.ComicStructure
+import top.fumiama.copymanga.databinding.ActivityDlBinding
import top.fumiama.copymanga.handler.DlHandler
import top.fumiama.copymanga.tool.MangaDlTools
import top.fumiama.copymanga.tool.MangaDlTools.Companion.wmdlt
@@ -30,8 +31,6 @@ import top.fumiama.copymanga.view.LazyScrollView
import java.io.File
import java.lang.Thread.sleep
import java.lang.ref.WeakReference
-import java.util.zip.ZipFile
-
class DlActivity : Activity() {
private var tbtncnt = 0
@@ -55,7 +54,8 @@ class DlActivity : Activity() {
@SuppressLint("SetTextI18n")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_dl)
+ val binding = ActivityDlBinding.inflate(layoutInflater)
+ setContentView(binding.root)
mh?.saveUrlsOnly = true
mangaDlTools = MangaDlTools(this)
handler.sendEmptyMessage(-2) //setLayouts
diff --git a/app/src/main/java/top/fumiama/copymanga/activity/DlListActivity.kt b/app/src/main/java/top/fumiama/copymanga/activity/DlListActivity.kt
index 99072d0..af2e286 100644
--- a/app/src/main/java/top/fumiama/copymanga/activity/DlListActivity.kt
+++ b/app/src/main/java/top/fumiama/copymanga/activity/DlListActivity.kt
@@ -2,16 +2,15 @@ package top.fumiama.copymanga.activity
import android.app.Activity
import android.app.AlertDialog
-import android.app.Dialog
import android.content.Intent
import android.os.Bundle
import android.os.Looper
-import android.util.Log
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.copymanga.R
+import top.fumiama.copymanga.databinding.ActivityDlistBinding
import top.fumiama.copymanga.handler.DlLHandler
import java.io.File
import java.util.regex.Pattern
@@ -23,7 +22,8 @@ class DlListActivity:Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_dlist)
+ val binding = ActivityDlistBinding.inflate(layoutInflater)
+ setContentView(binding.root)
ttitle.text = intent.getStringExtra("title")
handler = DlLHandler(Looper.myLooper()!!, this)
handler?.obtainMessage(3, currentDir)?.sendToTarget() //call scanFile
diff --git a/app/src/main/java/top/fumiama/copymanga/activity/MainActivity.kt b/app/src/main/java/top/fumiama/copymanga/activity/MainActivity.kt
index a8a7096..b11a829 100644
--- a/app/src/main/java/top/fumiama/copymanga/activity/MainActivity.kt
+++ b/app/src/main/java/top/fumiama/copymanga/activity/MainActivity.kt
@@ -3,13 +3,17 @@ package top.fumiama.copymanga.activity
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Intent
+import android.net.Uri
import android.os.Bundle
import android.os.Looper
import android.view.View
+import android.webkit.ValueCallback
import android.webkit.WebView
import kotlinx.android.synthetic.main.activity_main.*
import top.fumiama.copymanga.R
+import top.fumiama.copymanga.databinding.ActivityMainBinding
import top.fumiama.copymanga.handler.MainHandler
+import top.fumiama.copymanga.tool.SetDraggable
import top.fumiama.copymanga.tool.ToolsBox
import top.fumiama.copymanga.view.JSWebView
import top.fumiama.copymanga.web.JS
@@ -19,11 +23,13 @@ import java.lang.ref.WeakReference
class MainActivity: Activity() {
var wh: JSWebView? = null
- var toolsBox: ToolsBox? = null
+ var uploadMessageAboveL: ValueCallback>? = null
+ private var toolsBox: ToolsBox? = null
@SuppressLint("JavascriptInterface")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+ val binding = ActivityMainBinding.inflate(layoutInflater)
+ setContentView(binding.root)
wm = WeakReference(this)
mh = MainHandler(Looper.myLooper()!!)
@@ -43,6 +49,7 @@ class MainActivity: Activity() {
wh?.loadJSInterface(JSHidden())
}
}
+ SetDraggable().with(this).onto(fab)
}
override fun onBackPressed() {
@@ -50,6 +57,41 @@ class MainActivity: Activity() {
else super.onBackPressed()
}
+ override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
+ super.onActivityResult(requestCode, resultCode, data)
+ if (requestCode == FILE_CHOOSER_RESULT_CODE) { //处理返回的图片,并进行上传
+ if (uploadMessageAboveL == null) return
+ else {
+ if(resultCode == RESULT_OK) {
+ data?.apply {
+ if(uploadMessageAboveL != null) {
+ onActivityResultAboveL(requestCode, resultCode, this)
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private fun onActivityResultAboveL(requestCode: Int, resultCode: Int, intent: Intent) {
+ if (requestCode != FILE_CHOOSER_RESULT_CODE || uploadMessageAboveL == null) return
+ else {
+ if (resultCode == RESULT_OK) {
+ intent.clipData?.apply {
+ var results = arrayOf()
+ for(i in 0..itemCount) {
+ val item = getItemAt(i)
+ results += item.uri
+ }
+ intent.dataString?.apply {
+ uploadMessageAboveL?.onReceiveValue(results)
+ uploadMessageAboveL = null
+ }
+ }
+ }
+ }
+ }
+
fun onFabClicked(v: View){
DlListActivity.currentDir = getExternalFilesDir("")
startActivity(
@@ -58,7 +100,16 @@ class MainActivity: Activity() {
)
}
+ fun openImageChooserActivity() {
+ //调用自己的图库
+ val i = Intent(Intent.ACTION_GET_CONTENT)
+ i.addCategory(Intent.CATEGORY_OPENABLE)
+ i.type = "image/*"
+ startActivityForResult(Intent.createChooser(i, "Image Chooser"), FILE_CHOOSER_RESULT_CODE)
+ }
+
companion object{
+ const val FILE_CHOOSER_RESULT_CODE = 1
var wm: WeakReference? = null
var mh: MainHandler? = null
}
diff --git a/app/src/main/java/top/fumiama/copymanga/activity/ViewMangaActivity.kt b/app/src/main/java/top/fumiama/copymanga/activity/ViewMangaActivity.kt
index 07b6e16..250b061 100644
--- a/app/src/main/java/top/fumiama/copymanga/activity/ViewMangaActivity.kt
+++ b/app/src/main/java/top/fumiama/copymanga/activity/ViewMangaActivity.kt
@@ -7,6 +7,7 @@ import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.os.*
import android.util.Log
+import android.view.KeyEvent
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -25,6 +26,7 @@ import kotlinx.android.synthetic.main.widget_titlebar.*
import kotlinx.android.synthetic.main.widget_viewmangainfo.*
import top.fumiama.copymanga.R
import top.fumiama.copymanga.activity.MainActivity.Companion.wm
+import top.fumiama.copymanga.databinding.ActivityViewmangaBinding
import top.fumiama.copymanga.handler.TimeThread
import top.fumiama.copymanga.tool.PropertiesTools
import top.fumiama.copymanga.tool.ToolsBox
@@ -35,23 +37,23 @@ import java.util.*
import java.util.zip.ZipFile
import java.util.zip.ZipInputStream
-
class ViewMangaActivity : Activity() {
- var count = 0
lateinit var handler: Handler
lateinit var tt: TimeThread
+ lateinit var toolsBox: ToolsBox
+
+ var count = 0
var clicked = false
- private var isInSeek = false
- private var useFullScreen = false
var r2l = true
+ var infoDrawerDelta = 0f
+
+ private lateinit var p: PropertiesTools
+ private var isInSeek = false
private var currentItem = 0
private var notUseVP = true
- //private var q = 90
- var infoDrawerDelta = 0f
- lateinit var toolsBox: ToolsBox
- private lateinit var p: PropertiesTools
private var mangaZip = zipFile
val dlZip2View = mangaZip != null
+ private val volTurnPage get() = p["volturn"] == "true"
var pageNum = 1
get() {
field = getPageNumber()
@@ -75,22 +77,18 @@ class ViewMangaActivity : Activity() {
@SuppressLint("SetTextI18n")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_viewmanga)
+ val binding = ActivityViewmangaBinding.inflate(layoutInflater)
+ setContentView(binding.root)
toolsBox = ToolsBox(WeakReference(this))
va = WeakReference(this)
p = PropertiesTools(File("$filesDir/settings.properties"))
- useFullScreen = p["useFullScreen"] != "true"
r2l = p["r2l"] == "true"
- //toolsBox = ToolsBox(WeakReference(this))
notUseVP = p["noAnimation"] == "true"
handler = MyHandler(infcard, toolsBox)
- //if (p["quality"] == "null") p["quality"] = "90"
- //else q = p["quality"].toInt()
tt = TimeThread(handler, 22)
tt.canDo = true
tt.start()
ttitle.text = titleText
- //isearch.visibility = View.VISIBLE
Log.d("MyVM", "dlZip2View: $dlZip2View, mangaZip: $mangaZip")
if(dlZip2View && mangaZip?.exists() != true) toolsBox.toastError("已经到头了~")
else {
@@ -118,11 +116,25 @@ class ViewMangaActivity : Activity() {
override fun onWindowFocusChanged(hasFocus: Boolean) {
super.onWindowFocusChanged(hasFocus)
- if (useFullScreen) {
- window.decorView.systemUiVisibility =
- View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_FULLSCREEN or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
- if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) window.setDecorFitsSystemWindows(false)
+ window.decorView.systemUiVisibility =
+ View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_FULLSCREEN or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
+ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) window.setDecorFitsSystemWindows(false)
+ }
+
+ @ExperimentalStdlibApi
+ override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
+ var flag = false
+ if(volTurnPage) when(keyCode) {
+ KeyEvent.KEYCODE_VOLUME_UP -> {
+ scrollBack()
+ flag = true
+ }
+ KeyEvent.KEYCODE_VOLUME_DOWN -> {
+ scrollForward()
+ flag = true
+ }
}
+ return if(flag) true else super.onKeyDown(keyCode, event)
}
private fun getPageNumber(): Int {
@@ -139,18 +151,7 @@ class ViewMangaActivity : Activity() {
if (position >= count || position < 0) return null
else {
val zip = ZipFile(mangaZip)
- //if (q == 100)
return BitmapFactory.decodeStream(zip.getInputStream(zip.getEntry("${position}.webp")))
- /*else {
- val out = ByteArrayOutputStream()
- try {
- BitmapFactory.decodeStream(zip.getInputStream(zip.getEntry("${position}.jpg")))
- } catch (e: Exception) {
- e.printStackTrace()
- return null
- }?.compress(Bitmap.CompressFormat.JPEG, q, out)
- return BitmapFactory.decodeStream(ByteArrayInputStream(out.toByteArray()))
- }*/
}
}
@@ -175,7 +176,7 @@ class ViewMangaActivity : Activity() {
prepareInfoBar(count)
if (notUseVP) loadOneImg() else prepareIdBtVH()
toolsBox.dp2px(67)?.let { setIdPosition(it) }
- prepareIdBtFullScreen()
+ prepareIdBtVolTurn()
prepareIdBtVP()
prepareIdBtLR()
}
@@ -220,7 +221,6 @@ class ViewMangaActivity : Activity() {
if (!isInSeek) hideObjs()
updateSeekText()
updateSeekProgress()
- sendProgress()
}
@SuppressLint("SetTextI18n")
@@ -265,13 +265,11 @@ class ViewMangaActivity : Activity() {
}
}
- private fun prepareIdBtFullScreen() {
- idtbfullscreen.isChecked = !useFullScreen
- idtbfullscreen.setOnClickListener {
- if (idtbfullscreen.isChecked) p["useFullScreen"] =
- "true"
- else p["useFullScreen"] = "false"
- Toast.makeText(this, "下次浏览生效", Toast.LENGTH_SHORT).show()
+ private fun prepareIdBtVolTurn() {
+ idtbvolturn.isChecked = volTurnPage
+ idtbvolturn.setOnClickListener {
+ if (idtbvolturn.isChecked) p["volturn"] = "true"
+ else p["volturn"] = "false"
}
}
@@ -305,10 +303,6 @@ class ViewMangaActivity : Activity() {
pageNum++
}
- private fun sendProgress() {
-
- }
-
@SuppressLint("SetTextI18n")
private fun updateSeekText() {
inftxtprogress.text = "$pageNum/$count"
diff --git a/app/src/main/java/top/fumiama/copymanga/tool/PropertiesTools.kt b/app/src/main/java/top/fumiama/copymanga/tool/PropertiesTools.kt
index 0be5aab..64d4957 100644
--- a/app/src/main/java/top/fumiama/copymanga/tool/PropertiesTools.kt
+++ b/app/src/main/java/top/fumiama/copymanga/tool/PropertiesTools.kt
@@ -7,45 +7,55 @@ import java.io.InputStream
import java.util.*
class PropertiesTools(private val f: File):Properties() {
- private val propfile:File
- get() {
+ private var cache = hashMapOf()
+
+ init {
if(!f.exists()) {
if(f.parentFile?.exists() != true) f.parentFile?.mkdirs()
if(f.parentFile?.canWrite() != true) f.parentFile?.setWritable(true)
createNew(f)
- }else if(f.isDirectory) {
+ } else if(f.isDirectory) {
if(f.parentFile?.canWrite() != true) f.parentFile?.setWritable(true)
f.delete()
createNew(f)
}
if(f.parentFile?.canWrite() != true) f.parentFile?.setWritable(true)
if(f.parentFile?.canRead() != true) f.parentFile?.setReadable(true)
- return f
}
- private fun createNew(f: File){
+
+ private fun createNew(f: File) {
f.createNewFile()
val o = f.outputStream()
this.storeToXML(o, "store")
Log.d("MyPT", "Generate new prop.")
o.close()
}
+
private fun loadFromXml(`in`: InputStream?): PropertiesTools {
this.loadFromXML(`in`)
return this
}
+
private fun setProp(key: String?, value: String?): PropertiesTools {
this.setProperty(key, value)
return this
}
+
operator fun get(key: String): String{
- val i = propfile.inputStream()
- val re = this.loadFromXml(i).getProperty(key)?:"null"
- Log.d("MyPT", "Get $key = $re")
- i.close()
- return re
+ return if(cache.containsKey(key)) cache[key]?:"null"
+ else {
+ val i = f.inputStream()
+ val re = this.loadFromXml(i).getProperty(key)?:"null"
+ Log.d("MyPT", "Read $key = $re")
+ i.close()
+ cache[key] = re
+ re
+ }
}
- operator fun set(key: String, value: String){
- val o = propfile.outputStream()
+
+ operator fun set(key: String, value: String) {
+ cache[key] = value
+ val o = f.outputStream()
this.setProp(key, value).storeToXML(o, "store")
Log.d("MyPT", "Set $key = $value")
o.close()
diff --git a/app/src/main/java/top/fumiama/copymanga/tool/SetDraggable.kt b/app/src/main/java/top/fumiama/copymanga/tool/SetDraggable.kt
new file mode 100644
index 0000000..c3b13da
--- /dev/null
+++ b/app/src/main/java/top/fumiama/copymanga/tool/SetDraggable.kt
@@ -0,0 +1,62 @@
+package top.fumiama.copymanga.tool
+
+import android.content.Context
+import android.view.MotionEvent
+import android.view.View
+import kotlin.math.abs
+
+class SetDraggable {
+ private var screenWidth = 0
+ private var screenHeight = 0
+ fun with(context: Context): SetDraggable {
+ val dm = context.resources.displayMetrics
+ screenWidth = dm.widthPixels
+ screenHeight = dm.heightPixels
+ return this
+ }
+
+ fun onto(target: View) {
+ var lastX = 0
+ var lastY = 0
+ var firstX = 0
+ var firstY = 0
+ target.setOnTouchListener { v: View, event: MotionEvent ->
+ when (event.action) {
+ MotionEvent.ACTION_DOWN -> {
+ lastX = event.rawX.toInt()
+ lastY = event.rawY.toInt()
+ firstX = lastX
+ firstY = lastY
+ }
+ MotionEvent.ACTION_MOVE -> {
+ val dx = event.rawX.toInt() - lastX
+ val dy = event.rawY.toInt() - lastY
+ var left = v.left + dx
+ var top = v.top + dy
+ var right = v.right + dx
+ var bottom = v.bottom + dy
+ if (left < 0) {
+ left = 0
+ right = left + v.width
+ }
+ if (right > screenWidth) {
+ right = screenWidth
+ left = right - v.width
+ }
+ if (top < 0) {
+ top = 0
+ bottom = top + v.height
+ }
+ if (bottom > screenHeight) {
+ bottom = screenHeight
+ top = bottom - v.height
+ }
+ v.layout(left, top, right, bottom)
+ lastX = event.rawX.toInt()
+ lastY = event.rawY.toInt()
+ }
+ }
+ abs(firstX - lastX) > 3 || abs(firstY - lastY) > 3 //移动微小则判断为点击
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/top/fumiama/copymanga/web/WebChromeClient.kt b/app/src/main/java/top/fumiama/copymanga/web/WebChromeClient.kt
index f9b792f..fa2a03e 100644
--- a/app/src/main/java/top/fumiama/copymanga/web/WebChromeClient.kt
+++ b/app/src/main/java/top/fumiama/copymanga/web/WebChromeClient.kt
@@ -1,10 +1,10 @@
package top.fumiama.copymanga.web
-import android.webkit.JsPromptResult
-import android.webkit.JsResult
+import android.net.Uri
+import android.webkit.*
import android.webkit.WebChromeClient
-import android.webkit.WebView
import top.fumiama.copymanga.activity.MainActivity.Companion.mh
+import top.fumiama.copymanga.activity.MainActivity.Companion.wm
class WebChromeClient:WebChromeClient() {
override fun onProgressChanged(view: WebView?, newProgress: Int) {
@@ -43,4 +43,16 @@ class WebChromeClient:WebChromeClient() {
result?.confirm()
return true
}
+
+ override fun onShowFileChooser(
+ webView: WebView?,
+ filePathCallback: ValueCallback>?,
+ fileChooserParams: FileChooserParams?
+ ): Boolean {
+ wm?.get()?.apply {
+ uploadMessageAboveL = filePathCallback
+ openImageChooserActivity()
+ }
+ return true
+ }
}
\ No newline at end of file
diff --git a/app/src/main/res/layout/button_tbutton.xml b/app/src/main/res/layout/button_tbutton.xml
index ebaae01..e5223df 100644
--- a/app/src/main/res/layout/button_tbutton.xml
+++ b/app/src/main/res/layout/button_tbutton.xml
@@ -1,6 +1,9 @@
-
diff --git a/app/src/main/res/layout/line_horizonal.xml b/app/src/main/res/layout/line_horizonal.xml
index 99d2901..90ee94b 100644
--- a/app/src/main/res/layout/line_horizonal.xml
+++ b/app/src/main/res/layout/line_horizonal.xml
@@ -1,5 +1,7 @@
diff --git a/app/src/main/res/layout/widget_downloadbar.xml b/app/src/main/res/layout/widget_downloadbar.xml
index 947eb22..bdb32d2 100644
--- a/app/src/main/res/layout/widget_downloadbar.xml
+++ b/app/src/main/res/layout/widget_downloadbar.xml
@@ -1,6 +1,8 @@
@@ -39,7 +41,7 @@
app:layout_constraintVertical_bias="0.0" />
+ app:layout_constraintStart_toEndOf="@+id/idtbvolturn"
+ app:layout_constraintTop_toTopOf="@+id/idtbvolturn" />
+ app:layout_constraintTop_toTopOf="@+id/idtbvolturn" />
+ app:layout_constraintTop_toTopOf="@+id/idtbvolturn" />
\ 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 d29959c..322afe1 100644
--- a/app/src/main/res/layout/widget_titlebar.xml
+++ b/app/src/main/res/layout/widget_titlebar.xml
@@ -2,6 +2,7 @@
diff --git a/app/src/main/res/layout/widget_viewmangainfo.xml b/app/src/main/res/layout/widget_viewmangainfo.xml
index 5b316bf..cbae99d 100644
--- a/app/src/main/res/layout/widget_viewmangainfo.xml
+++ b/app/src/main/res/layout/widget_viewmangainfo.xml
@@ -1,6 +1,8 @@
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index b769034..10991ce 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,6 +1,6 @@
拷贝漫画
- https://copymanga.net
+ https://www.copymanga.com/h5/init
https://www.copymanga.net
https://www.copymanga.net/comic
diff --git a/build.gradle b/build.gradle
index 61be828..7bc18e2 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,14 +1,14 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
- ext.kotlin_version = '1.4.21'
+ ext.kotlin_version = '1.5.0'
repositories {
google()
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:4.1.2'
+ classpath 'com.android.tools.build:gradle:4.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
- classpath 'com.tencent.mm:AndResGuard-gradle-plugin:1.2.20'
+ classpath 'com.tencent.mm:AndResGuard-gradle-plugin:1.2.21'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files