diff --git a/src/en/tsumino/AndroidManifest.xml b/src/en/tsumino/AndroidManifest.xml
new file mode 100644
index 000000000..578889bb2
--- /dev/null
+++ b/src/en/tsumino/AndroidManifest.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/en/tsumino/build.gradle b/src/en/tsumino/build.gradle
index 0d1fe6cea..cac6ee4b5 100644
--- a/src/en/tsumino/build.gradle
+++ b/src/en/tsumino/build.gradle
@@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: Tsumino'
pkgNameSuffix = 'en.tsumino'
extClass = '.Tsumino'
- extVersionCode = 2
+ extVersionCode = 3
libVersion = '1.2'
}
diff --git a/src/en/tsumino/src/eu/kanade/tachiyomi/extension/en/tsumino/Tsumino.kt b/src/en/tsumino/src/eu/kanade/tachiyomi/extension/en/tsumino/Tsumino.kt
index 3e058cac3..9499dcef0 100644
--- a/src/en/tsumino/src/eu/kanade/tachiyomi/extension/en/tsumino/Tsumino.kt
+++ b/src/en/tsumino/src/eu/kanade/tachiyomi/extension/en/tsumino/Tsumino.kt
@@ -10,6 +10,7 @@ import eu.kanade.tachiyomi.extension.en.tsumino.TsuminoUtils.Companion.getChapte
import eu.kanade.tachiyomi.extension.en.tsumino.TsuminoUtils.Companion.getDesc
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.POST
+import eu.kanade.tachiyomi.network.asObservableSuccess
import eu.kanade.tachiyomi.source.model.*
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
import eu.kanade.tachiyomi.util.asJsoup
@@ -19,6 +20,7 @@ import okhttp3.Request
import okhttp3.Response
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
+import rx.Observable
class Tsumino: ParsedHttpSource() {
@@ -102,6 +104,25 @@ class Tsumino: ParsedHttpSource() {
return POST("$baseUrl/Search/Operate/", headers, body)
}
+ private fun searchMangaByIdRequest(id: String) = GET("$baseUrl/entry/$id", headers)
+
+ private fun searchMangaByIdParse(response: Response, id: String): MangasPage {
+ val details = mangaDetailsParse(response)
+ details.url = "/entry/$id"
+ return MangasPage(listOf(details), false)
+ }
+
+ override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable {
+ return if (query.startsWith(PREFIX_ID_SEARCH)) {
+ val id = query.removePrefix(PREFIX_ID_SEARCH)
+ client.newCall(searchMangaByIdRequest(id))
+ .asObservableSuccess()
+ .map { response -> searchMangaByIdParse(response, id) }
+ } else {
+ super.fetchSearchManga(page, query, filters)
+ }
+ }
+
override fun searchMangaParse(response: Response): MangasPage = latestUpdatesParse(response)
override fun searchMangaSelector() = latestUpdatesSelector()
@@ -214,6 +235,7 @@ class Tsumino: ParsedHttpSource() {
class ExcludeParodiesFilter : Filter.CheckBox("Exclude parodies")
enum class SortType {
+ Popularity,
Newest,
Oldest,
Alphabetical,
@@ -222,7 +244,6 @@ class Tsumino: ParsedHttpSource() {
Views,
Random,
Comments,
- Popularity
}
enum class LengthType(val id: Int) {
@@ -232,4 +253,7 @@ class Tsumino: ParsedHttpSource() {
Long(3)
}
+ companion object {
+ const val PREFIX_ID_SEARCH = "id:"
+ }
}
diff --git a/src/en/tsumino/src/eu/kanade/tachiyomi/extension/en/tsumino/TsuminoUrlActivity.kt b/src/en/tsumino/src/eu/kanade/tachiyomi/extension/en/tsumino/TsuminoUrlActivity.kt
new file mode 100644
index 000000000..247de0a68
--- /dev/null
+++ b/src/en/tsumino/src/eu/kanade/tachiyomi/extension/en/tsumino/TsuminoUrlActivity.kt
@@ -0,0 +1,38 @@
+package eu.kanade.tachiyomi.extension.en.tsumino
+
+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://www.tsumino.com/entry/xxxxx intents and redirects them to
+ * the main Tachiyomi process.
+ */
+class TsuminoUrlActivity : 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", "${Tsumino.PREFIX_ID_SEARCH}$id")
+ putExtra("filter", packageName)
+ }
+
+ try {
+ startActivity(mainIntent)
+ } catch (e: ActivityNotFoundException) {
+ Log.e("TsuminoUrlActivity", e.toString())
+ }
+ } else {
+ Log.e("TsuminoUrlActivity", "could not parse uri from intent $intent")
+ }
+
+ finish()
+ exitProcess(0)
+ }
+}