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