commit
6b8cda423f
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,3 +1,3 @@ |
|||||||
<!DOCTYPE html><html lang="en" style="padding: 0;height:100%"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"><link rel="icon" href="../favicon.ico" type="image/x-icon"><link rel="shortcut icon" href="../favicon.ico" type="image/x-icon"><title>Legado Bookshelf</title><link href="css/about.b93f38f9.css" rel="prefetch"><link href="css/detail.7f9a50b2.css" rel="prefetch"><link href="js/about.66694f8c.js" rel="prefetch"><link href="js/detail.08ed5833.js" rel="prefetch"><link href="css/app.e4c919b7.css" rel="preload" as="style"><link href="css/chunk-vendors.bd1373b6.css" rel="preload" as="style"><link href="js/app.9f1876f9.js" rel="preload" as="script"><link href="js/chunk-vendors.7abad833.js" rel="preload" as="script"><link href="css/chunk-vendors.bd1373b6.css" rel="stylesheet"><link href="css/app.e4c919b7.css" rel="stylesheet"></head><style>body::-webkit-scrollbar { |
<!DOCTYPE html><html lang="en" style="padding: 0;height:100%"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"><link rel="icon" href="../favicon.ico" type="image/x-icon"><link rel="shortcut icon" href="../favicon.ico" type="image/x-icon"><title>Legado Bookshelf</title><link href="css/about.65a00131.css" rel="prefetch"><link href="css/detail.12a39aa7.css" rel="prefetch"><link href="js/about.2456ab2e.js" rel="prefetch"><link href="js/detail.8e2caf8f.js" rel="prefetch"><link href="css/app.e4c919b7.css" rel="preload" as="style"><link href="css/chunk-vendors.bd1373b6.css" rel="preload" as="style"><link href="js/app.a68b7203.js" rel="preload" as="script"><link href="js/chunk-vendors.f36dda93.js" rel="preload" as="script"><link href="css/chunk-vendors.bd1373b6.css" rel="stylesheet"><link href="css/app.e4c919b7.css" rel="stylesheet"></head><style>body::-webkit-scrollbar { |
||||||
display: none; |
display: none; |
||||||
}</style><body style="margin: 0;height:100%"><noscript><strong>We're sorry but yd-web-tool doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/chunk-vendors.7abad833.js"></script><script src="js/app.9f1876f9.js"></script></body></html> |
}</style><body style="margin: 0;height:100%"><noscript><strong>We're sorry but yd-web-tool doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/chunk-vendors.f36dda93.js"></script><script src="js/app.a68b7203.js"></script></body></html> |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,43 +1,47 @@ |
|||||||
package io.legado.app.help |
package io.legado.app.help |
||||||
|
|
||||||
import io.legado.app.data.entities.ReplaceRule |
import io.legado.app.data.entities.ReplaceRule |
||||||
|
import io.legado.app.exception.NoStackTraceException |
||||||
import io.legado.app.utils.* |
import io.legado.app.utils.* |
||||||
|
|
||||||
object ReplaceAnalyzer { |
object ReplaceAnalyzer { |
||||||
|
|
||||||
fun jsonToReplaceRules(json: String): List<ReplaceRule> { |
fun jsonToReplaceRules(json: String): Result<MutableList<ReplaceRule>> { |
||||||
val replaceRules = mutableListOf<ReplaceRule>() |
return kotlin.runCatching { |
||||||
val items: List<Map<String, Any>> = jsonPath.parse(json).read("$") |
val replaceRules = mutableListOf<ReplaceRule>() |
||||||
for (item in items) { |
val items: List<Map<String, Any>> = jsonPath.parse(json).read("$") |
||||||
val jsonItem = jsonPath.parse(item) |
for (item in items) { |
||||||
jsonToReplaceRule(jsonItem.jsonString())?.let { |
val jsonItem = jsonPath.parse(item) |
||||||
if (it.isValid()) { |
jsonToReplaceRule(jsonItem.jsonString()).getOrThrow().let { |
||||||
replaceRules.add(it) |
if (it.isValid()) { |
||||||
|
replaceRules.add(it) |
||||||
|
} |
||||||
} |
} |
||||||
} |
} |
||||||
|
replaceRules |
||||||
} |
} |
||||||
return replaceRules |
|
||||||
} |
} |
||||||
|
|
||||||
private fun jsonToReplaceRule(json: String): ReplaceRule? { |
fun jsonToReplaceRule(json: String): Result<ReplaceRule> { |
||||||
val replaceRule: ReplaceRule? = GSON.fromJsonObject<ReplaceRule>(json.trim()).getOrNull() |
return runCatching { |
||||||
runCatching { |
val replaceRule: ReplaceRule? = |
||||||
|
GSON.fromJsonObject<ReplaceRule>(json.trim()).getOrNull() |
||||||
if (replaceRule == null || replaceRule.pattern.isBlank()) { |
if (replaceRule == null || replaceRule.pattern.isBlank()) { |
||||||
val jsonItem = jsonPath.parse(json.trim()) |
val jsonItem = jsonPath.parse(json.trim()) |
||||||
val rule = ReplaceRule() |
val rule = ReplaceRule() |
||||||
rule.id = jsonItem.readLong("$.id") ?: System.currentTimeMillis() |
rule.id = jsonItem.readLong("$.id") ?: System.currentTimeMillis() |
||||||
rule.pattern = jsonItem.readString("$.regex") ?: "" |
rule.pattern = jsonItem.readString("$.regex") ?: "" |
||||||
if (rule.pattern.isEmpty()) return null |
if (rule.pattern.isEmpty()) throw NoStackTraceException("格式不对") |
||||||
rule.name = jsonItem.readString("$.replaceSummary") ?: "" |
rule.name = jsonItem.readString("$.replaceSummary") ?: "" |
||||||
rule.replacement = jsonItem.readString("$.replacement") ?: "" |
rule.replacement = jsonItem.readString("$.replacement") ?: "" |
||||||
rule.isRegex = jsonItem.readBool("$.isRegex") == true |
rule.isRegex = jsonItem.readBool("$.isRegex") == true |
||||||
rule.scope = jsonItem.readString("$.useTo") |
rule.scope = jsonItem.readString("$.useTo") |
||||||
rule.isEnabled = jsonItem.readBool("$.enable") == true |
rule.isEnabled = jsonItem.readBool("$.enable") == true |
||||||
rule.order = jsonItem.readInt("$.serialNumber") ?: 0 |
rule.order = jsonItem.readInt("$.serialNumber") ?: 0 |
||||||
return rule |
return@runCatching rule |
||||||
} |
} |
||||||
|
return@runCatching replaceRule |
||||||
} |
} |
||||||
return replaceRule |
|
||||||
} |
} |
||||||
|
|
||||||
} |
} |
@ -0,0 +1,36 @@ |
|||||||
|
package io.legado.app.lib.prefs |
||||||
|
|
||||||
|
import android.content.Context |
||||||
|
import android.util.AttributeSet |
||||||
|
import android.widget.TextView |
||||||
|
import androidx.preference.EditTextPreference.OnBindEditTextListener |
||||||
|
import androidx.preference.PreferenceViewHolder |
||||||
|
import io.legado.app.R |
||||||
|
import io.legado.app.lib.theme.accentColor |
||||||
|
import io.legado.app.utils.applyTint |
||||||
|
|
||||||
|
class EditTextPreference(context: Context, attrs: AttributeSet) : |
||||||
|
androidx.preference.EditTextPreference(context, attrs) { |
||||||
|
|
||||||
|
private var mOnBindEditTextListener: OnBindEditTextListener? = null |
||||||
|
private val onBindEditTextListener = OnBindEditTextListener { editText -> |
||||||
|
editText.applyTint(context.accentColor) |
||||||
|
mOnBindEditTextListener?.onBindEditText(editText) |
||||||
|
} |
||||||
|
|
||||||
|
init { |
||||||
|
// isPersistent = true |
||||||
|
layoutResource = R.layout.view_preference |
||||||
|
super.setOnBindEditTextListener(onBindEditTextListener) |
||||||
|
} |
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: PreferenceViewHolder) { |
||||||
|
Preference.bindView<TextView>(context, holder, icon, title, summary, null, null) |
||||||
|
super.onBindViewHolder(holder) |
||||||
|
} |
||||||
|
|
||||||
|
override fun setOnBindEditTextListener(onBindEditTextListener: OnBindEditTextListener?) { |
||||||
|
mOnBindEditTextListener = onBindEditTextListener |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -1,4 +1,4 @@ |
|||||||
package io.legado.app.ui.widget.prefs |
package io.legado.app.lib.prefs |
||||||
|
|
||||||
import android.content.Context |
import android.content.Context |
||||||
import android.content.ContextWrapper |
import android.content.ContextWrapper |
@ -1,4 +1,4 @@ |
|||||||
package io.legado.app.ui.widget.prefs |
package io.legado.app.lib.prefs |
||||||
|
|
||||||
import android.content.Context |
import android.content.Context |
||||||
import android.graphics.drawable.Drawable |
import android.graphics.drawable.Drawable |
@ -1,4 +1,4 @@ |
|||||||
package io.legado.app.ui.widget.prefs |
package io.legado.app.lib.prefs |
||||||
|
|
||||||
import android.content.Context |
import android.content.Context |
||||||
import android.util.AttributeSet |
import android.util.AttributeSet |
@ -1,4 +1,4 @@ |
|||||||
package io.legado.app.ui.widget.prefs |
package io.legado.app.lib.prefs |
||||||
|
|
||||||
import android.content.Context |
import android.content.Context |
||||||
import android.util.AttributeSet |
import android.util.AttributeSet |
@ -1,7 +1,7 @@ |
|||||||
# 本地书籍解析 |
# 书籍文件导入解析 |
||||||
|
|
||||||
* BaseLocalBookParse.kt 本地书籍解析接口 |
* BaseLocalBookParse.kt 本地书籍解析接口 |
||||||
* LocalBook.kt 总入口 |
* LocalBook.kt 导入解析总入口 |
||||||
* TextFile.kt 解析txt |
* TextFile.kt 解析txt |
||||||
* EpubFile.kt 解析epub |
* EpubFile.kt 解析epub |
||||||
* UmdFile.kt 解析umd |
* UmdFile.kt 解析umd |
@ -0,0 +1,132 @@ |
|||||||
|
package io.legado.app.ui.association |
||||||
|
|
||||||
|
import android.content.Context |
||||||
|
import android.content.DialogInterface |
||||||
|
import android.os.Bundle |
||||||
|
import android.view.View |
||||||
|
import android.view.ViewGroup |
||||||
|
import android.net.Uri |
||||||
|
import androidx.fragment.app.viewModels |
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager |
||||||
|
import io.legado.app.R |
||||||
|
import io.legado.app.base.BaseDialogFragment |
||||||
|
import io.legado.app.base.adapter.ItemViewHolder |
||||||
|
import io.legado.app.base.adapter.RecyclerAdapter |
||||||
|
import io.legado.app.databinding.DialogRecyclerViewBinding |
||||||
|
import io.legado.app.databinding.ItemBookFileImportBinding |
||||||
|
import io.legado.app.help.config.AppConfig |
||||||
|
import io.legado.app.lib.dialogs.alert |
||||||
|
import io.legado.app.lib.theme.primaryColor |
||||||
|
import io.legado.app.ui.widget.dialog.WaitDialog |
||||||
|
import io.legado.app.utils.* |
||||||
|
import io.legado.app.utils.viewbindingdelegate.viewBinding |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 导入在线书籍文件弹出窗口 |
||||||
|
*/ |
||||||
|
class ImportOnLineBookFileDialog() : BaseDialogFragment(R.layout.dialog_recycler_view) { |
||||||
|
|
||||||
|
|
||||||
|
private val binding by viewBinding(DialogRecyclerViewBinding::bind) |
||||||
|
private val viewModel by viewModels<ImportOnLineBookFileViewModel>() |
||||||
|
private val adapter by lazy { BookFileAdapter(requireContext()) } |
||||||
|
|
||||||
|
override fun onStart() { |
||||||
|
super.onStart() |
||||||
|
setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) |
||||||
|
} |
||||||
|
|
||||||
|
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { |
||||||
|
val bookUrl = arguments?.getString("bookUrl") |
||||||
|
viewModel.initData(bookUrl) |
||||||
|
binding.toolBar.setBackgroundColor(primaryColor) |
||||||
|
binding.toolBar.setTitle(R.string.download_and_import_file) |
||||||
|
binding.rotateLoading.show() |
||||||
|
binding.recyclerView.layoutManager = LinearLayoutManager(requireContext()) |
||||||
|
binding.recyclerView.adapter = adapter |
||||||
|
viewModel.errorLiveData.observe(this) { |
||||||
|
binding.rotateLoading.hide() |
||||||
|
binding.tvMsg.apply { |
||||||
|
text = it |
||||||
|
visible() |
||||||
|
} |
||||||
|
} |
||||||
|
viewModel.successLiveData.observe(this) { |
||||||
|
binding.rotateLoading.hide() |
||||||
|
if (it > 0) { |
||||||
|
adapter.setItems(viewModel.allBookFiles) |
||||||
|
} |
||||||
|
} |
||||||
|
viewModel.savedFileUriData.observe(this) { |
||||||
|
requireContext().openFileUri(it, "*/*") |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private fun importFileAndUpdate(url: String, fileName: String) { |
||||||
|
val waitDialog = WaitDialog(requireContext()) |
||||||
|
waitDialog.show() |
||||||
|
viewModel.importOnLineBookFile(url, fileName) { |
||||||
|
waitDialog.dismiss() |
||||||
|
dismissAllowingStateLoss() |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private fun downloadFile(url: String, fileName: String) { |
||||||
|
val waitDialog = WaitDialog(requireContext()) |
||||||
|
waitDialog.show() |
||||||
|
viewModel.downloadUrl(url, fileName) { |
||||||
|
waitDialog.dismiss() |
||||||
|
dismissAllowingStateLoss() |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
inner class BookFileAdapter(context: Context) : |
||||||
|
RecyclerAdapter<Triple<String, String, Boolean> |
||||||
|
, ItemBookFileImportBinding>(context) { |
||||||
|
|
||||||
|
override fun getViewBinding(parent: ViewGroup): ItemBookFileImportBinding { |
||||||
|
return ItemBookFileImportBinding.inflate(inflater, parent, false) |
||||||
|
} |
||||||
|
|
||||||
|
override fun convert( |
||||||
|
holder: ItemViewHolder, |
||||||
|
binding: ItemBookFileImportBinding, |
||||||
|
item: Triple<String, String, Boolean>, |
||||||
|
payloads: MutableList<Any> |
||||||
|
) { |
||||||
|
binding.apply { |
||||||
|
cbFileName.text = item.second |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
override fun registerListener( |
||||||
|
holder: ItemViewHolder, |
||||||
|
binding: ItemBookFileImportBinding |
||||||
|
) { |
||||||
|
binding.apply { |
||||||
|
cbFileName.setOnClickListener { |
||||||
|
val selectFile = viewModel.allBookFiles[holder.layoutPosition] |
||||||
|
if (selectFile.third) { |
||||||
|
importFileAndUpdate(selectFile.first, selectFile.second) |
||||||
|
} else { |
||||||
|
alert( |
||||||
|
title = getString(R.string.draw), |
||||||
|
message = getString(R.string.file_not_supported, selectFile.second) |
||||||
|
) { |
||||||
|
okButton { |
||||||
|
importFileAndUpdate(selectFile.first, selectFile.second) |
||||||
|
} |
||||||
|
neutralButton(R.string.open_fun) { |
||||||
|
downloadFile(selectFile.first, selectFile.second) |
||||||
|
} |
||||||
|
cancelButton() |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,80 @@ |
|||||||
|
package io.legado.app.ui.association |
||||||
|
|
||||||
|
import android.app.Application |
||||||
|
import android.net.Uri |
||||||
|
import androidx.lifecycle.MutableLiveData |
||||||
|
import io.legado.app.R |
||||||
|
import io.legado.app.base.BaseViewModel |
||||||
|
import io.legado.app.constant.AppPattern |
||||||
|
import io.legado.app.constant.AppLog |
||||||
|
import io.legado.app.constant.EventBus |
||||||
|
import io.legado.app.data.appDb |
||||||
|
import io.legado.app.data.entities.Book |
||||||
|
import io.legado.app.data.entities.BookSource |
||||||
|
import io.legado.app.exception.NoStackTraceException |
||||||
|
import io.legado.app.model.analyzeRule.AnalyzeRule |
||||||
|
import io.legado.app.model.analyzeRule.AnalyzeUrl |
||||||
|
import io.legado.app.model.localBook.LocalBook |
||||||
|
import io.legado.app.utils.* |
||||||
|
|
||||||
|
class ImportOnLineBookFileViewModel(app: Application) : BaseViewModel(app) { |
||||||
|
|
||||||
|
val allBookFiles = arrayListOf<Triple<String, String, Boolean>>() |
||||||
|
val errorLiveData = MutableLiveData<String>() |
||||||
|
val successLiveData = MutableLiveData<Int>() |
||||||
|
val savedFileUriData = MutableLiveData<Uri>() |
||||||
|
var bookSource: BookSource? = null |
||||||
|
|
||||||
|
fun initData(bookUrl: String?) { |
||||||
|
execute { |
||||||
|
bookUrl ?: throw NoStackTraceException("书籍详情页链接为空") |
||||||
|
val book = appDb.searchBookDao.getSearchBook(bookUrl)?.toBook() |
||||||
|
?: throw NoStackTraceException("book is null") |
||||||
|
bookSource = appDb.bookSourceDao.getBookSource(book.origin) |
||||||
|
?: throw NoStackTraceException("bookSource is null") |
||||||
|
val ruleDownloadUrls = bookSource?.getBookInfoRule()?.downloadUrls |
||||||
|
val content = AnalyzeUrl(bookUrl, source = bookSource).getStrResponse().body |
||||||
|
val analyzeRule = AnalyzeRule(book, bookSource) |
||||||
|
analyzeRule.setContent(content).setBaseUrl(bookUrl) |
||||||
|
val fileName = "${book.name} 作者:${book.author}" |
||||||
|
analyzeRule.getStringList(ruleDownloadUrls, isUrl = true)?.let { |
||||||
|
it.forEach { url -> |
||||||
|
val mFileName = "${fileName}.${LocalBook.parseFileSuffix(url)}" |
||||||
|
val isSupportedFile = AppPattern.bookFileRegex.matches(mFileName) |
||||||
|
allBookFiles.add(Triple(url, mFileName, isSupportedFile)) |
||||||
|
} |
||||||
|
} ?: throw NoStackTraceException("下载链接规则解析为空") |
||||||
|
}.onSuccess { |
||||||
|
successLiveData.postValue(allBookFiles.size) |
||||||
|
}.onError { |
||||||
|
errorLiveData.postValue(it.localizedMessage ?: "") |
||||||
|
context.toastOnUi("获取书籍下载链接失败\n${it.localizedMessage}") |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
fun downloadUrl(url: String, fileName: String, success: () -> Unit) { |
||||||
|
execute { |
||||||
|
LocalBook.saveBookFile(url, fileName, bookSource).let { |
||||||
|
savedFileUriData.postValue(it) |
||||||
|
} |
||||||
|
}.onSuccess { |
||||||
|
success.invoke() |
||||||
|
}.onError { |
||||||
|
context.toastOnUi("下载书籍文件失败\n${it.localizedMessage}") |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
fun importOnLineBookFile(url: String, fileName: String, success: () -> Unit) { |
||||||
|
execute { |
||||||
|
LocalBook.importFileOnLine(url, fileName, bookSource).let { |
||||||
|
postEvent(EventBus.BOOK_URL_CHANGED, it.bookUrl) |
||||||
|
} |
||||||
|
}.onSuccess { |
||||||
|
success.invoke() |
||||||
|
}.onError { |
||||||
|
context.toastOnUi("下载书籍文件失败\n${it.localizedMessage}") |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -1,22 +0,0 @@ |
|||||||
package io.legado.app.ui.widget.prefs |
|
||||||
|
|
||||||
import android.content.Context |
|
||||||
import android.util.AttributeSet |
|
||||||
import android.widget.TextView |
|
||||||
import androidx.preference.PreferenceViewHolder |
|
||||||
import io.legado.app.R |
|
||||||
|
|
||||||
class EditTextPreference(context: Context, attrs: AttributeSet) : |
|
||||||
androidx.preference.EditTextPreference(context, attrs) { |
|
||||||
|
|
||||||
init { |
|
||||||
// isPersistent = true |
|
||||||
layoutResource = R.layout.view_preference |
|
||||||
} |
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: PreferenceViewHolder) { |
|
||||||
Preference.bindView<TextView>(context, holder, icon, title, summary, null, null) |
|
||||||
super.onBindViewHolder(holder) |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -0,0 +1,61 @@ |
|||||||
|
package io.legado.app.utils |
||||||
|
|
||||||
|
import android.graphics.Color |
||||||
|
import java.util.* |
||||||
|
|
||||||
|
@Suppress("unused") |
||||||
|
class RandomColor(alpha: Int, lower: Int, upper: Int) { |
||||||
|
|
||||||
|
constructor() : this(255, 80, 200) |
||||||
|
|
||||||
|
private var alpha: Int = 0 |
||||||
|
private var lower: Int = 0 |
||||||
|
private var upper: Int = 0 |
||||||
|
|
||||||
|
init { |
||||||
|
require(upper > lower) { "must be lower < upper" } |
||||||
|
setAlpha(alpha) |
||||||
|
setLower(lower) |
||||||
|
setUpper(upper) |
||||||
|
} |
||||||
|
|
||||||
|
//随机数是前闭 后开 |
||||||
|
fun build(): Int { |
||||||
|
val red = getLower() + Random().nextInt(getUpper() - getLower() + 1) |
||||||
|
val green = getLower() + Random().nextInt(getUpper() - getLower() + 1) |
||||||
|
val blue = getLower() + Random().nextInt(getUpper() - getLower() + 1) |
||||||
|
return Color.argb(getAlpha(), red, green, blue) |
||||||
|
} |
||||||
|
|
||||||
|
private fun getAlpha(): Int { |
||||||
|
return alpha |
||||||
|
} |
||||||
|
|
||||||
|
private fun setAlpha(alpha: Int) { |
||||||
|
var alpha1 = alpha |
||||||
|
if (alpha1 > 255) alpha1 = 255 |
||||||
|
if (alpha1 < 0) alpha1 = 0 |
||||||
|
this.alpha = alpha1 |
||||||
|
} |
||||||
|
|
||||||
|
private fun getLower(): Int { |
||||||
|
return lower |
||||||
|
} |
||||||
|
|
||||||
|
private fun setLower(lower: Int) { |
||||||
|
var lower1 = lower |
||||||
|
if (lower1 < 0) lower1 = 0 |
||||||
|
this.lower = lower1 |
||||||
|
} |
||||||
|
|
||||||
|
private fun getUpper(): Int { |
||||||
|
return upper |
||||||
|
} |
||||||
|
|
||||||
|
private fun setUpper(upper: Int) { |
||||||
|
var upper1 = upper |
||||||
|
if (upper1 > 255) upper1 = 255 |
||||||
|
this.upper = upper1 |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,23 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||||
|
xmlns:tools="http://schemas.android.com/tools" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:padding="8dp"> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/cb_file_name" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:textColor="@color/primaryText" |
||||||
|
android:textSize="14sp" |
||||||
|
app:layout_constrainedWidth="true" |
||||||
|
app:layout_constraintBottom_toBottomOf="parent" |
||||||
|
app:layout_constraintHorizontal_bias="0" |
||||||
|
app:layout_constraintHorizontal_chainStyle="packed" |
||||||
|
app:layout_constraintLeft_toLeftOf="parent" |
||||||
|
app:layout_constraintTop_toTopOf="parent" |
||||||
|
tools:ignore="TouchTargetSizeCheck" /> |
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout> |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue