mirror of
https://github.com/gedoor/legado.git
synced 2024-07-06 23:47:49 +08:00
优化
This commit is contained in:
parent
7de46bd1b0
commit
c61b68bd22
@ -17,14 +17,14 @@ object IntentHelp {
|
||||
|
||||
fun getBrowserIntent(uri: Uri): Intent {
|
||||
val intent = Intent(Intent.ACTION_VIEW)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
|
||||
intent.`package` = appCtx.packageName
|
||||
}
|
||||
intent.data = uri
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
if (intent.resolveActivity(appCtx.packageManager) == null) {
|
||||
return Intent.createChooser(intent, "请选择浏览器")
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
|
||||
intent.`package` = appCtx.packageName
|
||||
}
|
||||
return intent
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ import android.content.IntentFilter
|
||||
import android.net.Uri
|
||||
import android.os.Environment
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import io.legado.app.R
|
||||
import io.legado.app.base.BaseService
|
||||
@ -45,9 +46,11 @@ class DownloadService : BaseService() {
|
||||
@SuppressLint("UnspecifiedRegisterReceiverFlag")
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
registerReceiver(
|
||||
ContextCompat.registerReceiver(
|
||||
this,
|
||||
downloadReceiver,
|
||||
IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)
|
||||
IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE),
|
||||
ContextCompat.RECEIVER_EXPORTED
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -409,7 +409,7 @@ class ReadBookActivity : BaseReadBookActivity(),
|
||||
upContent()
|
||||
} else {
|
||||
ReadBook.book?.let {
|
||||
refreshContentDur(it)
|
||||
refreshContentAll(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -445,7 +445,7 @@ class ReadBookActivity : BaseReadBookActivity(),
|
||||
} else {
|
||||
it.removeDelTag(Book.rubyTag)
|
||||
}
|
||||
refreshContentDur(it)
|
||||
refreshContentAll(it)
|
||||
}
|
||||
|
||||
R.id.menu_del_h_tag -> ReadBook.book?.let {
|
||||
@ -455,7 +455,7 @@ class ReadBookActivity : BaseReadBookActivity(),
|
||||
} else {
|
||||
it.removeDelTag(Book.hTag)
|
||||
}
|
||||
refreshContentDur(it)
|
||||
refreshContentAll(it)
|
||||
}
|
||||
|
||||
R.id.menu_page_anim -> showPageAnimConfig {
|
||||
@ -514,10 +514,10 @@ class ReadBookActivity : BaseReadBookActivity(),
|
||||
return super.onCompatOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
private fun refreshContentDur(book: Book) {
|
||||
ReadBook.curTextChapter = null
|
||||
private fun refreshContentAll(book: Book) {
|
||||
ReadBook.clearTextChapter()
|
||||
binding.readView.upContent()
|
||||
viewModel.refreshContentDur(book)
|
||||
viewModel.refreshContentAll(book)
|
||||
}
|
||||
|
||||
override fun onMenuItemClick(item: MenuItem): Boolean {
|
||||
|
Loading…
Reference in New Issue
Block a user