mirror of
https://github.com/gedoor/legado.git
synced 2024-07-06 23:47:49 +08:00
优化
This commit is contained in:
parent
ca5f40704e
commit
f2edcdbf12
@ -12,6 +12,7 @@ import java.util.logging.FileHandler
|
||||
import java.util.logging.Level
|
||||
import java.util.logging.LogRecord
|
||||
import java.util.logging.Logger
|
||||
import kotlin.time.Duration.Companion.days
|
||||
|
||||
@SuppressLint("SimpleDateFormat")
|
||||
@Suppress("unused")
|
||||
@ -40,6 +41,12 @@ object LogUtils {
|
||||
private val fileHandler by lazy {
|
||||
val root = appCtx.externalCacheDir ?: return@lazy null
|
||||
val logFolder = FileUtils.createFolderIfNotExist(root, "logs")
|
||||
val expiredTime = System.currentTimeMillis() - 7.days.inWholeMilliseconds
|
||||
logFolder.listFiles()?.forEach {
|
||||
if (it.lastModified() < expiredTime) {
|
||||
it.delete()
|
||||
}
|
||||
}
|
||||
val date = getCurrentDateStr(TIME_PATTERN)
|
||||
val logPath = FileUtils.getPath(root = logFolder, "appLog-$date.txt")
|
||||
FileHandler(logPath, 10240, 10).apply {
|
||||
|
@ -5,13 +5,15 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:padding="16dp">
|
||||
android:padding="16dp"
|
||||
android:scrollbars="none">
|
||||
|
||||
<io.legado.app.lib.theme.view.ThemeCheckBox
|
||||
android:id="@+id/cb_book_source"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:scrollbars="none"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/primaryText"
|
||||
app:layout_constraintBottom_toTopOf="@id/iv_debug_text"
|
||||
@ -27,6 +29,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="6dp"
|
||||
android:scrollbars="none"
|
||||
app:layout_constraintBottom_toTopOf="@id/iv_debug_text"
|
||||
app:layout_constraintRight_toLeftOf="@id/iv_edit"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@ -40,6 +43,7 @@
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/edit"
|
||||
android:padding="6dp"
|
||||
android:scrollbars="none"
|
||||
android:src="@drawable/ic_edit"
|
||||
android:tint="@color/primaryText"
|
||||
app:layout_constraintBottom_toTopOf="@id/iv_debug_text"
|
||||
@ -51,10 +55,11 @@
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/more_menu"
|
||||
android:padding="6dp"
|
||||
android:scrollbars="none"
|
||||
android:src="@drawable/ic_more_vert"
|
||||
android:tint="@color/primaryText"
|
||||
android:contentDescription="@string/more_menu"
|
||||
app:layout_constraintBottom_toTopOf="@id/iv_debug_text"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@ -65,6 +70,7 @@
|
||||
android:layout_width="8dp"
|
||||
android:layout_height="8dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:scrollbars="none"
|
||||
android:src="@color/md_green_600"
|
||||
app:layout_constraintRight_toRightOf="@id/iv_menu_more"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_menu_more" />
|
||||
@ -73,9 +79,10 @@
|
||||
android:id="@+id/iv_debug_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:scrollbars="none"
|
||||
android:singleLine="true"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="6dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@id/iv_progressBar"
|
||||
@ -91,6 +98,7 @@
|
||||
android:animationResolution="1000"
|
||||
android:indeterminate="true"
|
||||
android:indeterminateBehavior="repeat"
|
||||
android:scrollbars="none"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_debug_text"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
|
@ -3,7 +3,8 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollbars="none">
|
||||
|
||||
<io.legado.app.ui.widget.image.CoverImageView
|
||||
android:id="@+id/iv_cover"
|
||||
@ -12,6 +13,7 @@
|
||||
android:layout_margin="8dp"
|
||||
android:contentDescription="@string/img_cover"
|
||||
android:scaleType="centerCrop"
|
||||
android:scrollbars="none"
|
||||
android:src="@drawable/image_cover_default"
|
||||
android:transitionName="img_cover"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@ -25,6 +27,7 @@
|
||||
android:layout_height="8dp"
|
||||
android:layout_margin="8dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:scrollbars="none"
|
||||
android:src="@color/md_green_600"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintLeft_toRightOf="@id/iv_cover"
|
||||
@ -35,14 +38,16 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
android:scrollbars="none"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:scrollbars="none"
|
||||
android:singleLine="true"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/primaryText"
|
||||
@ -55,8 +60,9 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginTop="3dp"
|
||||
android:orientation="vertical"
|
||||
android:scrollbars="none"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_cover"
|
||||
app:layout_constraintLeft_toRightOf="@+id/iv_cover"
|
||||
app:layout_constraintRight_toRightOf="@id/tv_name"
|
||||
@ -68,6 +74,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:scrollbars="none"
|
||||
android:text="@string/author"
|
||||
android:textColor="@color/primaryText"
|
||||
android:textSize="12sp" />
|
||||
@ -76,7 +83,8 @@
|
||||
android:id="@+id/ll_kind"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal" />
|
||||
android:orientation="horizontal"
|
||||
android:scrollbars="none" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_lasted"
|
||||
@ -84,6 +92,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:scrollbars="none"
|
||||
android:text="@string/last_read"
|
||||
android:textColor="@color/primaryText"
|
||||
android:textSize="12sp" />
|
||||
@ -93,6 +102,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:ellipsize="end"
|
||||
android:scrollbars="none"
|
||||
android:text="@string/book_intro"
|
||||
android:textColor="@color/primaryText"
|
||||
android:textSize="12sp" />
|
||||
|
Loading…
Reference in New Issue
Block a user