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

This commit is contained in:
gedoor 2021-08-25 14:25:26 +08:00
parent 9dd10f2db8
commit 045dc060cf
12 changed files with 12 additions and 36 deletions

View File

@ -89,14 +89,6 @@ android {
applicationId "io.legado.play"
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 {
// Flag to enable support for the new language APIs
@ -190,8 +182,7 @@ dependencies {
//
implementation('com.squareup.okhttp3:okhttp:4.9.1')
compileOnly(fileTree(dir: 'cronetlib', include: ['*.jar', '*.aar']))
cronetImplementation(fileTree(dir: 'cronetlib', include: ['*.jar', '*.aar']))
implementation(fileTree(dir: 'cronetlib', include: ['*.jar', '*.aar']))
//Glide
implementation('com.github.bumptech.glide:glide:4.12.0')

View File

@ -15,7 +15,6 @@ import androidx.viewbinding.ViewBinding
import io.legado.app.App
import io.legado.app.R
import io.legado.app.constant.AppConst
import io.legado.app.constant.PreferKey
import io.legado.app.constant.Theme
import io.legado.app.help.AppConfig
import io.legado.app.help.ThemeConfig
@ -67,26 +66,6 @@ abstract class BaseActivity<VB : ViewBinding>(
}
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()
initTheme()
super.onCreate(savedInstanceState)

View File

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

View File

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

View File

@ -863,4 +863,5 @@
<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="need_login">需登录</string>
<string name="pref_cronet_summary">使用Cronet网络组件</string>
</resources>

View File

@ -863,4 +863,5 @@
<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="need_login">需登录</string>
<string name="pref_cronet_summary">使用Cronet网络组件</string>
</resources>

View File

@ -863,5 +863,6 @@
<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="need_login">需登录</string>
<string name="pref_cronet_summary">使用Cronet网络组件</string>
</resources>

View File

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

View File

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

View File

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

View File

@ -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_summary">Show network status and timestamp during source checking</string>
<string name="need_login">需登录</string>
<string name="pref_cronet_summary">使用Cronet网络组件</string>
</resources>

View File

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