39 lines
1.2 KiB
Kotlin
39 lines
1.2 KiB
Kotlin
package eu.kanade.tachiyomi.multisrc.mangasee
|
|
|
|
import android.app.Activity
|
|
import android.content.ActivityNotFoundException
|
|
import android.content.Intent
|
|
import android.os.Bundle
|
|
import android.util.Log
|
|
import kotlin.system.exitProcess
|
|
|
|
/**
|
|
* Springboard that accepts https://mangasee123.com/manga/xxxxxx intents and redirects them to
|
|
* the main Tachiyomi process.
|
|
*/
|
|
class MangaseeUrlActivity : Activity() {
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
super.onCreate(savedInstanceState)
|
|
val pathSegments = intent?.data?.pathSegments
|
|
if (pathSegments != null && pathSegments.size > 1) {
|
|
val id = pathSegments[1]
|
|
val mainIntent = Intent().apply {
|
|
action = "eu.kanade.tachiyomi.SEARCH"
|
|
putExtra("query", "id:$id")
|
|
putExtra("filter", packageName)
|
|
}
|
|
|
|
try {
|
|
startActivity(mainIntent)
|
|
} catch (e: ActivityNotFoundException) {
|
|
Log.e("MangaseeUrlActivity", e.toString())
|
|
}
|
|
} else {
|
|
Log.e("MangaseeUrlActivity", "could not parse uri from intent $intent")
|
|
}
|
|
|
|
finish()
|
|
exitProcess(0)
|
|
}
|
|
}
|