优化
This commit is contained in:
+4
-16
@@ -41,7 +41,7 @@ android {
|
|||||||
}
|
}
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "io.legado.app"
|
applicationId "io.legado.app"
|
||||||
minSdk 24
|
minSdk 21
|
||||||
targetSdk 33
|
targetSdk 33
|
||||||
versionCode 10000 + gitCommits
|
versionCode 10000 + gitCommits
|
||||||
versionName version
|
versionName version
|
||||||
@@ -93,16 +93,6 @@ android {
|
|||||||
dimension "mode"
|
dimension "mode"
|
||||||
manifestPlaceholders.put("APP_CHANNEL_VALUE", "app")
|
manifestPlaceholders.put("APP_CHANNEL_VALUE", "app")
|
||||||
}
|
}
|
||||||
google {
|
|
||||||
dimension "mode"
|
|
||||||
applicationId "io.legado.play"
|
|
||||||
manifestPlaceholders.put("APP_CHANNEL_VALUE", "google")
|
|
||||||
}
|
|
||||||
lollipop {
|
|
||||||
dimension "mode"
|
|
||||||
minSdk 21
|
|
||||||
manifestPlaceholders.put("APP_CHANNEL_VALUE", "lollipop")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
android.applicationVariants.configureEach { variant ->
|
android.applicationVariants.configureEach { variant ->
|
||||||
@@ -219,14 +209,12 @@ dependencies {
|
|||||||
implementation(project(path: ':modules:book'))
|
implementation(project(path: ':modules:book'))
|
||||||
|
|
||||||
//JS rhino
|
//JS rhino
|
||||||
appImplementation(project(path: ':modules:rhino1.7.3'))
|
implementation(project(path: ':modules:rhino1.7.3'))
|
||||||
googleImplementation(project(path: ':modules:rhino1.7.3'))
|
|
||||||
lollipopImplementation(project(path: ':modules:rhino1.7.3'))
|
|
||||||
|
|
||||||
//网络
|
//网络
|
||||||
implementation('com.squareup.okhttp3:okhttp:4.11.0')
|
implementation('com.squareup.okhttp3:okhttp:4.11.0')
|
||||||
appImplementation(fileTree(dir: 'cronetlib', include: ['*.jar', '*.aar']))
|
implementation(fileTree(dir: 'cronetlib', include: ['*.jar', '*.aar']))
|
||||||
appImplementation 'com.google.protobuf:protobuf-javalite:3.23.4'
|
implementation 'com.google.protobuf:protobuf-javalite:3.23.4'
|
||||||
|
|
||||||
//Glide
|
//Glide
|
||||||
def glideVersion = "4.15.1"
|
def glideVersion = "4.15.1"
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
package io.legado.app.lib.cronet
|
package io.legado.app.lib.cronet
|
||||||
|
|
||||||
import androidx.annotation.Keep
|
import androidx.annotation.Keep
|
||||||
import io.legado.app.constant.AppConst
|
|
||||||
import io.legado.app.constant.AppLog
|
import io.legado.app.constant.AppLog
|
||||||
import io.legado.app.help.http.CookieManager.cookieJarHeader
|
import io.legado.app.help.http.CookieManager.cookieJarHeader
|
||||||
import io.legado.app.help.http.okHttpClient
|
import io.legado.app.help.http.okHttpClient
|
||||||
@@ -22,11 +21,9 @@ import splitties.init.appCtx
|
|||||||
internal const val BUFFER_SIZE = 32 * 1024
|
internal const val BUFFER_SIZE = 32 * 1024
|
||||||
|
|
||||||
val cronetEngine: ExperimentalCronetEngine? by lazy {
|
val cronetEngine: ExperimentalCronetEngine? by lazy {
|
||||||
if (!AppConst.isPlayChannel) {
|
CronetLoader.preDownload()
|
||||||
CronetLoader.preDownload()
|
|
||||||
}
|
|
||||||
val builder = ExperimentalCronetEngine.Builder(appCtx).apply {
|
val builder = ExperimentalCronetEngine.Builder(appCtx).apply {
|
||||||
if (!AppConst.isPlayChannel && CronetLoader.install()) {
|
if (CronetLoader.install()) {
|
||||||
setLibraryLoader(CronetLoader)//设置自定义so库加载
|
setLibraryLoader(CronetLoader)//设置自定义so库加载
|
||||||
}
|
}
|
||||||
setStoragePath(appCtx.externalCacheDir?.absolutePath)//设置缓存路径
|
setStoragePath(appCtx.externalCacheDir?.absolutePath)//设置缓存路径
|
||||||
|
|||||||
@@ -7,16 +7,13 @@ import android.os.Build
|
|||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
import androidx.annotation.Keep
|
import androidx.annotation.Keep
|
||||||
import io.legado.app.BuildConfig
|
import io.legado.app.BuildConfig
|
||||||
import io.legado.app.constant.AppConst
|
|
||||||
import io.legado.app.help.coroutine.Coroutine
|
import io.legado.app.help.coroutine.Coroutine
|
||||||
import io.legado.app.help.http.Cronet
|
import io.legado.app.help.http.Cronet
|
||||||
import io.legado.app.utils.DebugLog
|
import io.legado.app.utils.DebugLog
|
||||||
import io.legado.app.utils.printOnDebug
|
import io.legado.app.utils.printOnDebug
|
||||||
|
|
||||||
import org.chromium.net.CronetEngine
|
import org.chromium.net.CronetEngine
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import splitties.init.appCtx
|
import splitties.init.appCtx
|
||||||
|
|
||||||
import java.io.*
|
import java.io.*
|
||||||
import java.math.BigInteger
|
import java.math.BigInteger
|
||||||
import java.net.HttpURLConnection
|
import java.net.HttpURLConnection
|
||||||
@@ -64,9 +61,6 @@ object CronetLoader : CronetEngine.Builder.LibraryLoader(), Cronet.LoaderInterfa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AppConst.isPlayChannel) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if (md5.length != 32 || !soFile.exists() || md5 != getFileMD5(soFile)) {
|
if (md5.length != 32 || !soFile.exists() || md5 != getFileMD5(soFile)) {
|
||||||
cacheInstall = false
|
cacheInstall = false
|
||||||
return cacheInstall
|
return cacheInstall
|
||||||
@@ -80,9 +74,6 @@ object CronetLoader : CronetEngine.Builder.LibraryLoader(), Cronet.LoaderInterfa
|
|||||||
* 预加载Cronet
|
* 预加载Cronet
|
||||||
*/
|
*/
|
||||||
override fun preDownload() {
|
override fun preDownload() {
|
||||||
if (AppConst.isPlayChannel) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
Coroutine.async {
|
Coroutine.async {
|
||||||
//md5 = getUrlMd5(md5Url)
|
//md5 = getUrlMd5(md5Url)
|
||||||
if (soFile.exists() && md5 == getFileMD5(soFile)) {
|
if (soFile.exists() && md5 == getFileMD5(soFile)) {
|
||||||
@@ -266,7 +257,7 @@ object CronetLoader : CronetEngine.Builder.LibraryLoader(), Cronet.LoaderInterfa
|
|||||||
downloadTempFile: File,
|
downloadTempFile: File,
|
||||||
destSuccessFile: File
|
destSuccessFile: File
|
||||||
) {
|
) {
|
||||||
if (download || AppConst.isPlayChannel) {
|
if (download) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
download = true
|
download = true
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?><!--suppress XmlUnusedNamespaceDeclaration -->
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
|
||||||
|
|
||||||
<uses-permission
|
|
||||||
android:name="android.permission.REQUEST_INSTALL_PACKAGES"
|
|
||||||
tools:node="remove" />
|
|
||||||
<uses-permission
|
|
||||||
android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
|
|
||||||
tools:ignore="ScopedStorage"
|
|
||||||
tools:node="remove" />
|
|
||||||
|
|
||||||
</manifest>
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"customOrder": 2,
|
|
||||||
"enableJs": true,
|
|
||||||
"enabled": true,
|
|
||||||
"singleUrl": true,
|
|
||||||
"sourceGroup": "legado",
|
|
||||||
"sourceIcon": "http://mmbiz.qpic.cn/mmbiz_png/hpfMV8hEuL2eS6vnCxvTzoOiaCAibV6exBzJWq9xMic9xDg3YXAick87tsfafic0icRwkQ5ibV0bJ84JtSuxhPuEDVquA/0?wx_fmt=png",
|
|
||||||
"sourceName": "小说拾遗",
|
|
||||||
"sourceUrl": "snssdk1128://user/profile/562564899806367"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"customOrder": 3,
|
|
||||||
"enableJs": true,
|
|
||||||
"enabled": true,
|
|
||||||
"singleUrl": true,
|
|
||||||
"sourceGroup": "legado",
|
|
||||||
"sourceIcon": "https://cdn.jsdelivr.net/gh/mgz0227/meowcloud/icon.png",
|
|
||||||
"sourceName": "Meow云",
|
|
||||||
"sourceUrl": "https://pan.miaogongzi.net"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"customOrder": 4,
|
|
||||||
"enableJs": true,
|
|
||||||
"enabled": true,
|
|
||||||
"singleUrl": true,
|
|
||||||
"sourceGroup": "legado",
|
|
||||||
"sourceIcon": "https://cdn.jsdelivr.net/gh/gedoor/legado@master/app/src/main/res/mipmap-hdpi/ic_launcher.png",
|
|
||||||
"sourceName": "烏雲净化",
|
|
||||||
"sourceUrl": "https://www.lanzoux.com/b0bw8jwoh"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
|
|
||||||
<string name="app_name">阅读Pro</string>
|
|
||||||
|
|
||||||
<string name="app_share_description">
|
|
||||||
Legado (YueDu 3.0) download link:\n https://play.google.com/store/apps/details?id=io.legado.play.release
|
|
||||||
</string>
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
|
|
||||||
<string name="app_name">閱讀Pro</string>
|
|
||||||
|
|
||||||
<string name="app_share_description">
|
|
||||||
Legado (YueDu 3.0) download link:\n https://play.google.com/store/apps/details?id=io.legado.play.release
|
|
||||||
</string>
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
|
|
||||||
<string name="app_name">閱讀Pro</string>
|
|
||||||
|
|
||||||
<string name="app_share_description">
|
|
||||||
Legado (YueDu 3.0) download link:\n https://play.google.com/store/apps/details?id=io.legado.play.release
|
|
||||||
</string>
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
|
|
||||||
|
|
||||||
<string name="this_github_url" translatable="false">无</string>
|
|
||||||
<string name="home_page_url" translatable="false">无</string>
|
|
||||||
<string name="contributors_url" translatable="false">无</string>
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
|
|
||||||
<string name="app_name">legadoPro</string>
|
|
||||||
|
|
||||||
<string name="app_share_description">
|
|
||||||
Legado (YueDu 3.0) download link:\n https://play.google.com/store/apps/details?id=io.legado.play.release
|
|
||||||
</string>
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
@@ -5,7 +5,6 @@ import android.content.pm.PackageManager
|
|||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
import androidx.annotation.Keep
|
import androidx.annotation.Keep
|
||||||
import io.legado.app.BuildConfig
|
import io.legado.app.BuildConfig
|
||||||
import io.legado.app.utils.channel
|
|
||||||
import splitties.init.appCtx
|
import splitties.init.appCtx
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
|
|
||||||
@@ -14,8 +13,6 @@ object AppConst {
|
|||||||
|
|
||||||
const val APP_TAG = "Legado"
|
const val APP_TAG = "Legado"
|
||||||
|
|
||||||
val isPlayChannel = appCtx.channel == "google"
|
|
||||||
|
|
||||||
const val channelIdDownload = "channel_download"
|
const val channelIdDownload = "channel_download"
|
||||||
const val channelIdReadAloud = "channel_read_aloud"
|
const val channelIdReadAloud = "channel_read_aloud"
|
||||||
const val channelIdWeb = "channel_web"
|
const val channelIdWeb = "channel_web"
|
||||||
|
|||||||
@@ -5,7 +5,13 @@ import io.legado.app.help.CacheManager
|
|||||||
import io.legado.app.help.config.AppConfig
|
import io.legado.app.help.config.AppConfig
|
||||||
import io.legado.app.help.http.CookieManager.cookieJarHeader
|
import io.legado.app.help.http.CookieManager.cookieJarHeader
|
||||||
import io.legado.app.utils.NetworkUtils
|
import io.legado.app.utils.NetworkUtils
|
||||||
import okhttp3.*
|
import okhttp3.ConnectionSpec
|
||||||
|
import okhttp3.Cookie
|
||||||
|
import okhttp3.CookieJar
|
||||||
|
import okhttp3.Credentials
|
||||||
|
import okhttp3.HttpUrl
|
||||||
|
import okhttp3.Interceptor
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
import java.net.InetSocketAddress
|
import java.net.InetSocketAddress
|
||||||
import java.net.Proxy
|
import java.net.Proxy
|
||||||
import java.util.concurrent.ConcurrentHashMap
|
import java.util.concurrent.ConcurrentHashMap
|
||||||
@@ -89,7 +95,7 @@ val okHttpClient: OkHttpClient by lazy {
|
|||||||
}
|
}
|
||||||
networkResponse
|
networkResponse
|
||||||
}
|
}
|
||||||
if (!AppConst.isPlayChannel && AppConfig.isCronet) {
|
if (AppConfig.isCronet) {
|
||||||
if (Cronet.loader?.install() == true) {
|
if (Cronet.loader?.install() == true) {
|
||||||
Cronet.interceptor?.let {
|
Cronet.interceptor?.let {
|
||||||
builder.addInterceptor(it)
|
builder.addInterceptor(it)
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package io.legado.app.help.source
|
|||||||
|
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import io.legado.app.constant.AppConst
|
|
||||||
import io.legado.app.data.appDb
|
import io.legado.app.data.appDb
|
||||||
import io.legado.app.data.entities.BaseSource
|
import io.legado.app.data.entities.BaseSource
|
||||||
import io.legado.app.data.entities.BookSource
|
import io.legado.app.data.entities.BookSource
|
||||||
@@ -63,7 +62,6 @@ object SourceHelp {
|
|||||||
|
|
||||||
private fun is18Plus(url: String?): Boolean {
|
private fun is18Plus(url: String?): Boolean {
|
||||||
url ?: return false
|
url ?: return false
|
||||||
if (AppConst.isPlayChannel) return false
|
|
||||||
val baseUrl = NetworkUtils.getBaseUrl(url) ?: return false
|
val baseUrl = NetworkUtils.getBaseUrl(url) ?: return false
|
||||||
kotlin.runCatching {
|
kotlin.runCatching {
|
||||||
val host = baseUrl.split("//", ".").let {
|
val host = baseUrl.split("//", ".").let {
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import android.view.Menu
|
|||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import io.legado.app.R
|
import io.legado.app.R
|
||||||
import io.legado.app.base.BaseActivity
|
import io.legado.app.base.BaseActivity
|
||||||
import io.legado.app.constant.AppConst
|
|
||||||
import io.legado.app.databinding.ActivityAboutBinding
|
import io.legado.app.databinding.ActivityAboutBinding
|
||||||
import io.legado.app.lib.theme.accentColor
|
import io.legado.app.lib.theme.accentColor
|
||||||
import io.legado.app.lib.theme.filletBackground
|
import io.legado.app.lib.theme.filletBackground
|
||||||
@@ -46,7 +45,6 @@ class AboutActivity : BaseActivity<ActivityAboutBinding>() {
|
|||||||
|
|
||||||
override fun onCompatCreateOptionsMenu(menu: Menu): Boolean {
|
override fun onCompatCreateOptionsMenu(menu: Menu): Boolean {
|
||||||
menuInflater.inflate(R.menu.about, menu)
|
menuInflater.inflate(R.menu.about, menu)
|
||||||
menu.findItem(R.id.menu_share_it)?.isVisible = !AppConst.isPlayChannel
|
|
||||||
return super.onCompatCreateOptionsMenu(menu)
|
return super.onCompatCreateOptionsMenu(menu)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,8 @@ import androidx.lifecycle.lifecycleScope
|
|||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
import io.legado.app.R
|
import io.legado.app.R
|
||||||
import io.legado.app.constant.AppConst
|
|
||||||
import io.legado.app.constant.AppConst.appInfo
|
import io.legado.app.constant.AppConst.appInfo
|
||||||
import io.legado.app.help.AppUpdate
|
import io.legado.app.help.AppUpdate
|
||||||
import io.legado.app.lib.prefs.PreferenceCategory
|
|
||||||
import io.legado.app.ui.widget.dialog.TextDialog
|
import io.legado.app.ui.widget.dialog.TextDialog
|
||||||
import io.legado.app.ui.widget.dialog.WaitDialog
|
import io.legado.app.ui.widget.dialog.WaitDialog
|
||||||
import io.legado.app.utils.*
|
import io.legado.app.utils.*
|
||||||
@@ -30,12 +28,6 @@ class AboutFragment : PreferenceFragmentCompat() {
|
|||||||
addPreferencesFromResource(R.xml.about)
|
addPreferencesFromResource(R.xml.about)
|
||||||
findPreference<Preference>("update_log")?.summary =
|
findPreference<Preference>("update_log")?.summary =
|
||||||
"${getString(R.string.version)} ${appInfo.versionName}"
|
"${getString(R.string.version)} ${appInfo.versionName}"
|
||||||
if (AppConst.isPlayChannel) {
|
|
||||||
findPreference<PreferenceCategory>("lx")?.run {
|
|
||||||
removePreferenceRecursively("home_page")
|
|
||||||
removePreferenceRecursively("git")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
@@ -45,15 +37,10 @@ class AboutFragment : PreferenceFragmentCompat() {
|
|||||||
|
|
||||||
override fun onPreferenceTreeClick(preference: Preference): Boolean {
|
override fun onPreferenceTreeClick(preference: Preference): Boolean {
|
||||||
when (preference.key) {
|
when (preference.key) {
|
||||||
"contributors" -> if (!AppConst.isPlayChannel) {
|
"contributors" -> openUrl(R.string.contributors_url)
|
||||||
openUrl(R.string.contributors_url)
|
|
||||||
}
|
|
||||||
"update_log" -> showMdFile(getString(R.string.update_log), "updateLog.md")
|
"update_log" -> showMdFile(getString(R.string.update_log), "updateLog.md")
|
||||||
"check_update" -> checkUpdate()
|
"check_update" -> checkUpdate()
|
||||||
"mail" -> requireContext().sendMail(getString(R.string.email))
|
"mail" -> requireContext().sendMail(getString(R.string.email))
|
||||||
"sourceRuleSummary" -> openUrl(R.string.source_rule_url)
|
|
||||||
"git" -> openUrl(R.string.this_github_url)
|
|
||||||
"home_page" -> openUrl(R.string.home_page_url)
|
|
||||||
"license" -> showMdFile(getString(R.string.license), "LICENSE.md")
|
"license" -> showMdFile(getString(R.string.license), "LICENSE.md")
|
||||||
"disclaimer" -> showMdFile(getString(R.string.disclaimer), "disclaimer.md")
|
"disclaimer" -> showMdFile(getString(R.string.disclaimer), "disclaimer.md")
|
||||||
"privacyPolicy" -> showMdFile(getString(R.string.privacy_policy), "privacyPolicy.md")
|
"privacyPolicy" -> showMdFile(getString(R.string.privacy_policy), "privacyPolicy.md")
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import android.view.View
|
|||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import io.legado.app.R
|
import io.legado.app.R
|
||||||
import io.legado.app.base.BaseDialogFragment
|
import io.legado.app.base.BaseDialogFragment
|
||||||
import io.legado.app.constant.AppConst
|
|
||||||
import io.legado.app.databinding.DialogUpdateBinding
|
import io.legado.app.databinding.DialogUpdateBinding
|
||||||
import io.legado.app.help.AppUpdate
|
import io.legado.app.help.AppUpdate
|
||||||
import io.legado.app.lib.theme.primaryColor
|
import io.legado.app.lib.theme.primaryColor
|
||||||
@@ -53,21 +52,19 @@ class UpdateDialog() : BaseDialogFragment(R.layout.dialog_update) {
|
|||||||
.build()
|
.build()
|
||||||
.setMarkdown(binding.textView, updateBody)
|
.setMarkdown(binding.textView, updateBody)
|
||||||
}
|
}
|
||||||
if (!AppConst.isPlayChannel) {
|
binding.toolBar.inflateMenu(R.menu.app_update)
|
||||||
binding.toolBar.inflateMenu(R.menu.app_update)
|
binding.toolBar.setOnMenuItemClickListener {
|
||||||
binding.toolBar.setOnMenuItemClickListener {
|
when (it.itemId) {
|
||||||
when (it.itemId) {
|
R.id.menu_download -> {
|
||||||
R.id.menu_download -> {
|
val url = arguments?.getString("url")
|
||||||
val url = arguments?.getString("url")
|
val name = arguments?.getString("name")
|
||||||
val name = arguments?.getString("name")
|
if (url != null && name != null) {
|
||||||
if (url != null && name != null) {
|
Download.start(requireContext(), url, name)
|
||||||
Download.start(requireContext(), url, name)
|
toastOnUi(R.string.download_start)
|
||||||
toastOnUi(R.string.download_start)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return@setOnMenuItemClickListener true
|
|
||||||
}
|
}
|
||||||
|
return@setOnMenuItemClickListener true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import androidx.documentfile.provider.DocumentFile
|
|||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import io.legado.app.R
|
import io.legado.app.R
|
||||||
import io.legado.app.base.VMBaseActivity
|
import io.legado.app.base.VMBaseActivity
|
||||||
import io.legado.app.constant.AppConst
|
|
||||||
import io.legado.app.constant.AppLog
|
import io.legado.app.constant.AppLog
|
||||||
import io.legado.app.databinding.ActivityTranslucenceBinding
|
import io.legado.app.databinding.ActivityTranslucenceBinding
|
||||||
import io.legado.app.help.config.AppConfig
|
import io.legado.app.help.config.AppConfig
|
||||||
@@ -120,7 +119,7 @@ class FileAssociationActivity :
|
|||||||
intent.data?.let { data ->
|
intent.data?.let { data ->
|
||||||
if (data.isContentScheme()) {
|
if (data.isContentScheme()) {
|
||||||
viewModel.dispatchIndent(data)
|
viewModel.dispatchIndent(data)
|
||||||
} else if (!AppConst.isPlayChannel || Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q) {
|
} else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q) {
|
||||||
PermissionsCompat.Builder()
|
PermissionsCompat.Builder()
|
||||||
.addPermissions(*Permissions.Group.STORAGE)
|
.addPermissions(*Permissions.Group.STORAGE)
|
||||||
.rationale(R.string.tip_perm_request_storage)
|
.rationale(R.string.tip_perm_request_storage)
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import androidx.documentfile.provider.DocumentFile
|
|||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import io.legado.app.R
|
import io.legado.app.R
|
||||||
import io.legado.app.constant.AppConst
|
|
||||||
import io.legado.app.constant.PreferKey
|
import io.legado.app.constant.PreferKey
|
||||||
import io.legado.app.databinding.DialogEditTextBinding
|
import io.legado.app.databinding.DialogEditTextBinding
|
||||||
import io.legado.app.help.config.AppConfig
|
import io.legado.app.help.config.AppConfig
|
||||||
@@ -176,10 +175,6 @@ class ImportBookActivity : BaseImportBookActivity<ImportBookViewModel>(),
|
|||||||
selectFolder.launch()
|
selectFolder.launch()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AppConst.isPlayChannel -> {
|
|
||||||
binding.tvEmptyMsg.visible()
|
|
||||||
selectFolder.launch()
|
|
||||||
}
|
|
||||||
else -> initRootPath(rootUri.path!!)
|
else -> initRootPath(rootUri.path!!)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import androidx.fragment.app.activityViewModels
|
|||||||
import androidx.preference.ListPreference
|
import androidx.preference.ListPreference
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import io.legado.app.R
|
import io.legado.app.R
|
||||||
import io.legado.app.constant.AppConst
|
|
||||||
import io.legado.app.constant.EventBus
|
import io.legado.app.constant.EventBus
|
||||||
import io.legado.app.constant.PreferKey
|
import io.legado.app.constant.PreferKey
|
||||||
import io.legado.app.databinding.DialogEditTextBinding
|
import io.legado.app.databinding.DialogEditTextBinding
|
||||||
@@ -50,9 +49,6 @@ class OtherConfigFragment : PreferenceFragment(),
|
|||||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||||
putPrefBoolean(PreferKey.processText, isProcessTextEnabled())
|
putPrefBoolean(PreferKey.processText, isProcessTextEnabled())
|
||||||
addPreferencesFromResource(R.xml.pref_config_other)
|
addPreferencesFromResource(R.xml.pref_config_other)
|
||||||
if (AppConst.isPlayChannel) {
|
|
||||||
preferenceScreen.removePreferenceRecursively("Cronet")
|
|
||||||
}
|
|
||||||
upPreferenceSummary(PreferKey.userAgent, AppConfig.userAgent)
|
upPreferenceSummary(PreferKey.userAgent, AppConfig.userAgent)
|
||||||
upPreferenceSummary(PreferKey.preDownloadNum, AppConfig.preDownloadNum.toString())
|
upPreferenceSummary(PreferKey.preDownloadNum, AppConfig.preDownloadNum.toString())
|
||||||
upPreferenceSummary(PreferKey.threadCount, AppConfig.threadCount.toString())
|
upPreferenceSummary(PreferKey.threadCount, AppConfig.threadCount.toString())
|
||||||
|
|||||||
@@ -59,9 +59,6 @@ class ThemeConfigFragment : PreferenceFragment(),
|
|||||||
if (Build.VERSION.SDK_INT < 26) {
|
if (Build.VERSION.SDK_INT < 26) {
|
||||||
preferenceScreen.removePreferenceRecursively(PreferKey.launcherIcon)
|
preferenceScreen.removePreferenceRecursively(PreferKey.launcherIcon)
|
||||||
}
|
}
|
||||||
if (!AppConst.isPlayChannel) {
|
|
||||||
preferenceScreen.removePreferenceRecursively("welcomeStyle")
|
|
||||||
}
|
|
||||||
upPreferenceSummary(PreferKey.bgImage, getPrefString(PreferKey.bgImage))
|
upPreferenceSummary(PreferKey.bgImage, getPrefString(PreferKey.bgImage))
|
||||||
upPreferenceSummary(PreferKey.bgImageN, getPrefString(PreferKey.bgImageN))
|
upPreferenceSummary(PreferKey.bgImageN, getPrefString(PreferKey.bgImageN))
|
||||||
upPreferenceSummary(PreferKey.barElevation, AppConfig.elevation.toString())
|
upPreferenceSummary(PreferKey.barElevation, AppConfig.elevation.toString())
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import androidx.activity.viewModels
|
|||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import io.legado.app.R
|
import io.legado.app.R
|
||||||
import io.legado.app.base.VMBaseActivity
|
import io.legado.app.base.VMBaseActivity
|
||||||
import io.legado.app.constant.AppConst
|
|
||||||
import io.legado.app.constant.AppLog
|
import io.legado.app.constant.AppLog
|
||||||
import io.legado.app.databinding.ActivityTranslucenceBinding
|
import io.legado.app.databinding.ActivityTranslucenceBinding
|
||||||
import io.legado.app.help.IntentData
|
import io.legado.app.help.IntentData
|
||||||
@@ -167,7 +166,7 @@ class HandleFileActivity :
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getDirActions(onlySys: Boolean = false): ArrayList<SelectItem<Int>> {
|
private fun getDirActions(onlySys: Boolean = false): ArrayList<SelectItem<Int>> {
|
||||||
return if (onlySys || (AppConst.isPlayChannel && Permissions.isManageExternalStorage())) {
|
return if (onlySys) {
|
||||||
arrayListOf(SelectItem(getString(R.string.sys_folder_picker), HandleFileContract.DIR))
|
arrayListOf(SelectItem(getString(R.string.sys_folder_picker), HandleFileContract.DIR))
|
||||||
} else {
|
} else {
|
||||||
arrayListOf(
|
arrayListOf(
|
||||||
@@ -178,14 +177,10 @@ class HandleFileActivity :
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getFileActions(): ArrayList<SelectItem<Int>> {
|
private fun getFileActions(): ArrayList<SelectItem<Int>> {
|
||||||
return if (AppConst.isPlayChannel && Permissions.isManageExternalStorage()) {
|
return arrayListOf(
|
||||||
arrayListOf(SelectItem(getString(R.string.sys_file_picker), HandleFileContract.FILE))
|
SelectItem(getString(R.string.sys_file_picker), HandleFileContract.FILE),
|
||||||
} else {
|
SelectItem(getString(R.string.app_file_picker), 11)
|
||||||
arrayListOf(
|
)
|
||||||
SelectItem(getString(R.string.sys_file_picker), HandleFileContract.FILE),
|
|
||||||
SelectItem(getString(R.string.app_file_picker), 11)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkPermissions(success: (() -> Unit)? = null) {
|
private fun checkPermissions(success: (() -> Unit)? = null) {
|
||||||
|
|||||||
@@ -4,10 +4,7 @@
|
|||||||
<string name="legado_gzh" translatable="false">开源阅读</string>
|
<string name="legado_gzh" translatable="false">开源阅读</string>
|
||||||
<string name="email" translatable="false">gekunfei@live.com</string>
|
<string name="email" translatable="false">gekunfei@live.com</string>
|
||||||
|
|
||||||
<string name="source_rule_url" translatable="false">https://alanskycn.gitee.io/teachme/</string>
|
|
||||||
<string name="this_github_url" translatable="false">https://github.com/gedoor/legado</string>
|
|
||||||
<string name="contributors_url" translatable="false">https://github.com/gedoor/legado/graphs/contributors</string>
|
<string name="contributors_url" translatable="false">https://github.com/gedoor/legado/graphs/contributors</string>
|
||||||
<string name="home_page_url" translatable="false">https://gedoor.github.io</string>
|
|
||||||
<string name="tg_url" translatable="false">https://t.me/legado_channels</string>
|
<string name="tg_url" translatable="false">https://t.me/legado_channels</string>
|
||||||
<string name="discord_url" translatable="false">https://discord.gg/qDE52P5xGW</string>
|
<string name="discord_url" translatable="false">https://discord.gg/qDE52P5xGW</string>
|
||||||
|
|
||||||
|
|||||||
@@ -41,18 +41,6 @@
|
|||||||
android:summary="@string/qq_channel_summary"
|
android:summary="@string/qq_channel_summary"
|
||||||
app:iconSpaceReserved="false" />
|
app:iconSpaceReserved="false" />
|
||||||
|
|
||||||
<io.legado.app.lib.prefs.Preference
|
|
||||||
android:key="mail"
|
|
||||||
android:summary="@string/email"
|
|
||||||
android:title="@string/send_mail"
|
|
||||||
app:iconSpaceReserved="false" />
|
|
||||||
|
|
||||||
<io.legado.app.lib.prefs.Preference
|
|
||||||
android:key="git"
|
|
||||||
android:summary="@string/this_github_url"
|
|
||||||
android:title="@string/git_hub"
|
|
||||||
app:iconSpaceReserved="false" />
|
|
||||||
|
|
||||||
<io.legado.app.lib.prefs.Preference
|
<io.legado.app.lib.prefs.Preference
|
||||||
android:key="discord"
|
android:key="discord"
|
||||||
android:summary="@string/discord_url"
|
android:summary="@string/discord_url"
|
||||||
@@ -65,20 +53,6 @@
|
|||||||
android:title="TG"
|
android:title="TG"
|
||||||
app:iconSpaceReserved="false" />
|
app:iconSpaceReserved="false" />
|
||||||
|
|
||||||
<io.legado.app.lib.prefs.Preference
|
|
||||||
android:key="sourceRuleSummary"
|
|
||||||
android:summary="@string/source_rule_url"
|
|
||||||
android:title="@string/source_rule_s"
|
|
||||||
app:iconSpaceReserved="false" />
|
|
||||||
|
|
||||||
<io.legado.app.lib.prefs.Preference
|
|
||||||
android:key="home_page"
|
|
||||||
android:summary="@string/home_page_url"
|
|
||||||
android:title="@string/home_page"
|
|
||||||
app:allowDividerAbove="false"
|
|
||||||
app:allowDividerBelow="false"
|
|
||||||
app:iconSpaceReserved="false" />
|
|
||||||
|
|
||||||
</io.legado.app.lib.prefs.PreferenceCategory>
|
</io.legado.app.lib.prefs.PreferenceCategory>
|
||||||
|
|
||||||
<io.legado.app.lib.prefs.PreferenceCategory
|
<io.legado.app.lib.prefs.PreferenceCategory
|
||||||
|
|||||||
Reference in New Issue
Block a user