pull/433/head
gedoor 4 years ago
parent 4f72c8e99a
commit db73682141
  1. 1
      app/src/main/java/io/legado/app/base/BaseFragment.kt
  2. 4
      app/src/main/java/io/legado/app/base/BaseService.kt
  3. 1
      app/src/main/java/io/legado/app/base/BaseViewModel.kt
  4. 1
      app/src/main/java/io/legado/app/base/adapter/CommonRecyclerAdapter.kt
  5. 1
      app/src/main/java/io/legado/app/base/adapter/InfiniteScrollListener.kt
  6. 1
      app/src/main/java/io/legado/app/base/adapter/ItemAnimation.kt
  7. 1
      app/src/main/java/io/legado/app/help/ActivityHelp.kt
  8. 2
      app/src/main/java/io/legado/app/help/BlurTransformation.kt
  9. 27
      app/src/main/java/io/legado/app/help/BookHelp.kt
  10. 3
      app/src/main/java/io/legado/app/help/EventMessage.kt
  11. 1
      app/src/main/java/io/legado/app/help/IntentHelp.kt
  12. 1
      app/src/main/java/io/legado/app/help/LayoutManager.kt
  13. 1
      app/src/main/java/io/legado/app/help/coroutine/CompositeCoroutine.kt
  14. 1
      app/src/main/java/io/legado/app/help/coroutine/Coroutine.kt
  15. 2
      app/src/main/java/io/legado/app/help/http/CookieStore.kt
  16. 6
      app/src/main/java/io/legado/app/help/http/HttpHelper.kt
  17. 1
      app/src/main/java/io/legado/app/help/http/SSLHelper.kt
  18. 1
      app/src/main/java/io/legado/app/help/permission/Permissions.kt
  19. 9
      app/src/main/java/io/legado/app/help/permission/PermissionsCompat.kt
  20. 2
      app/src/main/java/io/legado/app/help/storage/ImportOldData.kt
  21. 1
      app/src/main/java/io/legado/app/help/storage/OldRule.kt
  22. 1
      app/src/main/java/io/legado/app/lib/theme/ATH.kt
  23. 1
      app/src/main/java/io/legado/app/lib/theme/DrawableUtils.kt
  24. 2
      app/src/main/java/io/legado/app/lib/theme/MaterialValueHelper.kt
  25. 1
      app/src/main/java/io/legado/app/lib/theme/NavigationViewUtils.kt
  26. 6
      app/src/main/java/io/legado/app/lib/theme/Selector.kt
  27. 1
      app/src/main/java/io/legado/app/lib/theme/ThemeStore.kt
  28. 22
      app/src/main/java/io/legado/app/lib/theme/TintHelper.kt
  29. 1
      app/src/main/java/io/legado/app/lib/theme/ViewUtils.kt
  30. 5
      app/src/main/java/io/legado/app/lib/webdav/WebDav.kt
  31. 1
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSonPath.kt
  32. 1
      app/src/main/java/io/legado/app/model/rss/RssParserDefault.kt
  33. 1
      app/src/main/java/io/legado/app/ui/book/read/page/entities/TextLine.kt
  34. 8
      app/src/main/java/io/legado/app/ui/filechooser/adapter/FileAdapter.kt
  35. 2
      app/src/main/java/io/legado/app/ui/filechooser/adapter/PathAdapter.kt
  36. 10
      app/src/main/java/io/legado/app/ui/filechooser/utils/FilePickerIcon.java

