[优化] 一些代码优化

This commit is contained in:
HapeLee committed 2026-04-29 00:21:00 +08:00
1 parent e995412536
commit 0afed18353
46 files changed
+1041 -1699

No files matched your search

@@ -1,31 +0,0 @@
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<io.legado.app.ui.widget.TitleBar
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:contentInsetStartWithNavigation="0dp"
app:contentLayout="@layout/view_search"
app:layout_constraintTop_toTopOf="parent"
app:title="@string/bookshelf_management" />
<io.legado.app.ui.widget.recycler.scroller.FastScrollRecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:scrollbars="none"
app:layout_constraintBottom_toTopOf="@id/select_action_bar"
app:layout_constraintTop_toBottomOf="@id/title_bar" />
<io.legado.app.ui.widget.SelectActionBar
android:id="@+id/select_action_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -1,98 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:orientation="vertical">
<io.legado.app.ui.widget.TitleBar
android:id="@+id/tool_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="?attr/actionBarStyle"
app:attachToActivity="false"
app:contentLayout="@layout/view_search"
app:fitStatusBar="false"
tools:ignore="RtlHardcoded,RtlSymmetry" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<io.legado.app.ui.widget.recycler.scroller.FastScrollRecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"
tools:ignore="SpeakableTextPresentCheck" />
<com.google.android.material.loadingindicator.LoadingIndicator
android:id="@+id/rotate_loading"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center"
android:layout_margin="6dp"
android:visibility="gone"
app:loading_width="2dp" />
<TextView
android:id="@+id/tv_msg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="16dp"
android:textColor="@color/secondaryText"
android:visibility="gone" />
</FrameLayout>
<com.google.android.flexbox.FlexboxLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="12dp"
android:paddingRight="12dp"
app:flexWrap="wrap"
app:justifyContent="space_between">
<io.legado.app.ui.widget.text.AccentTextView
android:id="@+id/tv_footer_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
android:visibility="gone"
tools:ignore="RtlHardcoded" />
<Space
android:layout_width="0dp"
android:layout_height="0dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<io.legado.app.ui.widget.text.AccentTextView
android:id="@+id/tv_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
android:text="@string/cancel"
android:visibility="gone"
tools:ignore="RtlHardcoded" />
<io.legado.app.ui.widget.text.AccentTextView
android:id="@+id/tv_ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
android:text="@string/ok"
android:visibility="gone"
tools:ignore="RtlHardcoded" />
</LinearLayout>
</com.google.android.flexbox.FlexboxLayout>
</LinearLayout>
@@ -1,94 +0,0 @@
<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="wrap_content"
android:background="?attr/selectableItemBackground"
android:paddingStart="4dp"
android:paddingEnd="16dp"
android:paddingTop="2dp"
android:paddingBottom="8dp">
<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingBottom="2dp"
android:singleLine="true"
android:text="@string/book_name"
style="@style/ChapterNameText"
app:layout_constraintStart_toEndOf="@id/checkbox"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/checkbox"
app:layout_constraintBottom_toBottomOf="@id/checkbox"/>
<TextView
android:id="@+id/tv_author"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:singleLine="true"
android:text="@string/author"
android:textSize="12sp"
tools:ignore="RtlHardcoded"
app:layout_constraintStart_toStartOf="@id/tv_name"
app:layout_constraintEnd_toStartOf="@id/tv_group"
app:layout_constraintTop_toBottomOf="@id/tv_name" />
<TextView
android:id="@+id/tv_origin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:textSize="12sp"
tools:text="@string/book_source"
app:layout_constraintStart_toStartOf="@id/tv_name"
app:layout_constraintTop_toBottomOf="@id/tv_author" />
<TextView
android:id="@+id/tv_group_s"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/ungroup"
android:layout_marginStart="8dp"
android:singleLine="true"
android:textSize="12sp"
app:layout_constraintStart_toEndOf="@id/tv_origin"
app:layout_constraintEnd_toStartOf="@id/tv_group"
app:layout_constraintBaseline_toBaselineOf="@id/tv_origin" />
<com.google.android.material.button.MaterialButton
android:id="@+id/tv_group"
android:layout_width="wrap_content"
android:layout_height="40dp"
style="@style/Widget.Material3Expressive.Button.TonalButton"
android:textSize="12sp"
android:layout_marginEnd="4dp"
android:minWidth="0dp"
android:padding="0dp"
android:text="@string/group"
app:layout_constraintTop_toTopOf="@id/tv_group_s"
app:layout_constraintBottom_toBottomOf="@id/tv_group_s"
app:layout_constraintEnd_toStartOf="@id/tv_delete" />
<com.google.android.material.button.MaterialButton
android:id="@+id/tv_delete"
android:layout_width="40dp"
android:layout_height="40dp"
style="@style/Widget.Material3Expressive.Button.IconButton.Outlined"
app:icon="@drawable/ic_clear_all"
app:iconSize="20dp"
app:iconGravity="textStart"
app:layout_constraintTop_toTopOf="@id/tv_group_s"
app:layout_constraintBottom_toBottomOf="@id/tv_group_s"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -1,32 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu 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"
tools:ignore="AlwaysShowAction">
<item
android:id="@+id/menu_book_group"
android:icon="@drawable/ic_groups"
android:title="@string/group"
app:showAsAction="always">
<menu>
<item
android:id="@+id/menu_group_manage"
android:title="@string/group_manage" />
</menu>
</item>
<item
android:id="@+id/menu_export_all_use_book_source"
android:title="@string/export_all_use_book_source" />
<item
android:id="@+id/menu_open_book_info_by_click_title"
android:checkable="true"
android:title="@string/open_book_info_by_click_title" />
</menu>
@@ -1,32 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/menu_del_selection"
android:title="@string/delete" />
<item
android:id="@+id/menu_update_enable"
android:title="@string/allow_update" />
<item
android:id="@+id/menu_update_disable"
android:title="@string/disable_update" />
<item
android:id="@+id/menu_add_to_group"
android:title="@string/add_to_group" />
<item
android:id="@+id/menu_change_source"
android:title="@string/change_source_batch" />
<item
android:id="@+id/menu_clear_cache"
android:title="@string/clear_cache" />
<item
android:id="@+id/menu_check_selected_interval"
android:title="@string/check_selected_interval" />
</menu>
-8
View File
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/menu_change_source_delay"
android:title="@string/change_source_delay" />
</menu>
+7 -3
View File
@@ -243,10 +243,12 @@
<string name="download_cancel">取消下载</string>
<string name="no_download">暂无任务</string>
<string name="download_count">%1$d/%2$d</string>
<string name="cache_download_failed">缓存失败:%1$s</string>
<string name="import_select_book">导入选择书籍</string>
<string name="threads_num_title">更新和搜索线程数</string>
<string name="cache_book_threads_num_title">书籍缓存下载线程数</string>
<string name="cache_book_threads_num_summary">控制离线缓存章节下载的并发数量</string>
<string name="threads_num_title">更新和搜索线程</string>
<string name="threads_num_summary">控制更新和搜索线程的并发数量。数值越高越不稳定</string>
<string name="cache_book_threads_num_title">书籍缓存下载线程</string>
<string name="cache_book_threads_num_summary">控制离线缓存章节下载的并发数量。数值越高越不稳定</string>
<string name="change_icon">切换图标</string>
<string name="remove_from_bookshelf">已在书架</string>
<string name="already_in_bookshelf">已在书架</string>
@@ -910,6 +912,8 @@
<string name="style">样式</string>
<string name="group_style">分组样式</string>
<string name="export_file_name">导出文件名</string>
<string name="export_file_name_template_hint">{name} - {author}</string>
<string name="export_file_name_template_help">可用变量:{name} 书名、{author} 作者、{group} 分组、{source} 书源、{remark} 备注。\n\n示例:{name} - {author}\n输出:三体 - 刘慈欣\n\n变量前后可以添加固定文字。</string>
<string name="reset">重置</string>
<string name="null_url">URL 为空</string>
<string name="dict">字典</string>
+5 -1
View File
@@ -246,10 +246,12 @@
<string name="download_cancel">Download cancel</string>
<string name="no_download">No download</string>
<string name="download_count">Downloaded %1$d/%2$d</string>
<string name="cache_download_failed">Cache failed: %1$s</string>
<string name="import_select_book">Import selected book(s)</string>
<string name="threads_num_title">Number of Concurrent Tasks</string>
<string name="threads_num_summary">Controls concurrent download tasks. Higher values increase OOM risk</string>
<string name="cache_book_threads_num_title">Cache Download Threads</string>
<string name="cache_book_threads_num_summary">Controls concurrent chapter downloads for offline book cache</string>
<string name="cache_book_threads_num_summary">Controls concurrent chapter downloads for offline book cache. Higher values increase OOM risk</string>
<string name="change_icon">Change Icon</string>
<string name="remove_from_bookshelf">In library</string>
<string name="already_in_bookshelf">Already in Bookshelf</string>
@@ -919,6 +921,8 @@
<string name="style">Style</string>
<string name="group_style">Group style</string>
<string name="export_file_name">Export file name</string>
<string name="export_file_name_template_hint">{name} - {author}</string>
<string name="export_file_name_template_help">Available variables: {name} title, {author} author, {group} group, {source} source, {remark} remark.\n\nExample: {name} - {author}\nResult: The Three-Body Problem - Liu Cixin\n\nYou can add fixed text before or after variables.</string>
<string name="reset">Reset</string>
<string name="null_url">Null URL</string>
<string name="dict">dict</string>