pull/48/head
kunfei 5 years ago
parent 54168b8aa5
commit 99ffb829be
  1. 20
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt
  2. 2
      app/src/main/java/io/legado/app/model/webbook/BookChapterList.kt
  3. 6
      app/src/main/java/io/legado/app/ui/widget/anima/RotateLoading.kt
  4. 14
      app/src/main/res/layout/view_tab_layout.xml

@ -190,18 +190,16 @@ class AnalyzeRule(var book: BaseBook? = null) {
putRule(sourceRule.putMap) putRule(sourceRule.putMap)
sourceRule.makeUpRule(result) sourceRule.makeUpRule(result)
result?.let { result?.let {
if (sourceRule.rule.isNotBlank()) { result = when (sourceRule.mode) {
result = when (sourceRule.mode) { Mode.Js -> evalJS(sourceRule.rule, it)
Mode.Js -> evalJS(sourceRule.rule, it) Mode.Json -> getAnalyzeByJSonPath(it).getString(sourceRule.rule)
Mode.Json -> getAnalyzeByJSonPath(it).getString(sourceRule.rule) Mode.XPath -> getAnalyzeByXPath(it).getString(sourceRule.rule)
Mode.XPath -> getAnalyzeByXPath(it).getString(sourceRule.rule) Mode.Default -> if (isUrl) {
Mode.Default -> if (isUrl) { getAnalyzeByJSoup(it).getString0(sourceRule.rule)
getAnalyzeByJSoup(it).getString0(sourceRule.rule) } else {
} else { getAnalyzeByJSoup(it).getString(sourceRule.rule)
getAnalyzeByJSoup(it).getString(sourceRule.rule)
}
else -> sourceRule.rule
} }
else -> sourceRule.rule
} }
if (sourceRule.replaceRegex.isNotEmpty()) { if (sourceRule.replaceRegex.isNotEmpty()) {
result = replaceRegex(result.toString(), sourceRule) result = replaceRegex(result.toString(), sourceRule)

@ -169,7 +169,7 @@ object BookChapterList {
isVip = analyzeRule.getString(vipRule) isVip = analyzeRule.getString(vipRule)
if (bookChapter.url.isEmpty()) bookChapter.url = baseUrl if (bookChapter.url.isEmpty()) bookChapter.url = baseUrl
if (bookChapter.title.isNotEmpty()) { if (bookChapter.title.isNotEmpty()) {
if (isVip.isNotEmpty()) { if (isVip.isNotEmpty() && isVip != "null" && isVip != "false" && isVip != "0") {
bookChapter.title = "\uD83D\uDD12" + bookChapter.title bookChapter.title = "\uD83D\uDD12" + bookChapter.title
} }
chapterList.add(bookChapter) chapterList.add(bookChapter)

@ -10,6 +10,7 @@ import android.graphics.RectF
import android.util.AttributeSet import android.util.AttributeSet
import android.view.View import android.view.View
import io.legado.app.R import io.legado.app.R
import io.legado.app.lib.theme.accentColor
import io.legado.app.utils.dp import io.legado.app.utils.dp
/** /**
@ -66,14 +67,15 @@ class RotateLoading : View {
} }
private fun initView(context: Context, attrs: AttributeSet?) { private fun initView(context: Context, attrs: AttributeSet?) {
loadingColor = Color.WHITE loadingColor = context.accentColor
thisWidth = DEFAULT_WIDTH.dp thisWidth = DEFAULT_WIDTH.dp
shadowPosition = DEFAULT_SHADOW_POSITION.dp shadowPosition = DEFAULT_SHADOW_POSITION.dp
speedOfDegree = DEFAULT_SPEED_OF_DEGREE speedOfDegree = DEFAULT_SPEED_OF_DEGREE
if (null != attrs) { if (null != attrs) {
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.RotateLoading) val typedArray = context.obtainStyledAttributes(attrs, R.styleable.RotateLoading)
loadingColor = typedArray.getColor(R.styleable.RotateLoading_loading_color, Color.WHITE) loadingColor =
typedArray.getColor(R.styleable.RotateLoading_loading_color, loadingColor)
thisWidth = typedArray.getDimensionPixelSize( thisWidth = typedArray.getDimensionPixelSize(
R.styleable.RotateLoading_loading_width, R.styleable.RotateLoading_loading_width,
DEFAULT_WIDTH.dp DEFAULT_WIDTH.dp

@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.tabs.TabLayout <com.google.android.material.tabs.TabLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/tab_layout" android:id="@+id/tab_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:theme="?attr/actionBarStyle"/> android:theme="?attr/actionBarStyle"
app:tabMaxWidth="100dp"
app:tabMinWidth="10dp" />
Loading…
Cancel
Save