@ -15,6 +15,7 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
import kotlin.coroutines.CoroutineContext import kotlin.coroutines.CoroutineContext
@Suppress("MemberVisibilityCanBePrivate")
abstract class BaseFragment(layoutID: Int) : Fragment(layoutID), abstract class BaseFragment(layoutID: Int) : Fragment(layoutID),
CoroutineScope { CoroutineScope {
lateinit var job: Job lateinit var job: Job

@ -18,7 +18,9 @@ abstract class BaseService : Service(), CoroutineScope by MainScope() {
block: suspend CoroutineScope.() -> T block: suspend CoroutineScope.() -> T
) = Coroutine.async(scope, context) { block() } ) = Coroutine.async(scope, context) { block() }
override fun onBind(intent: Intent?) = null override fun onBind(intent: Intent?): IBinder? {
return null
}
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()

@ -11,6 +11,7 @@ import org.jetbrains.anko.AnkoLogger
import org.jetbrains.anko.toast import org.jetbrains.anko.toast
import kotlin.coroutines.CoroutineContext import kotlin.coroutines.CoroutineContext
@Suppress("unused")
open class BaseViewModel(application: Application) : AndroidViewModel(application), open class BaseViewModel(application: Application) : AndroidViewModel(application),
CoroutineScope by MainScope(), CoroutineScope by MainScope(),
AnkoLogger { AnkoLogger {

@ -15,6 +15,7 @@ import java.util.*
* *
* 通用的adapter 可添加headerfooter以及不同类型item * 通用的adapter 可添加headerfooter以及不同类型item
*/ */
@Suppress("unused", "MemberVisibilityCanBePrivate")
abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context) : abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context) :
RecyclerView.Adapter<ItemViewHolder>() { RecyclerView.Adapter<ItemViewHolder>() {

@ -8,6 +8,7 @@ import androidx.recyclerview.widget.RecyclerView
* *
* 上拉加载更多 * 上拉加载更多
*/ */
@Suppress("unused")
abstract class InfiniteScrollListener() : RecyclerView.OnScrollListener() { abstract class InfiniteScrollListener() : RecyclerView.OnScrollListener() {
private val loadMoreRunnable = Runnable { onLoadMore() } private val loadMoreRunnable = Runnable { onLoadMore() }

@ -7,6 +7,7 @@ import io.legado.app.base.adapter.animations.*
/** /**
* Created by Invincible on 2017/12/15. * Created by Invincible on 2017/12/15.
*/ */
@Suppress("unused")
class ItemAnimation private constructor() { class ItemAnimation private constructor() {
var itemAnimEnabled = false var itemAnimEnabled = false

@ -10,6 +10,7 @@ import java.util.*
/** /**
* Activity管理器,管理项目中Activity的状态 * Activity管理器,管理项目中Activity的状态
*/ */
@Suppress("unused")
object ActivityHelp : Application.ActivityLifecycleCallbacks { object ActivityHelp : Application.ActivityLifecycleCallbacks {
private val activities: MutableList<WeakReference<Activity>> = arrayListOf() private val activities: MutableList<WeakReference<Activity>> = arrayListOf()

@ -28,7 +28,7 @@ class BlurTransformation(context: Context, private val radius: Int) : CenterCrop
//图片缩小1/2 //图片缩小1/2
val width = (min(outWidth, transform.width) / 2f).roundToInt() val width = (min(outWidth, transform.width) / 2f).roundToInt()
val height = (min(outHeight, transform.height) / 2f).roundToInt() val height = (min(outHeight, transform.height) / 2f).roundToInt()
val blurredBitmap = Bitmap.createScaledBitmap(transform, width, height, false); val blurredBitmap = Bitmap.createScaledBitmap(transform, width, height, false)
// Allocate memory for Renderscript to work with // Allocate memory for Renderscript to work with
//分配用于渲染脚本的内存 //分配用于渲染脚本的内存
val input = Allocation.createFromBitmap( val input = Allocation.createFromBitmap(

@ -267,8 +267,9 @@ object BookHelp {
} }
} }
private val chapterNamePattern = private val chapterNamePattern by lazy {
Pattern.compile("^(.*?第([\\d零〇一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟0-9\\s]+)[章节篇回集])[、,。 ::.\\s]*") Pattern.compile("^(.*?第([\\d零〇一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟0-9\\s]+)[章节篇回集])[、,。 ::.\\s]*")
}
private fun getChapterNum(chapterName: String?): Int { private fun getChapterNum(chapterName: String?): Int {
if (chapterName != null) { if (chapterName != null) {
@ -280,15 +281,25 @@ object BookHelp {
return -1 return -1
} }
private fun getPureChapterName(chapterName: String?): String { @Suppress("SpellCheckingInspection")
private val regexOther by lazy {
// 所有非字母数字中日韩文字 CJK区+扩展A-F区 // 所有非字母数字中日韩文字 CJK区+扩展A-F区
return@lazy "[^\\w\\u4E00-\\u9FEF〇\\u3400-\\u4DBF\\u20000-\\u2A6DF\\u2A700-\\u2EBEF]".toRegex()
}
private val regexA by lazy {
return@lazy "\\s".toRegex()
}
private val regexB by lazy {
return@lazy "^第.*?章|[(\\[][^()\\[\\]]{2,}[)\\]]$".toRegex()
}
private fun getPureChapterName(chapterName: String?): String {
return if (chapterName == null) "" else StringUtils.fullToHalf(chapterName) return if (chapterName == null) "" else StringUtils.fullToHalf(chapterName)
.replace("\\s".toRegex(), "") .replace(regexA, "")
.replace("^第.*?章|[(\\[][^()\\[\\]]{2,}[)\\]]$".toRegex(), "") .replace(regexB, "")
.replace( .replace(regexOther, "")
"[^\\w\\u4E00-\\u9FEF〇\\u3400-\\u4DBF\\u20000-\\u2A6DF\\u2A700-\\u2EBEF]".toRegex(),
""
)
} }
private var bookName: String? = null private var bookName: String? = null

@ -2,8 +2,7 @@ package io.legado.app.help
import android.text.TextUtils import android.text.TextUtils
import java.util.Arrays @Suppress("unused")
class EventMessage { class EventMessage {
var what: Int?=null var what: Int?=null

@ -7,6 +7,7 @@ import android.os.Bundle
import io.legado.app.R import io.legado.app.R
import org.jetbrains.anko.toast import org.jetbrains.anko.toast
@Suppress("unused")
object IntentHelp { object IntentHelp {

@ -6,6 +6,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.StaggeredGridLayoutManager import androidx.recyclerview.widget.StaggeredGridLayoutManager
@Suppress("unused")
object LayoutManager { object LayoutManager {
interface LayoutManagerFactory { interface LayoutManagerFactory {

@ -1,5 +1,6 @@
package io.legado.app.help.coroutine package io.legado.app.help.coroutine
@Suppress("unused")
class CompositeCoroutine : CoroutineContainer { class CompositeCoroutine : CoroutineContainer {
private var resources: HashSet<Coroutine<*>>? = null private var resources: HashSet<Coroutine<*>>? = null

@ -5,6 +5,7 @@ import kotlinx.coroutines.*
import kotlin.coroutines.CoroutineContext import kotlin.coroutines.CoroutineContext
@Suppress("unused")
class Coroutine<T>( class Coroutine<T>(
val scope: CoroutineScope, val scope: CoroutineScope,
context: CoroutineContext = Dispatchers.IO, context: CoroutineContext = Dispatchers.IO,

@ -1,3 +1,5 @@
@file:Suppress("unused")
package io.legado.app.help.http package io.legado.app.help.http
import android.text.TextUtils import android.text.TextUtils

@ -112,7 +112,7 @@ object HttpHelper {
proxy: String? = null proxy: String? = null
): Retrofit { ): Retrofit {
val r = Regex("(http|socks4|socks5)://(.*):(\\d{2,5})(@.*@.*)?") val r = Regex("(http|socks4|socks5)://(.*):(\\d{2,5})(@.*@.*)?")
val ms = proxy?.let { r.findAll(it) }; val ms = proxy?.let { r.findAll(it) }
val group = ms?.first() val group = ms?.first()
var type = "direct" //直接连接 var type = "direct" //直接连接
var host = "127.0.0.1" //代理服务器hostname var host = "127.0.0.1" //代理服务器hostname
@ -135,9 +135,9 @@ object HttpHelper {
val builder = client.newBuilder() val builder = client.newBuilder()
if (type != "direct" && host != "") { if (type != "direct" && host != "") {
if (type == "http") { if (type == "http") {
builder.proxy(Proxy(Proxy.Type.HTTP, InetSocketAddress(host, port))); builder.proxy(Proxy(Proxy.Type.HTTP, InetSocketAddress(host, port)))
} else { } else {
builder.proxy(Proxy(Proxy.Type.SOCKS, InetSocketAddress(host, port))); builder.proxy(Proxy(Proxy.Type.SOCKS, InetSocketAddress(host, port)))
} }
if (username != "" && password != "") { if (username != "" && password != "") {
builder.proxyAuthenticator { _, response -> //设置代理服务器账号密码 builder.proxyAuthenticator { _, response -> //设置代理服务器账号密码

@ -12,6 +12,7 @@ import java.security.cert.CertificateFactory
import java.security.cert.X509Certificate import java.security.cert.X509Certificate
import javax.net.ssl.* import javax.net.ssl.*
@Suppress("unused")
object SSLHelper { object SSLHelper {
/** /**

@ -1,5 +1,6 @@
package io.legado.app.help.permission package io.legado.app.help.permission
@Suppress("unused")
object Permissions { object Permissions {
const val READ_CALENDAR = "android.permission.READ_CALENDAR" const val READ_CALENDAR = "android.permission.READ_CALENDAR"

@ -5,6 +5,7 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import java.util.* import java.util.*
@Suppress("unused")
class PermissionsCompat private constructor() { class PermissionsCompat private constructor() {
private var request: Request? = null private var request: Request? = null
@ -16,11 +17,11 @@ class PermissionsCompat private constructor() {
companion object { companion object {
// 检查权限, 如果已经拥有返回 true // 检查权限, 如果已经拥有返回 true
fun check(activity: AppCompatActivity, vararg permissions: String): Boolean { fun check(activity: AppCompatActivity, vararg permissions: String): Boolean {
var request = Request(activity) val request = Request(activity)
var pers = ArrayList<String>() val pers = ArrayList<String>()
pers.addAll(listOf(*permissions)) pers.addAll(listOf(*permissions))
var data = request.getDeniedPermissions(pers.toTypedArray()) val data = request.getDeniedPermissions(pers.toTypedArray())
return data == null; return data == null
} }
} }

@ -100,7 +100,7 @@ object ImportOldData {
return bookSources.size return bookSources.size
} }
fun importOldReplaceRule(json: String): Int { private fun importOldReplaceRule(json: String): Int {
val rules = OldReplace.jsonToReplaceRules(json) val rules = OldReplace.jsonToReplaceRules(json)
App.db.replaceRuleDao().insert(*rules.toTypedArray()) App.db.replaceRuleDao().insert(*rules.toTypedArray())
return rules.size return rules.size

@ -9,6 +9,7 @@ import io.legado.app.help.storage.Restore.jsonPath
import io.legado.app.utils.* import io.legado.app.utils.*
import java.util.regex.Pattern import java.util.regex.Pattern
@Suppress("RegExpRedundantEscape")
object OldRule { object OldRule {
private val headerPattern = Pattern.compile("@Header:\\{.+?\\}", Pattern.CASE_INSENSITIVE) private val headerPattern = Pattern.compile("@Header:\\{.+?\\}", Pattern.CASE_INSENSITIVE)
private val jsPattern = Pattern.compile("\\{\\{.+?\\}\\}", Pattern.CASE_INSENSITIVE) private val jsPattern = Pattern.compile("\\{\\{.+?\\}\\}", Pattern.CASE_INSENSITIVE)

@ -30,6 +30,7 @@ import org.jetbrains.anko.backgroundColor
/** /**
* @author Karim Abou Zeid (kabouzeid) * @author Karim Abou Zeid (kabouzeid)
*/ */
@Suppress("unused", "MemberVisibilityCanBePrivate")
object ATH { object ATH {
@SuppressLint("CommitPrefEdits") @SuppressLint("CommitPrefEdits")

@ -11,6 +11,7 @@ import androidx.core.graphics.drawable.DrawableCompat
/** /**
* @author Karim Abou Zeid (kabouzeid) * @author Karim Abou Zeid (kabouzeid)
*/ */
@Suppress("unused")
object DrawableUtils { object DrawableUtils {
fun createTransitionDrawable(@ColorInt startColor: Int, @ColorInt endColor: Int): TransitionDrawable { fun createTransitionDrawable(@ColorInt startColor: Int, @ColorInt endColor: Int): TransitionDrawable {

@ -1,3 +1,5 @@
@file:Suppress("unused")
package io.legado.app.lib.theme package io.legado.app.lib.theme
import android.annotation.SuppressLint import android.annotation.SuppressLint

@ -8,6 +8,7 @@ import com.google.android.material.navigation.NavigationView
/** /**
* @author Karim Abou Zeid (kabouzeid) * @author Karim Abou Zeid (kabouzeid)
*/ */
@Suppress("unused")
object NavigationViewUtils { object NavigationViewUtils {
fun setItemIconColors(navigationView: NavigationView, @ColorInt normalColor: Int, @ColorInt selectedColor: Int) { fun setItemIconColors(navigationView: NavigationView, @ColorInt normalColor: Int, @ColorInt selectedColor: Int) {

@ -13,6 +13,7 @@ import androidx.annotation.DrawableRes
import androidx.annotation.IntDef import androidx.annotation.IntDef
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
@Suppress("unused")
object Selector { object Selector {
fun shapeBuild(): ShapeSelector { fun shapeBuild(): ShapeSelector {
return ShapeSelector() return ShapeSelector()
@ -260,7 +261,8 @@ object Selector {
* @author hjy * @author hjy
* created at 2017/12/11 22:34 * created at 2017/12/11 22:34
*/ */
class DrawableSelector constructor() { @Suppress("MemberVisibilityCanBePrivate")
class DrawableSelector {
private var mDefaultDrawable: Drawable? = null private var mDefaultDrawable: Drawable? = null
private var mDisabledDrawable: Drawable? = null private var mDisabledDrawable: Drawable? = null
@ -355,7 +357,7 @@ object Selector {
* @author hjy * @author hjy
* created at 2017/12/11 22:26 * created at 2017/12/11 22:26
*/ */
class ColorSelector constructor() { class ColorSelector {
private var mDefaultColor: Int = 0 private var mDefaultColor: Int = 0
private var mDisabledColor: Int = 0 private var mDisabledColor: Int = 0

@ -16,6 +16,7 @@ import io.legado.app.utils.ColorUtils
/** /**
* @author Aidan Follestad (afollestad), Karim Abou Zeid (kabouzeid) * @author Aidan Follestad (afollestad), Karim Abou Zeid (kabouzeid)
*/ */
@Suppress("unused")
class ThemeStore @SuppressLint("CommitPrefEdits") class ThemeStore @SuppressLint("CommitPrefEdits")
private constructor(private val mContext: Context) : ThemeStoreInterface { private constructor(private val mContext: Context) : ThemeStoreInterface {
private val mEditor: SharedPreferences.Editor private val mEditor: SharedPreferences.Editor

@ -23,6 +23,7 @@ import io.legado.app.utils.ColorUtils
/** /**
* @author afollestad, plusCubed * @author afollestad, plusCubed
*/ */
@Suppress("MemberVisibilityCanBePrivate")
object TintHelper { object TintHelper {
@SuppressLint("PrivateResource") @SuppressLint("PrivateResource")
@ -37,7 +38,10 @@ object TintHelper {
) )
} }
private fun getDisabledColorStateList(@ColorInt normal: Int, @ColorInt disabled: Int): ColorStateList { private fun getDisabledColorStateList(
@ColorInt normal: Int,
@ColorInt disabled: Int
): ColorStateList {
return ColorStateList( return ColorStateList(
arrayOf( arrayOf(
intArrayOf(-android.R.attr.state_enabled), intArrayOf(-android.R.attr.state_enabled),
@ -61,7 +65,8 @@ object TintHelper {
) )
val sl: ColorStateList val sl: ColorStateList
if (view is Button) { when (view) {
is Button -> {
sl = getDisabledColorStateList(color, disabled) sl = getDisabledColorStateList(color, disabled)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && view.getBackground() is RippleDrawable) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && view.getBackground() is RippleDrawable) {
val rd = view.getBackground() as RippleDrawable val rd = view.getBackground() as RippleDrawable
@ -78,7 +83,8 @@ object TintHelper {
) )
) )
) )
} else if (view is FloatingActionButton) { }
is FloatingActionButton -> {
// FloatingActionButton doesn't support disabled state? // FloatingActionButton doesn't support disabled state?
sl = ColorStateList( sl = ColorStateList(
arrayOf( arrayOf(
@ -92,7 +98,8 @@ object TintHelper {
if (view.drawable != null) if (view.drawable != null)
view.setImageDrawable(createTintedDrawable(view.drawable, textColor)) view.setImageDrawable(createTintedDrawable(view.drawable, textColor))
return return
} else { }
else -> {
sl = ColorStateList( sl = ColorStateList(
arrayOf( arrayOf(
intArrayOf(-android.R.attr.state_enabled), intArrayOf(-android.R.attr.state_enabled),
@ -104,6 +111,7 @@ object TintHelper {
intArrayOf(disabled, color, pressed, activated, activated) intArrayOf(disabled, color, pressed, activated, activated)
) )
} }
}
var drawable: Drawable? = view.background var drawable: Drawable? = view.background
if (drawable != null) { if (drawable != null) {
@ -386,7 +394,11 @@ object TintHelper {
return createTintedDrawable(from, sl) return createTintedDrawable(from, sl)
} }
fun setTint(switchView: Switch, @ColorInt color: Int, useDarker: Boolean) { fun setTint(
@SuppressLint("UseSwitchCompatOrMaterialCode") switchView: Switch,
@ColorInt color: Int,
useDarker: Boolean
) {
if (switchView.trackDrawable != null) { if (switchView.trackDrawable != null) {
switchView.trackDrawable = modifySwitchDrawable( switchView.trackDrawable = modifySwitchDrawable(
switchView.context, switchView.context,

@ -10,6 +10,7 @@ import androidx.annotation.ColorInt
/** /**
* @author Karim Abou Zeid (kabouzeid) * @author Karim Abou Zeid (kabouzeid)
*/ */
@Suppress("unused")
object ViewUtils { object ViewUtils {
fun removeOnGlobalLayoutListener(v: View, listener: ViewTreeObserver.OnGlobalLayoutListener) { fun removeOnGlobalLayoutListener(v: View, listener: ViewTreeObserver.OnGlobalLayoutListener) {

@ -14,6 +14,7 @@ import java.net.URL
import java.net.URLEncoder import java.net.URLEncoder
import java.util.* import java.util.*
@Suppress("unused")
class WebDav(urlStr: String) { class WebDav(urlStr: String) {
companion object { companion object {
// 指定返回哪些属性 // 指定返回哪些属性
@ -60,9 +61,9 @@ class WebDav(urlStr: String) {
return field return field
} }
fun getPath() = url.toString() val path get() = url.toString()
fun getHost() = url.host val host: String? get() = url.host
/** /**
* 填充文件信息实例化WebDAVFile对象时并没有将远程文件的信息填充到实例中需要手动填充 * 填充文件信息实例化WebDAVFile对象时并没有将远程文件的信息填充到实例中需要手动填充

@ -8,6 +8,7 @@ import io.legado.app.utils.splitNotBlank
import java.util.* import java.util.*
import java.util.regex.Pattern import java.util.regex.Pattern
@Suppress("RegExpRedundantEscape")
@Keep @Keep
class AnalyzeByJSonPath { class AnalyzeByJSonPath {
private lateinit var ctx: ReadContext private lateinit var ctx: ReadContext

@ -8,6 +8,7 @@ import org.xmlpull.v1.XmlPullParserFactory
import java.io.IOException import java.io.IOException
import java.io.StringReader import java.io.StringReader
@Suppress("unused")
object RssParserDefault { object RssParserDefault {
@Throws(XmlPullParserException::class, IOException::class) @Throws(XmlPullParserException::class, IOException::class)

@ -4,6 +4,7 @@ import android.text.TextPaint
import io.legado.app.ui.book.read.page.provider.ChapterProvider import io.legado.app.ui.book.read.page.provider.ChapterProvider
import io.legado.app.ui.book.read.page.provider.ChapterProvider.textHeight import io.legado.app.ui.book.read.page.provider.ChapterProvider.textHeight
@Suppress("unused")
data class TextLine( data class TextLine(
var text: String = "", var text: String = "",
val textChars: ArrayList<TextChar> = arrayListOf(), val textChars: ArrayList<TextChar> = arrayListOf(),

@ -23,10 +23,10 @@ class FileAdapter(context: Context, val callBack: CallBack) :
private var rootPath: String? = null private var rootPath: String? = null
var currentPath: String? = null var currentPath: String? = null
private set private set
private val homeIcon = ConvertUtils.toDrawable(FilePickerIcon.getHOME()) private val homeIcon = ConvertUtils.toDrawable(FilePickerIcon.getHome())
private val upIcon = ConvertUtils.toDrawable(FilePickerIcon.getUPDIR()) private val upIcon = ConvertUtils.toDrawable(FilePickerIcon.getUpDir())
private val folderIcon = ConvertUtils.toDrawable(FilePickerIcon.getFOLDER()) private val folderIcon = ConvertUtils.toDrawable(FilePickerIcon.getFolder())
private val fileIcon = ConvertUtils.toDrawable(FilePickerIcon.getFILE()) private val fileIcon = ConvertUtils.toDrawable(FilePickerIcon.getFile())
private val primaryTextColor = context.getPrimaryTextColor(!AppConfig.isNightTheme) private val primaryTextColor = context.getPrimaryTextColor(!AppConfig.isNightTheme)
private val disabledTextColor = context.getPrimaryDisabledTextColor(!AppConfig.isNightTheme) private val disabledTextColor = context.getPrimaryDisabledTextColor(!AppConfig.isNightTheme)

@ -17,7 +17,7 @@ class PathAdapter(context: Context, val callBack: CallBack) :
private val paths = LinkedList<String>() private val paths = LinkedList<String>()
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
private val sdCardDirectory = Environment.getExternalStorageDirectory().absolutePath private val sdCardDirectory = Environment.getExternalStorageDirectory().absolutePath
private val arrowIcon = ConvertUtils.toDrawable(FilePickerIcon.getARROW()) private val arrowIcon = ConvertUtils.toDrawable(FilePickerIcon.getArrow())
fun getPath(position: Int): String { fun getPath(position: Int): String {
val tmp = StringBuilder("$sdCardDirectory/") val tmp = StringBuilder("$sdCardDirectory/")

@ -8,23 +8,23 @@ package io.legado.app.ui.filechooser.utils;
*/ */
public class FilePickerIcon { public class FilePickerIcon {
public static byte[] getFILE() { public static byte[] getFile() {
return FILE; return FILE;
} }
public static byte[] getFOLDER() { public static byte[] getFolder() {
return FOLDER; return FOLDER;
} }
public static byte[] getHOME() { public static byte[] getHome() {
return HOME; return HOME;
} }
public static byte[] getUPDIR() { public static byte[] getUpDir() {
return UPDIR; return UPDIR;
} }
public static byte[] getARROW() { public static byte[] getArrow() {
return ARROW; return ARROW;
} }

Loading…
Cancel
Save