mirror of
https://github.com/gedoor/legado.git
synced 2024-09-03 09:55:00 +08:00
优化
This commit is contained in:
parent
5c530751e0
commit
ea7fa4d3b3
@ -115,6 +115,7 @@ object PreferKey {
|
||||
const val ignoreAudioFocus = "ignoreAudioFocus"
|
||||
const val parallelExportBook = "parallelExportBook"
|
||||
const val progressBarBehavior = "progressBarBehavior"
|
||||
const val sourceEditMaxLine = "sourceEditMaxLine"
|
||||
|
||||
const val cPrimary = "colorPrimary"
|
||||
const val cAccent = "colorAccent"
|
||||
|
@ -368,15 +368,27 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
appCtx.putPrefInt(PreferKey.bitmapCacheSize, value)
|
||||
}
|
||||
|
||||
var showReadTitleBarAddition : Boolean
|
||||
var showReadTitleBarAddition: Boolean
|
||||
get() = appCtx.getPrefBoolean(PreferKey.showReadTitleAddition, true)
|
||||
set(value) {
|
||||
appCtx.putPrefBoolean(PreferKey.showReadTitleAddition, value)
|
||||
}
|
||||
var readBarStyleFollowPage : Boolean
|
||||
var readBarStyleFollowPage: Boolean
|
||||
get() = appCtx.getPrefBoolean(PreferKey.readBarStyleFollowPage, false)
|
||||
set(value) {
|
||||
appCtx.putPrefBoolean(PreferKey.readBarStyleFollowPage, value)
|
||||
}
|
||||
|
||||
var sourceEditMaxLine: Int
|
||||
get() {
|
||||
val maxLine = appCtx.getPrefInt(PreferKey.sourceEditMaxLine, Int.MAX_VALUE)
|
||||
if (maxLine < 10) {
|
||||
return 99
|
||||
}
|
||||
return maxLine
|
||||
}
|
||||
set(value) {
|
||||
appCtx.putPrefInt(PreferKey.sourceEditMaxLine, value)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,12 +9,15 @@ import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import io.legado.app.R
|
||||
import io.legado.app.databinding.ItemSourceEditBinding
|
||||
import io.legado.app.help.config.AppConfig
|
||||
import io.legado.app.ui.widget.code.addJsPattern
|
||||
import io.legado.app.ui.widget.code.addJsonPattern
|
||||
import io.legado.app.ui.widget.code.addLegadoPattern
|
||||
|
||||
class BookSourceEditAdapter : RecyclerView.Adapter<BookSourceEditAdapter.MyViewHolder>() {
|
||||
|
||||
val editEntityMaxLine = AppConfig.sourceEditMaxLine
|
||||
|
||||
var editEntities: ArrayList<EditEntity> = ArrayList()
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
set(value) {
|
||||
@ -39,10 +42,12 @@ class BookSourceEditAdapter : RecyclerView.Adapter<BookSourceEditAdapter.MyViewH
|
||||
return editEntities.size
|
||||
}
|
||||
|
||||
class MyViewHolder(val binding: ItemSourceEditBinding) : RecyclerView.ViewHolder(binding.root) {
|
||||
inner class MyViewHolder(val binding: ItemSourceEditBinding) :
|
||||
RecyclerView.ViewHolder(binding.root) {
|
||||
|
||||
fun bind(editEntity: EditEntity) = binding.run {
|
||||
editText.setTag(R.id.tag, editEntity.key)
|
||||
editText.maxLines = editEntityMaxLine
|
||||
if (editText.getTag(R.id.tag1) == null) {
|
||||
val listener = object : View.OnAttachStateChangeListener {
|
||||
override fun onViewAttachedToWindow(v: View) {
|
||||
|
@ -60,6 +60,7 @@ class OtherConfigFragment : PreferenceFragment(),
|
||||
}
|
||||
upPreferenceSummary(PreferKey.checkSource, CheckSource.summary)
|
||||
upPreferenceSummary(PreferKey.bitmapCacheSize, AppConfig.bitmapCacheSize.toString())
|
||||
upPreferenceSummary(PreferKey.sourceEditMaxLine, AppConfig.sourceEditMaxLine.toString())
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
@ -119,7 +120,16 @@ class OtherConfigFragment : PreferenceFragment(),
|
||||
ImageProvider.bitmapLruCache.resize(ImageProvider.cacheSize)
|
||||
}
|
||||
}
|
||||
|
||||
PreferKey.sourceEditMaxLine -> {
|
||||
NumberPickerDialog(requireContext())
|
||||
.setTitle(getString(R.string.source_edit_text_max_line))
|
||||
.setMaxValue(99)
|
||||
.setMinValue(10)
|
||||
.setValue(AppConfig.sourceEditMaxLine)
|
||||
.show {
|
||||
AppConfig.sourceEditMaxLine = it
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.onPreferenceTreeClick(preference)
|
||||
}
|
||||
@ -160,6 +170,9 @@ class OtherConfigFragment : PreferenceFragment(),
|
||||
PreferKey.bitmapCacheSize -> {
|
||||
upPreferenceSummary(key, AppConfig.bitmapCacheSize.toString())
|
||||
}
|
||||
PreferKey.sourceEditMaxLine -> {
|
||||
upPreferenceSummary(key, AppConfig.sourceEditMaxLine.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,12 +9,15 @@ import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import io.legado.app.R
|
||||
import io.legado.app.databinding.ItemSourceEditBinding
|
||||
import io.legado.app.help.config.AppConfig
|
||||
import io.legado.app.ui.widget.code.addJsPattern
|
||||
import io.legado.app.ui.widget.code.addJsonPattern
|
||||
import io.legado.app.ui.widget.code.addLegadoPattern
|
||||
|
||||
class RssSourceEditAdapter : RecyclerView.Adapter<RssSourceEditAdapter.MyViewHolder>() {
|
||||
|
||||
val editEntityMaxLine = AppConfig.sourceEditMaxLine
|
||||
|
||||
var editEntities: ArrayList<EditEntity> = ArrayList()
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
set(value) {
|
||||
@ -39,9 +42,11 @@ class RssSourceEditAdapter : RecyclerView.Adapter<RssSourceEditAdapter.MyViewHol
|
||||
return editEntities.size
|
||||
}
|
||||
|
||||
class MyViewHolder(val binding: ItemSourceEditBinding) : RecyclerView.ViewHolder(binding.root) {
|
||||
inner class MyViewHolder(val binding: ItemSourceEditBinding) :
|
||||
RecyclerView.ViewHolder(binding.root) {
|
||||
|
||||
fun bind(editEntity: EditEntity) = binding.run {
|
||||
editText.maxLines = editEntityMaxLine
|
||||
if (editText.getTag(R.id.tag1) == null) {
|
||||
val listener = object : View.OnAttachStateChangeListener {
|
||||
override fun onViewAttachedToWindow(v: View) {
|
||||
|
@ -9,7 +9,6 @@
|
||||
android:id="@+id/editText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textMultiLine"
|
||||
android:maxLines="12" />
|
||||
android:inputType="textMultiLine" />
|
||||
|
||||
</io.legado.app.ui.widget.text.TextInputLayout>
|
@ -1023,7 +1023,7 @@
|
||||
<string name="delete_review_url">删除段评URL(deleteUrl)</string>
|
||||
<string name="tag_explore_enabled">标志:发现已启用</string>
|
||||
<string name="tag_explore_disabled">标志:发现已禁用</string>
|
||||
<string name="show_read_title_addition">show read title addition area</string>
|
||||
<string name="show_read_title_addition">show read title addition área</string>
|
||||
<string name="read_bar_style_follow_page">read bar style follow page</string>
|
||||
<string name="rule_image_decode">Decode Image(imageDecode)</string>
|
||||
<string name="like_source">赞</string>
|
||||
@ -1037,4 +1037,5 @@
|
||||
<string name="local_no_group">本地未分组</string>
|
||||
<string name="parallel_export_book">多线程导出TXT</string>
|
||||
<string name="progress_bar_behavior">进度条行为</string>
|
||||
<string name="source_edit_text_max_line">源编辑框最大行数</string>
|
||||
</resources>
|
||||
|
@ -1040,4 +1040,5 @@
|
||||
<string name="local_no_group">本地未分组</string>
|
||||
<string name="parallel_export_book">多线程导出TXT</string>
|
||||
<string name="progress_bar_behavior">进度条行为</string>
|
||||
<string name="source_edit_text_max_line">源编辑框最大行数</string>
|
||||
</resources>
|
||||
|
@ -1040,4 +1040,5 @@
|
||||
<string name="local_no_group">本地未分组</string>
|
||||
<string name="parallel_export_book">多线程导出TXT</string>
|
||||
<string name="progress_bar_behavior">进度条行为</string>
|
||||
<string name="source_edit_text_max_line">源编辑框最大行数</string>
|
||||
</resources>
|
||||
|
@ -1037,4 +1037,5 @@
|
||||
<string name="local_no_group">本地未分组</string>
|
||||
<string name="parallel_export_book">多线程导出TXT</string>
|
||||
<string name="progress_bar_behavior">进度条行为</string>
|
||||
<string name="source_edit_text_max_line">源编辑框最大行数</string>
|
||||
</resources>
|
||||
|
@ -1039,4 +1039,5 @@
|
||||
<string name="local_no_group">本地未分组</string>
|
||||
<string name="parallel_export_book">多线程导出TXT</string>
|
||||
<string name="progress_bar_behavior">进度条行为</string>
|
||||
<string name="source_edit_text_max_line">源编辑框最大行数</string>
|
||||
</resources>
|
||||
|
@ -1039,4 +1039,5 @@
|
||||
<string name="local_no_group">本地未分组</string>
|
||||
<string name="parallel_export_book">多线程导出TXT</string>
|
||||
<string name="progress_bar_behavior">进度条行为</string>
|
||||
<string name="source_edit_text_max_line">源编辑框最大行数</string>
|
||||
</resources>
|
||||
|
@ -1040,4 +1040,5 @@
|
||||
<string name="local_no_group">本地未分组</string>
|
||||
<string name="parallel_export_book">多线程导出TXT</string>
|
||||
<string name="progress_bar_behavior">进度条行为</string>
|
||||
<string name="source_edit_text_max_line">源编辑框最大行数</string>
|
||||
</resources>
|
||||
|
@ -61,6 +61,10 @@
|
||||
android:summary="@string/book_tree_uri_s"
|
||||
android:title="@string/book_tree_uri_t" />
|
||||
|
||||
<io.legado.app.lib.prefs.Preference
|
||||
android:key="sourceEditMaxLine"
|
||||
android:title="@string/source_edit_text_max_line" />
|
||||
|
||||
<io.legado.app.lib.prefs.Preference
|
||||
android:key="checkSource"
|
||||
android:title="@string/check_source_config" />
|
||||
|
Loading…
Reference in New Issue
Block a user