feat: 优化代码

pull/97/head
kunfei 5 years ago
parent 94fefb6761
commit 1ceeeca174
  1. 7
      app/build.gradle
  2. 1
      app/src/main/AndroidManifest.xml
  3. 17
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt
  4. 2
      build.gradle

@ -115,6 +115,7 @@ dependencies {
implementation 'androidx.viewpager2:viewpager2:1.0.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.google.android:flexbox:1.1.0'
implementation 'com.google.code.gson:gson:2.8.5'
//lifecycle
def lifecycle_version = '2.2.0'
@ -143,13 +144,12 @@ dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
//
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'org.jsoup:jsoup:1.12.1'
implementation 'cn.wanghaomiao:JsoupXpath:2.3.2'
implementation 'com.jayway.jsonpath:json-path:2.4.0'
//JS
implementation 'com.github.gedoor:rhino-android:1.3'
//JS rhino
implementation 'io.apisense:rhino-android:1.1.1'
//Retrofit
implementation 'com.squareup.okhttp3:logging-interceptor:4.1.0'
@ -177,6 +177,7 @@ dependencies {
//
implementation 'com.github.houbb:opencc4j:1.4.0'
}
apply plugin: 'com.google.gms.google-services'

@ -24,7 +24,6 @@
android:networkSecurityConfig="@xml/network_security_config"
android:supportsRtl="true"
android:theme="@style/AppTheme.Light"
android:requestLegacyExternalStorage="false"
tools:ignore="AllowBackup,GoogleAppIndexingWarning,UnusedAttribute">
<!--主入口-->
<activity android:name=".ui.welcome.WelcomeActivity">

@ -585,12 +585,17 @@ class AnalyzeRule(var book: BaseBook? = null) : JsExtensions {
*/
@Throws(Exception::class)
private fun evalJS(jsStr: String, result: Any?): Any? {
val bindings = SimpleBindings()
bindings["java"] = this
bindings["book"] = book
bindings["result"] = result
bindings["baseUrl"] = baseUrl
return SCRIPT_ENGINE.eval(jsStr, bindings)
try {
val bindings = SimpleBindings()
bindings["java"] = this
bindings["book"] = book
bindings["result"] = result
bindings["baseUrl"] = baseUrl
return SCRIPT_ENGINE.eval(jsStr, bindings)
} catch (e: Exception) {
e.printStackTrace()
throw e
}
}
/**

@ -22,6 +22,8 @@ allprojects {
google()
jcenter()
maven { url "https://jitpack.io" }
maven { url 'https://maven.google.com/' }
maven { url 'https://github.com/psiegman/mvn-repo/raw/master/releases' }
}
}

Loading…
Cancel
Save