mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-16 14:07:28 +01:00
Minor cleanup
This commit is contained in:
@@ -138,9 +138,10 @@ class MainActivity : BaseActivity() {
|
||||
|
||||
private fun handleIntentAction(intent: Intent): Boolean {
|
||||
val notificationId = intent.getIntExtra("notificationId", -1)
|
||||
if (notificationId > -1) NotificationReceiver.dismissNotification(
|
||||
applicationContext, notificationId, intent.getIntExtra("groupId", 0)
|
||||
)
|
||||
if (notificationId > -1) {
|
||||
NotificationReceiver.dismissNotification(applicationContext, notificationId, intent.getIntExtra("groupId", 0))
|
||||
}
|
||||
|
||||
when (intent.action) {
|
||||
SHORTCUT_LIBRARY -> setSelectedDrawerItem(R.id.nav_drawer_library)
|
||||
SHORTCUT_RECENTLY_UPDATED -> setSelectedDrawerItem(R.id.nav_drawer_recent_updates)
|
||||
|
||||
@@ -106,15 +106,14 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
|
||||
const val VERTICAL = 3
|
||||
const val WEBTOON = 4
|
||||
|
||||
fun newIntent(context: Context, manga: Manga, chapter: Chapter):
|
||||
Intent {
|
||||
val intent = Intent(context, ReaderActivity::class.java)
|
||||
intent.putExtra("manga", manga.id)
|
||||
intent.putExtra("chapter", chapter.id)
|
||||
// chapters just added from library updates don't have an id yet
|
||||
intent.putExtra("chapterUrl", chapter.url)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
return intent
|
||||
fun newIntent(context: Context, manga: Manga, chapter: Chapter): Intent {
|
||||
return Intent(context, ReaderActivity::class.java).apply {
|
||||
putExtra("manga", manga.id)
|
||||
putExtra("chapter", chapter.id)
|
||||
// chapters just added from library updates don't have an id yet
|
||||
putExtra("chapterUrl", chapter.url)
|
||||
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -191,11 +191,13 @@ class ReaderPresenter(
|
||||
*/
|
||||
fun init(mangaId: Long, chapterUrl: String) {
|
||||
if (!needsInit()) return
|
||||
|
||||
val context = Injekt.get<Application>()
|
||||
val db = DatabaseHelper(context)
|
||||
val chapterId = db.getChapter(chapterUrl, mangaId).executeAsBlocking()?.id
|
||||
if (chapterId != null)
|
||||
if (chapterId != null) {
|
||||
init(mangaId, chapterId)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user