mirror of
https://github.com/gedoor/legado.git
synced 2024-07-19 01:17:25 +08:00
优化
This commit is contained in:
parent
4f465fcb69
commit
82d4c0de03
@ -137,12 +137,12 @@ dependencies {
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version")
|
||||
|
||||
//androidX
|
||||
implementation('androidx.core:core-ktx:1.7.0')
|
||||
implementation('androidx.appcompat:appcompat:1.3.1')
|
||||
implementation('androidx.core:core-ktx:1.6.0')
|
||||
implementation("androidx.activity:activity-ktx:1.3.1")
|
||||
implementation("androidx.fragment:fragment-ktx:1.3.6")
|
||||
implementation('androidx.activity:activity-ktx:1.4.0')
|
||||
implementation('androidx.fragment:fragment-ktx:1.3.6')
|
||||
implementation('androidx.preference:preference-ktx:1.1.1')
|
||||
implementation('androidx.constraintlayout:constraintlayout:2.1.0')
|
||||
implementation('androidx.constraintlayout:constraintlayout:2.1.1')
|
||||
implementation('androidx.swiperefreshlayout:swiperefreshlayout:1.1.0')
|
||||
implementation('androidx.viewpager2:viewpager2:1.0.0')
|
||||
implementation('com.google.android.material:material:1.4.0')
|
||||
|
@ -98,12 +98,12 @@ abstract class BaseActivity<VB : ViewBinding>(
|
||||
|
||||
abstract fun onActivityCreated(savedInstanceState: Bundle?)
|
||||
|
||||
final override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
||||
return menu?.let {
|
||||
final override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
return menu.let {
|
||||
val bool = onCompatCreateOptionsMenu(it)
|
||||
it.applyTint(this, toolBarTheme)
|
||||
bool
|
||||
} ?: super.onCreateOptionsMenu(menu)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onMenuOpened(featureId: Int, menu: Menu): Boolean {
|
||||
|
@ -7,7 +7,7 @@ import androidx.activity.result.contract.ActivityResultContract
|
||||
|
||||
class TocActivityResult : ActivityResultContract<String, Pair<Int, Int>?>() {
|
||||
|
||||
override fun createIntent(context: Context, input: String?): Intent {
|
||||
override fun createIntent(context: Context, input: String): Intent {
|
||||
return Intent(context, TocActivity::class.java)
|
||||
.putExtra("bookUrl", input)
|
||||
}
|
||||
|
@ -15,12 +15,10 @@ class HandleFileContract :
|
||||
|
||||
private var requestCode: Int = 0
|
||||
|
||||
override fun createIntent(context: Context, input: (HandleFileParam.() -> Unit)?): Intent {
|
||||
override fun createIntent(context: Context, input: (HandleFileParam.() -> Unit)): Intent {
|
||||
val intent = Intent(context, HandleFileActivity::class.java)
|
||||
val handleFileParam = HandleFileParam()
|
||||
input?.let {
|
||||
handleFileParam.apply(input)
|
||||
}
|
||||
handleFileParam.apply(input)
|
||||
handleFileParam.let {
|
||||
requestCode = it.requestCode
|
||||
intent.putExtra("mode", it.mode)
|
||||
|
@ -82,14 +82,10 @@ abstract class BaseBookshelfFragment(layoutId: Int) : VMBaseFragment<BookshelfVi
|
||||
R.id.menu_download -> startActivity<CacheActivity> {
|
||||
putExtra("groupId", groupId)
|
||||
}
|
||||
R.id.menu_export_bookshelf -> viewModel.exportBookshelf(books) {
|
||||
R.id.menu_export_bookshelf -> viewModel.exportBookshelf(books) { file ->
|
||||
exportResult.launch {
|
||||
mode = HandleFileContract.EXPORT
|
||||
fileData = Triple(
|
||||
"bookshelf.json",
|
||||
it.toByteArray(),
|
||||
"application/json"
|
||||
)
|
||||
fileData = Triple("bookshelf.json", file, "application/json")
|
||||
}
|
||||
}
|
||||
R.id.menu_import_bookshelf -> importBookshelfAlert(groupId)
|
||||
|
@ -7,7 +7,7 @@ import androidx.activity.result.contract.ActivityResultContract
|
||||
|
||||
class QrCodeResult : ActivityResultContract<Unit, String?>() {
|
||||
|
||||
override fun createIntent(context: Context, input: Unit?): Intent {
|
||||
override fun createIntent(context: Context, input: Unit): Intent {
|
||||
return Intent(context, QrCodeActivity::class.java)
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class SelectImageContract : ActivityResultContract<Int, SelectImageContract.Resu
|
||||
|
||||
var requestCode: Int? = null
|
||||
|
||||
override fun createIntent(context: Context, input: Int?): Intent {
|
||||
override fun createIntent(context: Context, input: Int): Intent {
|
||||
requestCode = input
|
||||
return Intent(Intent.ACTION_GET_CONTENT)
|
||||
.addCategory(Intent.CATEGORY_OPENABLE)
|
||||
|
Loading…
Reference in New Issue
Block a user