cronet网络组件合并到app,再设置里开启

pull/1272/head
gedoor 4 years ago
parent 9dd10f2db8
commit 045dc060cf
  1. 11
      app/build.gradle
  2. 21
      app/src/main/java/io/legado/app/base/BaseActivity.kt
  3. 1
      app/src/main/java/io/legado/app/constant/PreferKey.kt
  4. 2
      app/src/main/java/io/legado/app/help/AppConfig.kt
  5. 1
      app/src/main/res/values-es-rES/strings.xml
  6. 1
      app/src/main/res/values-ja-rJP/strings.xml
  7. 1
      app/src/main/res/values-pt-rBR/strings.xml
  8. 1
      app/src/main/res/values-zh-rHK/strings.xml
  9. 1
      app/src/main/res/values-zh-rTW/strings.xml
  10. 1
      app/src/main/res/values-zh/strings.xml
  11. 1
      app/src/main/res/values/strings.xml
  12. 6
      app/src/main/res/xml/pref_config_other.xml

@ -89,14 +89,6 @@ android {
applicationId "io.legado.play" applicationId "io.legado.play"
manifestPlaceholders = [APP_CHANNEL_VALUE: "google"] manifestPlaceholders = [APP_CHANNEL_VALUE: "google"]
} }
cronet {
dimension "mode"
applicationId "io.legado.cronet"
manifestPlaceholders = [APP_CHANNEL_VALUE: "cronet"]
ndk {
abiFilters 'arm64-v8a','armeabi-v7a','x86_64','x86'
}
}
} }
compileOptions { compileOptions {
// Flag to enable support for the new language APIs // Flag to enable support for the new language APIs
@ -190,8 +182,7 @@ dependencies {
// //
implementation('com.squareup.okhttp3:okhttp:4.9.1') implementation('com.squareup.okhttp3:okhttp:4.9.1')
compileOnly(fileTree(dir: 'cronetlib', include: ['*.jar', '*.aar'])) implementation(fileTree(dir: 'cronetlib', include: ['*.jar', '*.aar']))
cronetImplementation(fileTree(dir: 'cronetlib', include: ['*.jar', '*.aar']))
//Glide //Glide
implementation('com.github.bumptech.glide:glide:4.12.0') implementation('com.github.bumptech.glide:glide:4.12.0')

@ -15,7 +15,6 @@ import androidx.viewbinding.ViewBinding
import io.legado.app.App import io.legado.app.App
import io.legado.app.R import io.legado.app.R
import io.legado.app.constant.AppConst import io.legado.app.constant.AppConst
import io.legado.app.constant.PreferKey
import io.legado.app.constant.Theme import io.legado.app.constant.Theme
import io.legado.app.help.AppConfig import io.legado.app.help.AppConfig
import io.legado.app.help.ThemeConfig import io.legado.app.help.ThemeConfig
@ -67,26 +66,6 @@ abstract class BaseActivity<VB : ViewBinding>(
} }
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
getPrefBoolean(PreferKey.highBrush)
) {
/**
* 添加高刷新率支持
*/
// 获取系统window支持的模式
@Suppress("DEPRECATION")
val modes = window.windowManager.defaultDisplay.supportedModes
// 对获取的模式,基于刷新率的大小进行排序,从小到大排序
modes.sortBy {
it.refreshRate
}
window.let {
val lp = it.attributes
// 取出最大的那一个刷新率,直接设置给window
lp.preferredDisplayModeId = modes.last().modeId
it.attributes = lp
}
}
window.decorView.disableAutoFill() window.decorView.disableAutoFill()
initTheme() initTheme()
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)

