优化
This commit is contained in:
@@ -68,6 +68,7 @@ object AppConst {
|
||||
|
||||
val appInfo: AppInfo by lazy {
|
||||
val appInfo = AppInfo()
|
||||
@Suppress("DEPRECATION")
|
||||
appCtx.packageManager.getPackageInfo(appCtx.packageName, PackageManager.GET_ACTIVITIES)
|
||||
?.let {
|
||||
appInfo.versionName = it.versionName
|
||||
|
||||
@@ -36,6 +36,7 @@ class MediaButtonReceiver : BroadcastReceiver() {
|
||||
fun handleIntent(context: Context, intent: Intent): Boolean {
|
||||
val intentAction = intent.action
|
||||
if (Intent.ACTION_MEDIA_BUTTON == intentAction) {
|
||||
@Suppress("DEPRECATION")
|
||||
val keyEvent = intent.getParcelableExtra<KeyEvent>(Intent.EXTRA_KEY_EVENT)
|
||||
?: return false
|
||||
val keycode: Int = keyEvent.keyCode
|
||||
|
||||
@@ -38,6 +38,8 @@ class BookmarkDialog() : BaseDialogFragment(R.layout.dialog_bookmark) {
|
||||
dismiss()
|
||||
return
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
val bookmark = arguments.getParcelable<Bookmark>("bookmark")
|
||||
bookmark ?: let {
|
||||
dismiss()
|
||||
|
||||
@@ -44,6 +44,7 @@ class GroupEditDialog() : BaseDialogFragment(R.layout.dialog_book_group_edit) {
|
||||
|
||||
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
|
||||
binding.toolBar.setBackgroundColor(primaryColor)
|
||||
@Suppress("DEPRECATION")
|
||||
bookGroup = arguments?.getParcelable("group")
|
||||
bookGroup?.let {
|
||||
binding.tieGroupName.setText(it.groupName)
|
||||
|
||||
@@ -279,8 +279,10 @@ class ImportBookActivity : VMBaseActivity<ActivityImportBookBinding, ImportBookV
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun onBackPressed() {
|
||||
if (!goBackDir()) {
|
||||
@Suppress("DEPRECATION")
|
||||
super.onBackPressed()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,6 +222,7 @@ class TextActionMenu(private val context: Context, private val callBack: CallBac
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
private fun getSupportedActivities(): List<ResolveInfo> {
|
||||
@Suppress("DEPRECATION")
|
||||
return context.packageManager
|
||||
.queryIntentActivities(createProcessTextIntent(), 0)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.legado.app.ui.book.remote
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
@@ -12,7 +13,6 @@ import io.legado.app.base.VMBaseActivity
|
||||
import io.legado.app.databinding.ActivityImportBookBinding
|
||||
import io.legado.app.lib.theme.backgroundColor
|
||||
import io.legado.app.ui.about.AppLogDialog
|
||||
import io.legado.app.ui.book.remote.manager.RemoteBookWebDav
|
||||
import io.legado.app.ui.widget.SelectActionBar
|
||||
import io.legado.app.ui.widget.dialog.WaitDialog
|
||||
import io.legado.app.utils.showDialogFragment
|
||||
@@ -117,6 +117,7 @@ class RemoteBookActivity : VMBaseActivity<ActivityImportBookBinding, RemoteBookV
|
||||
adapter.selectAll(selectAll)
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
override fun onClickSelectBarMainAction() {
|
||||
waitDialog.show()
|
||||
viewModel.addToBookshelf(adapter.selected) {
|
||||
@@ -126,8 +127,10 @@ class RemoteBookActivity : VMBaseActivity<ActivityImportBookBinding, RemoteBookV
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun onBackPressed() {
|
||||
if (!goBackDir()) {
|
||||
@Suppress("DEPRECATION")
|
||||
super.onBackPressed()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,6 +186,7 @@ val Context.sysScreenOffTime: Int
|
||||
}
|
||||
|
||||
val Context.statusBarHeight: Int
|
||||
@SuppressLint("DiscouragedApi")
|
||||
get() {
|
||||
if (Build.BOARD == "windows") {
|
||||
return 0
|
||||
@@ -195,6 +196,7 @@ val Context.statusBarHeight: Int
|
||||
}
|
||||
|
||||
val Context.navigationBarHeight: Int
|
||||
@SuppressLint("DiscouragedApi")
|
||||
get() {
|
||||
val resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android")
|
||||
return resources.getDimensionPixelSize(resourceId)
|
||||
@@ -342,6 +344,7 @@ val Context.isPad: Boolean
|
||||
return (resources.configuration.screenLayout and Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
val Context.channel: String
|
||||
get() {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user