Merge pull request #3316 from adhu2018/harmless

修复、优化
This commit is contained in:
Horis
2023-09-01 19:01:08 +08:00
committed by GitHub
10 changed files with 25 additions and 8 deletions
@@ -87,6 +87,10 @@ data class ReplaceRule(
return false
}
}
// Pattern.compile测试通过,但是部分情况下会替换超时,报错,一般发生在修改表达式时漏删了
if (pattern.endsWith('|') and !pattern.endsWith("\\|")) {
return false
}
return true
}
@@ -137,6 +137,18 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
appCtx.putPrefInt(PreferKey.bookGroupStyle, value)
}
var bookshelfLayout: Int
get() = appCtx.getPrefInt(PreferKey.bookshelfLayout, 0)
set(value) {
appCtx.putPrefInt(PreferKey.bookshelfLayout, value)
}
var saveTabPosition: Int
get() = appCtx.getPrefInt(PreferKey.saveTabPosition, 0)
set(value) {
appCtx.putPrefInt(PreferKey.saveTabPosition, value)
}
var bookExportFileName: String?
get() = appCtx.getPrefString(PreferKey.bookExportFileName)
set(value) {
@@ -173,7 +173,7 @@ abstract class BaseBookshelfFragment(layoutId: Int) : VMBaseFragment<BookshelfVi
upSort()
}
if (bookshelfLayout != rgLayout.getCheckedIndex()) {
putPrefInt(PreferKey.bookshelfLayout, rgLayout.getCheckedIndex())
AppConfig.bookshelfLayout = rgLayout.getCheckedIndex()
postEvent(EventBus.RECREATE, "")
}
}
@@ -16,6 +16,7 @@ import io.legado.app.data.appDb
import io.legado.app.data.entities.Book
import io.legado.app.data.entities.BookGroup
import io.legado.app.databinding.FragmentBookshelf1Binding
import io.legado.app.help.config.AppConfig
import io.legado.app.lib.theme.accentColor
import io.legado.app.lib.theme.primaryColor
import io.legado.app.ui.book.group.GroupEditDialog
@@ -109,7 +110,7 @@ class BookshelfFragment1() : BaseBookshelfFragment(R.layout.fragment_bookshelf1)
private fun selectLastTab() {
tabLayout.post {
tabLayout.removeOnTabSelectedListener(this)
tabLayout.getTabAt(getPrefInt(PreferKey.saveTabPosition, 0))?.select()
tabLayout.getTabAt(AppConfig.saveTabPosition)?.select()
tabLayout.addOnTabSelectedListener(this)
}
}
@@ -89,7 +89,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:entries="@array/book_type"
app:theme="@style/Spinner" />
android:theme="@style/Spinner" />
</LinearLayout>
@@ -39,7 +39,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:entries="@array/book_type"
app:theme="@style/Spinner"
android:theme="@style/Spinner"
tools:ignore="TouchTargetSizeCheck" />
<io.legado.app.lib.theme.view.ThemeCheckBox
@@ -76,7 +76,7 @@
app:layout_constraintBottom_toBottomOf="@id/tv_sort"
app:layout_constraintLeft_toRightOf="@+id/tv_sort"
app:layout_constraintTop_toTopOf="@id/tv_sort"
app:theme="@style/Spinner"
android:theme="@style/Spinner"
tools:ignore="RtlHardcoded" />
<io.legado.app.lib.theme.view.ThemeCheckBox
@@ -26,7 +26,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:entries="@array/group_style"
app:theme="@style/Spinner"
android:theme="@style/Spinner"
tools:ignore="TouchTargetSizeCheck" />
</LinearLayout>
@@ -24,7 +24,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:entries="@array/rule_type"
app:theme="@style/Spinner" />
android:theme="@style/Spinner" />
</LinearLayout>
@@ -60,7 +60,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:entries="@array/server_type"
app:theme="@style/Spinner"
android:theme="@style/Spinner"
tools:ignore="TouchTargetSizeCheck" />
</LinearLayout>