pull/2260/head
kunfei 2 years ago
parent a3a4403cc7
commit 74f30c13ea
  1. 1
      app/src/main/java/io/legado/app/constant/AppConst.kt
  2. 1
      app/src/main/java/io/legado/app/receiver/MediaButtonReceiver.kt
  3. 2
      app/src/main/java/io/legado/app/ui/book/bookmark/BookmarkDialog.kt
  4. 1
      app/src/main/java/io/legado/app/ui/book/group/GroupEditDialog.kt
  5. 2
      app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt
  6. 1
      app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt
  7. 5
      app/src/main/java/io/legado/app/ui/book/remote/RemoteBookActivity.kt
  8. 3
      app/src/main/java/io/legado/app/utils/ContextExtensions.kt

@ -68,6 +68,7 @@ object AppConst {
val appInfo: AppInfo by lazy { val appInfo: AppInfo by lazy {
val appInfo = AppInfo() val appInfo = AppInfo()
@Suppress("DEPRECATION")
appCtx.packageManager.getPackageInfo(appCtx.packageName, PackageManager.GET_ACTIVITIES) appCtx.packageManager.getPackageInfo(appCtx.packageName, PackageManager.GET_ACTIVITIES)
?.let { ?.let {
appInfo.versionName = it.versionName appInfo.versionName = it.versionName

@ -36,6 +36,7 @@ class MediaButtonReceiver : BroadcastReceiver() {
fun handleIntent(context: Context, intent: Intent): Boolean { fun handleIntent(context: Context, intent: Intent): Boolean {
val intentAction = intent.action val intentAction = intent.action
if (Intent.ACTION_MEDIA_BUTTON == intentAction) { if (Intent.ACTION_MEDIA_BUTTON == intentAction) {
@Suppress("DEPRECATION")
val keyEvent = intent.getParcelableExtra<KeyEvent>(Intent.EXTRA_KEY_EVENT) val keyEvent = intent.getParcelableExtra<KeyEvent>(Intent.EXTRA_KEY_EVENT)
?: return false ?: return false
val keycode: Int = keyEvent.keyCode val keycode: Int = keyEvent.keyCode

@ -38,6 +38,8 @@ class BookmarkDialog() : BaseDialogFragment(R.layout.dialog_bookmark) {
dismiss() dismiss()
return return
} }
@Suppress("DEPRECATION")
val bookmark = arguments.getParcelable<Bookmark>("bookmark") val bookmark = arguments.getParcelable<Bookmark>("bookmark")
bookmark ?: let { bookmark ?: let {
dismiss() dismiss()

@ -44,6 +44,7 @@ class GroupEditDialog() : BaseDialogFragment(R.layout.dialog_book_group_edit) {
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
binding.toolBar.setBackgroundColor(primaryColor) binding.toolBar.setBackgroundColor(primaryColor)
@Suppress("DEPRECATION")
bookGroup = arguments?.getParcelable("group") bookGroup = arguments?.getParcelable("group")
bookGroup?.let { bookGroup?.let {
binding.tieGroupName.setText(it.groupName) binding.tieGroupName.setText(it.groupName)

@ -279,8 +279,10 @@ class ImportBookActivity : VMBaseActivity<ActivityImportBookBinding, ImportBookV
} }
} }
@Deprecated("Deprecated in Java")
override fun onBackPressed() { override fun onBackPressed() {
if (!goBackDir()) { if (!goBackDir()) {
@Suppress("DEPRECATION")
super.onBackPressed() super.onBackPressed()
} }
} }

@ -222,6 +222,7 @@ class TextActionMenu(private val context: Context, private val callBack: CallBac
@RequiresApi(Build.VERSION_CODES.M) @RequiresApi(Build.VERSION_CODES.M)
private fun getSupportedActivities(): List<ResolveInfo> { private fun getSupportedActivities(): List<ResolveInfo> {
@Suppress("DEPRECATION")
return context.packageManager return context.packageManager
.queryIntentActivities(createProcessTextIntent(), 0) .queryIntentActivities(createProcessTextIntent(), 0)
} }

@ -1,5 +1,6 @@
package io.legado.app.ui.book.remote package io.legado.app.ui.book.remote
import android.annotation.SuppressLint
import android.os.Bundle import android.os.Bundle
import android.view.Menu import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
@ -12,7 +13,6 @@ import io.legado.app.base.VMBaseActivity
import io.legado.app.databinding.ActivityImportBookBinding import io.legado.app.databinding.ActivityImportBookBinding
import io.legado.app.lib.theme.backgroundColor import io.legado.app.lib.theme.backgroundColor
import io.legado.app.ui.about.AppLogDialog 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.SelectActionBar
import io.legado.app.ui.widget.dialog.WaitDialog import io.legado.app.ui.widget.dialog.WaitDialog
import io.legado.app.utils.showDialogFragment import io.legado.app.utils.showDialogFragment
@ -117,6 +117,7 @@ class RemoteBookActivity : VMBaseActivity<ActivityImportBookBinding, RemoteBookV
adapter.selectAll(selectAll) adapter.selectAll(selectAll)
} }
@SuppressLint("NotifyDataSetChanged")
override fun onClickSelectBarMainAction() { override fun onClickSelectBarMainAction() {
waitDialog.show() waitDialog.show()
viewModel.addToBookshelf(adapter.selected) { viewModel.addToBookshelf(adapter.selected) {
@ -126,8 +127,10 @@ class RemoteBookActivity : VMBaseActivity<ActivityImportBookBinding, RemoteBookV
} }
} }
@Deprecated("Deprecated in Java")
override fun onBackPressed() { override fun onBackPressed() {
if (!goBackDir()) { if (!goBackDir()) {
@Suppress("DEPRECATION")
super.onBackPressed() super.onBackPressed()
} }
} }

@ -186,6 +186,7 @@ val Context.sysScreenOffTime: Int
} }
val Context.statusBarHeight: Int val Context.statusBarHeight: Int
@SuppressLint("DiscouragedApi")
get() { get() {
if (Build.BOARD == "windows") { if (Build.BOARD == "windows") {
return 0 return 0
@ -195,6 +196,7 @@ val Context.statusBarHeight: Int
} }
val Context.navigationBarHeight: Int val Context.navigationBarHeight: Int
@SuppressLint("DiscouragedApi")
get() { get() {
val resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android") val resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android")
return resources.getDimensionPixelSize(resourceId) 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 return (resources.configuration.screenLayout and Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE
} }
@Suppress("DEPRECATION")
val Context.channel: String val Context.channel: String
get() { get() {
try { try {

Loading…
Cancel
Save