This commit is contained in:
tom5079
2020-12-04 01:09:22 +09:00
parent 730a3baedc
commit 521f3ad809
3 changed files with 23 additions and 4 deletions

View File

@@ -20,11 +20,11 @@ package xyz.quaver.pupil.sources
import android.view.LayoutInflater
import android.widget.TextView
import androidx.core.content.ContextCompat
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel
import kotlinx.parcelize.IgnoredOnParcel
import kotlinx.parcelize.Parcelize
import okhttp3.Request
import xyz.quaver.floatingsearchview.databinding.SearchSuggestionItemBinding
import xyz.quaver.floatingsearchview.suggestions.model.SearchSuggestion
import xyz.quaver.hitomi.*
@@ -98,6 +98,18 @@ class Hitomi : Source<Hitomi.SortMode, Hitomi.TagSuggestion>() {
return Pair(channel, cache.size)
}
override suspend fun images(id: String): List<Request.Builder> {
val galleryID = id.toInt()
val reader = getGalleryInfo(galleryID)
return reader.files.map {
Request.Builder()
.url(imageUrlFromImage(galleryID, it, true))
.header("Referer", getReferer(galleryID))
}
}
override suspend fun suggestion(query: String) : List<TagSuggestion> {
return getSuggestionsForQuery(query.takeLastWhile { !it.isWhitespace() }).map {
TagSuggestion(it)