Change MAL ID search prefix to "id:"
This commit is contained in:
parent
444cefc9a2
commit
8d68859c2a
@ -22,6 +22,8 @@ class MyAnimeList(private val context: Context, id: Int) : TrackService(id) {
|
|||||||
const val DROPPED = 4
|
const val DROPPED = 4
|
||||||
const val PLAN_TO_READ = 6
|
const val PLAN_TO_READ = 6
|
||||||
const val REREADING = 7
|
const val REREADING = 7
|
||||||
|
|
||||||
|
private const val SEARCH_ID_PREFIX = "id:"
|
||||||
}
|
}
|
||||||
|
|
||||||
private val json: Json by injectLazy()
|
private val json: Json by injectLazy()
|
||||||
@ -84,8 +86,8 @@ class MyAnimeList(private val context: Context, id: Int) : TrackService(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun search(query: String): Observable<List<TrackSearch>> {
|
override fun search(query: String): Observable<List<TrackSearch>> {
|
||||||
if (query.startsWith("my:")) {
|
if (query.startsWith(SEARCH_ID_PREFIX)) {
|
||||||
query.substringAfter("my:").toIntOrNull()?.let { id ->
|
query.substringAfter(SEARCH_ID_PREFIX).toIntOrNull()?.let { id ->
|
||||||
return runAsObservable({ listOf(api.getMangaDetails(id)) })
|
return runAsObservable({ listOf(api.getMangaDetails(id)) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user