mirror of
https://github.com/fumiama/copymanga.git
synced 2026-06-09 09:43:11 +08:00
v1.1.3
1. 增加删除已下载漫画功能 2. 细节优化提升
This commit is contained in:
@@ -11,8 +11,8 @@ android {
|
||||
applicationId "top.fumiama.copymanga"
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 30
|
||||
versionCode 4
|
||||
versionName '1.1.2'
|
||||
versionCode 5
|
||||
versionName '1.1.3'
|
||||
resConfigs "zh", "zh-rCN"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
@@ -4,10 +4,10 @@ import android.animation.ObjectAnimator
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.ViewTreeObserver
|
||||
import android.view.WindowManager
|
||||
import android.widget.Toast
|
||||
import android.widget.ToggleButton
|
||||
import kotlinx.android.synthetic.main.activity_dl.*
|
||||
@@ -66,12 +66,16 @@ class DlActivity : Activity() {
|
||||
|
||||
private fun showDlCard(){
|
||||
//ObjectAnimator.ofFloat(csdwn, "alpha", 0.3f, 0.9f).setDuration(233).start()
|
||||
ObjectAnimator.ofFloat(csdwn, "translationX", cdwnWidth.toFloat() * 0.9f, 0f).setDuration(233).start()
|
||||
ObjectAnimator.ofFloat(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(233).start()
|
||||
ObjectAnimator.ofFloat(csdwn, "translationX", 0f, cdwnWidth.toFloat() * 0.9f).setDuration(
|
||||
233
|
||||
).start()
|
||||
}
|
||||
|
||||
private fun fillChapters() {
|
||||
@@ -88,6 +92,7 @@ class DlActivity : Activity() {
|
||||
if (!canDl) {
|
||||
checkedChapter -= dldChapter
|
||||
dldChapter = 0
|
||||
Toast.makeText(this, "当前章节下载完成后将会停止", Toast.LENGTH_SHORT).show()
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -117,7 +122,7 @@ class DlActivity : Activity() {
|
||||
override fun onBottom() {}
|
||||
|
||||
override fun onScroll() {
|
||||
if (csdwn.translationY == 0f) hideDlCard()
|
||||
if (csdwn.translationX == 0f) hideDlCard()
|
||||
}
|
||||
|
||||
override fun onTop() {}
|
||||
|
||||
@@ -1,41 +1,70 @@
|
||||
package top.fumiama.copymanga.activity
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.AlertDialog
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
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 java.io.File
|
||||
|
||||
class DlListActivity:Activity() {
|
||||
private var exDir: File? = null
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_dlist)
|
||||
val titleText = intent.getStringExtra("title")
|
||||
ttitle.text = titleText?.substringAfterLast("/")
|
||||
exDir = getExternalFilesDir("")
|
||||
val innerDir = titleText?.substringAfter("我的下载")
|
||||
File(exDir, innerDir?:"").list()?.let {
|
||||
ttitle.text = intent.getStringExtra("title")
|
||||
scanFile(currentDir)
|
||||
}
|
||||
|
||||
private fun scanFile(cd: File?){
|
||||
cd?.list()?.sortedArray()?.let {
|
||||
mylv.adapter = ArrayAdapter(this, android.R.layout.simple_list_item_1, it)
|
||||
mylv.setOnItemClickListener { _, _, position, _ ->
|
||||
val chosenFile = File(exDir, "$innerDir/${it[position]}")
|
||||
val newTitle = "$titleText/${it[position]}"
|
||||
val chosenFile = File(cd, it[position])
|
||||
//Toast.makeText(this, "进入$chosenFile", Toast.LENGTH_SHORT).show()
|
||||
if (chosenFile.isDirectory) startActivity(
|
||||
Intent(
|
||||
this,
|
||||
DlListActivity::class.java
|
||||
).putExtra("title", newTitle)
|
||||
)
|
||||
if (chosenFile.isDirectory) {
|
||||
currentDir = chosenFile
|
||||
startActivity(
|
||||
Intent(
|
||||
this,
|
||||
DlListActivity::class.java
|
||||
).putExtra("title", it[position])
|
||||
)
|
||||
}
|
||||
else{
|
||||
Toast.makeText(this, "加载中...", Toast.LENGTH_SHORT).show()
|
||||
ViewMangaActivity.zipFile = chosenFile
|
||||
ViewMangaActivity.titleText = it[position]
|
||||
startActivity(Intent(this, ViewMangaActivity::class.java))
|
||||
}
|
||||
}
|
||||
mylv.setOnItemLongClickListener { _, _, position, _ ->
|
||||
val chosenFile = File(cd, it[position])
|
||||
AlertDialog.Builder(this)
|
||||
.setIcon(R.drawable.ic_launcher_foreground).setMessage("是否删除?")
|
||||
.setTitle("提示").setPositiveButton("确定"){ _, _ ->
|
||||
if(chosenFile.exists()) rmrf(chosenFile)
|
||||
scanFile(cd)
|
||||
}.setNegativeButton("取消"){_, _ ->}.show()
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun rmrf(f: File) {
|
||||
if (f.isDirectory) f.listFiles()?.let {
|
||||
for (i in it)
|
||||
if (i.isDirectory) rmrf(i)
|
||||
else i.delete()
|
||||
}
|
||||
f.delete()
|
||||
}
|
||||
|
||||
companion object{
|
||||
var currentDir: File? = null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,9 +51,10 @@ class MainActivity: Activity() {
|
||||
}
|
||||
|
||||
fun onFabClicked(v: View){
|
||||
DlListActivity.currentDir = getExternalFilesDir("")
|
||||
startActivity(
|
||||
Intent(this, (if(mh?.showDlList == true) DlListActivity::class else DlActivity::class).java)
|
||||
.putExtra("title", "./我的下载")
|
||||
.putExtra("title", "我的下载")
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Message
|
||||
@@ -109,8 +110,11 @@ 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 (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)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getPageNumber(): Int {
|
||||
@@ -419,16 +423,6 @@ class ViewMangaActivity : Activity() {
|
||||
}
|
||||
var titleText = "Null"
|
||||
var nextChapterUrl: String? = null
|
||||
get() {
|
||||
val re = field
|
||||
if(field != null) field = null
|
||||
return re
|
||||
}
|
||||
var previousChapterUrl: String? = null
|
||||
get() {
|
||||
val re = field
|
||||
if(field != null) field = null
|
||||
return re
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,6 +84,9 @@ class DlHandler(activity: DlActivity) : Handler() {
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
//Looper.loop()
|
||||
}else{
|
||||
val progressTxt = d?.tdwn?.text.toString()
|
||||
d?.tdwn?.text = "${progressTxt.substringBefore(" ")} 的第${msg.arg2}页"
|
||||
}
|
||||
}
|
||||
6 -> d?.tdwn?.text = "${d?.dldChapter}/${d?.checkedChapter}"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?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">
|
||||
|
||||
@@ -24,10 +25,11 @@
|
||||
android:id="@+id/ttitle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:gravity="start"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/isearch"
|
||||
app:layout_constraintStart_toEndOf="@+id/ilogo"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
@@ -37,10 +39,11 @@
|
||||
android:layout_height="28dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:src="@drawable/ic_edit"
|
||||
android:visibility="gone"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ilogo"
|
||||
|
||||
@@ -5,5 +5,6 @@
|
||||
<item name="android:colorAccent">@color/colorAccent</item>
|
||||
<item name="android:statusBarColor">@android:color/white</item>
|
||||
<item name="android:windowLightStatusBar">true</item>
|
||||
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||
</style>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user