feat: 优化代码

pull/103/head
kunfei 5 years ago
parent 862a9457d0
commit bbc2823c08
  1. 2
      app/src/main/java/io/legado/app/help/BookHelp.kt
  2. 5
      app/src/main/java/io/legado/app/ui/main/MainActivity.kt

@ -270,8 +270,8 @@ object BookHelp {
}
}
when (AppConfig.chineseConverterType) {
2 -> c = ZhConvertBootstrap.newInstance().toTraditional(c)
1 -> c = ZhConvertBootstrap.newInstance().toSimple(c)
2 -> c = ZhConvertBootstrap.newInstance().toTraditional(c)
}
val indent = App.INSTANCE.getPrefInt("textIndent", 2)
return c.replace("\\s*\\n+\\s*".toRegex(), "\n" + " ".repeat(indent))

@ -7,6 +7,7 @@ import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter
import androidx.viewpager.widget.ViewPager
import com.github.houbb.opencc4j.util.ZhConverterUtil
import com.google.android.material.bottomnavigation.BottomNavigationView
import io.legado.app.App
import io.legado.app.BuildConfig
@ -51,6 +52,10 @@ class MainActivity : VMBaseActivity<MainViewModel>(R.layout.activity_main),
override fun onPostCreate(savedInstanceState: Bundle?) {
super.onPostCreate(savedInstanceState)
upVersion()
when (AppConfig.chineseConverterType) {
1 -> ZhConverterUtil.toSimple("初始化")
2 -> ZhConverterUtil.toTraditional("初始化")
}
if (AppConfig.autoRefreshBook) {
view_pager_main.postDelayed({
viewModel.upChapterList()

Loading…
Cancel
Save