Fixed extensions notifcation action

This commit is contained in:
Jay 2020-03-25 00:48:24 -04:00
parent d361f41b35
commit 719aa751b8
2 changed files with 13 additions and 25 deletions

View File

@ -31,7 +31,6 @@ import com.bluelinelabs.conductor.ControllerChangeHandler
import com.bluelinelabs.conductor.Router import com.bluelinelabs.conductor.Router
import com.bluelinelabs.conductor.RouterTransaction import com.bluelinelabs.conductor.RouterTransaction
import com.bluelinelabs.conductor.changehandler.FadeChangeHandler import com.bluelinelabs.conductor.changehandler.FadeChangeHandler
import com.bluelinelabs.conductor.changehandler.SimpleSwapChangeHandler
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import eu.kanade.tachiyomi.BuildConfig import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.Migrations import eu.kanade.tachiyomi.Migrations
@ -62,9 +61,6 @@ import eu.kanade.tachiyomi.util.system.launchUI
import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets
import eu.kanade.tachiyomi.util.view.updateLayoutParams import eu.kanade.tachiyomi.util.view.updateLayoutParams
import eu.kanade.tachiyomi.util.view.updatePadding import eu.kanade.tachiyomi.util.view.updatePadding
import java.util.Date
import java.util.concurrent.TimeUnit
import kotlin.math.abs
import kotlinx.android.synthetic.main.main_activity.* import kotlinx.android.synthetic.main.main_activity.*
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
@ -72,6 +68,9 @@ import kotlinx.coroutines.delay
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import timber.log.Timber import timber.log.Timber
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
import java.util.Date
import java.util.concurrent.TimeUnit
import kotlin.math.abs
open class MainActivity : BaseActivity(), DownloadServiceListener { open class MainActivity : BaseActivity(), DownloadServiceListener {
@ -394,36 +393,25 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
} }
SHORTCUT_CATALOGUES -> bottom_nav.selectedItemId = R.id.nav_catalogues SHORTCUT_CATALOGUES -> bottom_nav.selectedItemId = R.id.nav_catalogues
SHORTCUT_EXTENSIONS -> { SHORTCUT_EXTENSIONS -> {
if (router.backstack.isEmpty()) {
bottom_nav.selectedItemId = R.id.nav_catalogues bottom_nav.selectedItemId = R.id.nav_catalogues
router.popToRoot()
bottom_nav.post { bottom_nav.post {
val controller = val controller =
router.backstack.firstOrNull()?.controller() as? CatalogueController router.backstack.firstOrNull()?.controller() as? CatalogueController
controller?.showExtensions() controller?.showExtensions()
} }
} }
}
SHORTCUT_MANGA -> { SHORTCUT_MANGA -> {
val extras = intent.extras ?: return false val extras = intent.extras ?: return false
if (router.backstack.isEmpty()) { if (router.backstack.isEmpty()) bottom_nav.selectedItemId = R.id.nav_library
bottom_nav.selectedItemId = R.id.nav_library
}
router.pushController(MangaDetailsController(extras).withFadeTransaction()) router.pushController(MangaDetailsController(extras).withFadeTransaction())
} }
SHORTCUT_DOWNLOADS -> { SHORTCUT_DOWNLOADS -> {
if (router.backstack.none { it.controller() is DownloadController }) { if (router.backstack.none { it.controller() is DownloadController }) {
if (router.backstack.isEmpty()) { if (router.backstack.isEmpty()) bottom_nav.selectedItemId = R.id.nav_library
bottom_nav.selectedItemId = R.id.nav_library
router.pushController(
RouterTransaction.with(DownloadController())
.pushChangeHandler(SimpleSwapChangeHandler())
.popChangeHandler(FadeChangeHandler())
)
} else {
router.pushController(DownloadController().withFadeTransaction()) router.pushController(DownloadController().withFadeTransaction())
} }
} }
}
Intent.ACTION_SEARCH, "com.google.android.gms.actions.SEARCH_ACTION" -> { Intent.ACTION_SEARCH, "com.google.android.gms.actions.SEARCH_ACTION" -> {
// If the intent match the "standard" Android search intent // If the intent match the "standard" Android search intent
// or the Google-specific search intent (triggered by saying or typing "search *query* on *Tachiyomi*" in Google Search/Google Assistant) // or the Google-specific search intent (triggered by saying or typing "search *query* on *Tachiyomi*" in Google Search/Google Assistant)

View File

@ -24,8 +24,8 @@ import eu.kanade.tachiyomi.util.view.invisible
import eu.kanade.tachiyomi.util.view.updateLayoutParams import eu.kanade.tachiyomi.util.view.updateLayoutParams
import eu.kanade.tachiyomi.util.view.visible import eu.kanade.tachiyomi.util.view.visible
import eu.kanade.tachiyomi.util.view.visibleIf import eu.kanade.tachiyomi.util.view.visibleIf
import kotlinx.android.synthetic.main.manga_header_item.*
import java.util.Locale import java.util.Locale
import kotlinx.android.synthetic.main.manga_header_item.*
class MangaHeaderHolder( class MangaHeaderHolder(
private val view: View, private val view: View,