@ -82,7 +82,6 @@ object PreferKey {
const val exportUseReplace = "exportUseReplace" const val exportUseReplace = "exportUseReplace"
const val useZhLayout = "useZhLayout" const val useZhLayout = "useZhLayout"
const val fullScreenGesturesSupport = "fullScreenGesturesSupport" const val fullScreenGesturesSupport = "fullScreenGesturesSupport"
const val highBrush = "highBrush"
const val brightness = "brightness" const val brightness = "brightness"
const val nightBrightness = "nightBrightness" const val nightBrightness = "nightBrightness"
const val expandTextMenu = "expandTextMenu" const val expandTextMenu = "expandTextMenu"

@ -10,7 +10,7 @@ import splitties.init.appCtx
@Suppress("MemberVisibilityCanBePrivate") @Suppress("MemberVisibilityCanBePrivate")
object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener { object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
val isGooglePlay = appCtx.channel == "google" val isGooglePlay = appCtx.channel == "google"
val isCronet = appCtx.channel == "cronet" val isCronet = appCtx.getPrefBoolean("Cronet")
var userAgent: String = getPrefUserAgent() var userAgent: String = getPrefUserAgent()
var isEInkMode = appCtx.getPrefString(PreferKey.themeMode) == "3" var isEInkMode = appCtx.getPrefString(PreferKey.themeMode) == "3"
var clickActionTL = appCtx.getPrefInt(PreferKey.clickActionTL, 2) var clickActionTL = appCtx.getPrefInt(PreferKey.clickActionTL, 2)

@ -863,4 +863,5 @@
<string name="background_image_blurring_radius">Blurring radius</string> <string name="background_image_blurring_radius">Blurring radius</string>
<string name="background_image_hint">Disabled when 0, enable range from 1 to 25\nThe greater the radius, the stronger the effect of blurring</string> <string name="background_image_hint">Disabled when 0, enable range from 1 to 25\nThe greater the radius, the stronger the effect of blurring</string>
<string name="need_login">需登录</string> <string name="need_login">需登录</string>
<string name="pref_cronet_summary">使用Cronet网络组件</string>
</resources> </resources>

@ -863,4 +863,5 @@
<string name="background_image_blurring_radius">Blurring radius</string> <string name="background_image_blurring_radius">Blurring radius</string>
<string name="background_image_hint">Disabled when 0, enable range from 1 to 25\nThe greater the radius, the stronger the effect of blurring</string> <string name="background_image_hint">Disabled when 0, enable range from 1 to 25\nThe greater the radius, the stronger the effect of blurring</string>
<string name="need_login">需登录</string> <string name="need_login">需登录</string>
<string name="pref_cronet_summary">使用Cronet网络组件</string>
</resources> </resources>

@ -863,5 +863,6 @@
<string name="background_image_blurring_radius">Blurring radius</string> <string name="background_image_blurring_radius">Blurring radius</string>
<string name="background_image_hint">Disabled when 0, enable range from 1 to 25\nThe greater the radius, the stronger the effect of blurring</string> <string name="background_image_hint">Disabled when 0, enable range from 1 to 25\nThe greater the radius, the stronger the effect of blurring</string>
<string name="need_login">需登录</string> <string name="need_login">需登录</string>
<string name="pref_cronet_summary">使用Cronet网络组件</string>
</resources> </resources>

@ -860,5 +860,6 @@
<string name="check_source_show_debug_message">校驗書源顯示詳細信息</string> <string name="check_source_show_debug_message">校驗書源顯示詳細信息</string>
<string name="check_source_show_debug_message_summary">書源校驗時顯示網絡請求步驟和時間</string> <string name="check_source_show_debug_message_summary">書源校驗時顯示網絡請求步驟和時間</string>
<string name="need_login">需登录</string> <string name="need_login">需登录</string>
<string name="pref_cronet_summary">使用Cronet网络组件</string>
</resources> </resources>

@ -861,5 +861,6 @@
<string name="check_source_show_debug_message">校驗書源顯示詳細信息</string> <string name="check_source_show_debug_message">校驗書源顯示詳細信息</string>
<string name="check_source_show_debug_message_summary">書源校驗時顯示網絡請求步驟和時間</string> <string name="check_source_show_debug_message_summary">書源校驗時顯示網絡請求步驟和時間</string>
<string name="need_login">需登录</string> <string name="need_login">需登录</string>
<string name="pref_cronet_summary">使用Cronet网络组件</string>
</resources> </resources>

@ -862,5 +862,6 @@
<string name="check_source_show_debug_message">校验显示详细信息</string> <string name="check_source_show_debug_message">校验显示详细信息</string>
<string name="check_source_show_debug_message_summary">书源校验时显示网络请求步骤和时间</string> <string name="check_source_show_debug_message_summary">书源校验时显示网络请求步骤和时间</string>
<string name="need_login">需登录</string> <string name="need_login">需登录</string>
<string name="pref_cronet_summary">使用Cronet网络组件</string>
</resources> </resources>

@ -863,5 +863,6 @@
<string name="check_source_show_debug_message">Check book source shows debug message</string> <string name="check_source_show_debug_message">Check book source shows debug message</string>
<string name="check_source_show_debug_message_summary">Show network status and timestamp during source checking</string> <string name="check_source_show_debug_message_summary">Show network status and timestamp during source checking</string>
<string name="need_login">需登录</string> <string name="need_login">需登录</string>
<string name="pref_cronet_summary">使用Cronet网络组件</string>
</resources> </resources>

@ -57,10 +57,10 @@
android:title="UserAgent" /> android:title="UserAgent" />
<io.legado.app.ui.widget.prefs.SwitchPreference <io.legado.app.ui.widget.prefs.SwitchPreference
android:key="highBrush" android:key="Cronet"
android:defaultValue="false" android:defaultValue="false"
android:title="@string/high_brush_title" android:title="Cronet"
android:summary="@string/high_brush_summary" /> android:summary="@string/pref_cronet_summary" />
<io.legado.app.ui.widget.prefs.Preference <io.legado.app.ui.widget.prefs.Preference
android:key="preDownloadNum" android:key="preDownloadNum"

Loading…
Cancel
Save