diff --git a/src/en/hentainexus/AndroidManifest.xml b/src/en/hentainexus/AndroidManifest.xml
new file mode 100644
index 000000000..8a9a4a062
--- /dev/null
+++ b/src/en/hentainexus/AndroidManifest.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/en/hentainexus/build.gradle b/src/en/hentainexus/build.gradle
index c22850f7e..218e0b46b 100644
--- a/src/en/hentainexus/build.gradle
+++ b/src/en/hentainexus/build.gradle
@@ -5,7 +5,7 @@ ext {
extName = 'HentaiNexus'
pkgNameSuffix = 'en.hentainexus'
extClass = '.HentaiNexus'
- extVersionCode = 2
+ extVersionCode = 3
libVersion = '1.2'
containsNsfw = true
}
diff --git a/src/en/hentainexus/src/eu/kanade/tachiyomi/extension/en/hentainexus/HentaiNexus.kt b/src/en/hentainexus/src/eu/kanade/tachiyomi/extension/en/hentainexus/HentaiNexus.kt
index 7f85b3b1d..88fb18a21 100644
--- a/src/en/hentainexus/src/eu/kanade/tachiyomi/extension/en/hentainexus/HentaiNexus.kt
+++ b/src/en/hentainexus/src/eu/kanade/tachiyomi/extension/en/hentainexus/HentaiNexus.kt
@@ -2,8 +2,10 @@ package eu.kanade.tachiyomi.extension.en.hentainexus
import eu.kanade.tachiyomi.annotations.Nsfw
import eu.kanade.tachiyomi.network.GET
+import eu.kanade.tachiyomi.network.asObservableSuccess
import eu.kanade.tachiyomi.source.model.Filter
import eu.kanade.tachiyomi.source.model.FilterList
+import eu.kanade.tachiyomi.source.model.MangasPage
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
@@ -12,6 +14,7 @@ import okhttp3.OkHttpClient
import okhttp3.Request
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
+import rx.Observable
import java.net.URLEncoder
@Nsfw
@@ -92,6 +95,16 @@ class HentaiNexus : ParsedHttpSource() {
return GET(if (queryString != null) "$builtUrl?$queryString" else builtUrl)
}
+ 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(GET("$baseUrl/view/$id", headers)).asObservableSuccess()
+ .map { MangasPage(listOf(mangaDetailsParse(it).apply { url = "/view/$id" }), false) }
+ } else {
+ super.fetchSearchManga(page, query, filters)
+ }
+ }
+
override fun searchMangaSelector() = latestUpdatesSelector()
override fun searchMangaFromElement(element: Element) = latestUpdatesFromElement(element)
@@ -199,6 +212,10 @@ class HentaiNexus : ParsedHttpSource() {
class ArtistFilter : Filter.Text("Search by Artist (must be exact match)")
class TagFilter : Filter.Text("Search by Tag (must be exact match)")
+
+ companion object {
+ const val PREFIX_ID_SEARCH = "id:"
+ }
}
private inline fun Iterable<*>.findInstance() = find { it is T } as? T
diff --git a/src/en/hentainexus/src/eu/kanade/tachiyomi/extension/en/hentainexus/HentaiNexusActivity.kt b/src/en/hentainexus/src/eu/kanade/tachiyomi/extension/en/hentainexus/HentaiNexusActivity.kt
new file mode 100644
index 000000000..5ef34cb8b
--- /dev/null
+++ b/src/en/hentainexus/src/eu/kanade/tachiyomi/extension/en/hentainexus/HentaiNexusActivity.kt
@@ -0,0 +1,38 @@
+package eu.kanade.tachiyomi.extension.en.hentainexus
+
+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://hentainexus.com/view/xxxx intents
+ * and redirects them to the main Tachiyomi process.
+ */
+class HentaiNexusActivity : 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", "${HentaiNexus.PREFIX_ID_SEARCH}$id")
+ putExtra("filter", packageName)
+ }
+
+ try {
+ startActivity(mainIntent)
+ } catch (e: ActivityNotFoundException) {
+ Log.e("HentaiNexusActivity", e.toString())
+ }
+ } else {
+ Log.e("HentaiNexusActivity", "Could not parse URI from intent $intent")
+ }
+
+ finish()
+ exitProcess(0)
+ }
+}