Pupil-25 Add option to download jpg instead of webp files
This commit is contained in:
@@ -19,7 +19,6 @@
|
||||
package xyz.quaver.pupil.ui.dialog
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.AlertDialog
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
@@ -27,6 +26,7 @@ import android.text.TextWatcher
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.ArrayAdapter
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.preference.PreferenceManager
|
||||
import kotlinx.android.synthetic.main.dialog_default_query.view.*
|
||||
import xyz.quaver.pupil.R
|
||||
|
||||
@@ -137,6 +137,8 @@ class SettingsFragment :
|
||||
onPositiveButtonClickListener = { newTags ->
|
||||
sharedPreferences.edit().putString("default_query", newTags.toString()).apply()
|
||||
summary = newTags.toString()
|
||||
dismiss() //This sucks
|
||||
// TODO: make dialog dissmiss itself :P
|
||||
}
|
||||
}.show()
|
||||
}
|
||||
|
||||
@@ -166,6 +166,8 @@ class GalleryDownloader(
|
||||
fun start() {
|
||||
downloadJob = CoroutineScope(Dispatchers.Default).launch {
|
||||
val reader = reader!!.await() ?: return@launch
|
||||
val lowQuality = PreferenceManager.getDefaultSharedPreferences(this@GalleryDownloader)
|
||||
.getBoolean("low_quality", false)
|
||||
|
||||
notificationBuilder.setContentTitle(reader.title)
|
||||
|
||||
@@ -177,15 +179,15 @@ class GalleryDownloader(
|
||||
.setProgress(reader.galleryInfo.size, 0, false)
|
||||
.setContentText("0/${reader.galleryInfo.size}")
|
||||
|
||||
reader.galleryInfo.chunked(4).forEachIndexed { chunkIndex, chunked ->
|
||||
chunked.mapIndexed { i, galleryInfo ->
|
||||
reader.galleryInfo.chunked(4).forEachIndexed { chunkIndex, chunk ->
|
||||
chunk.mapIndexed { i, galleryInfo ->
|
||||
val index = chunkIndex*4+i
|
||||
|
||||
async(Dispatchers.IO) {
|
||||
val url = when(useHiyobi) {
|
||||
true -> createImgList(galleryID, reader)[index].path
|
||||
true -> createImgList(galleryID, reader, lowQuality)[index].path
|
||||
false -> when {
|
||||
(!galleryInfo.hash.isNullOrBlank()) and (galleryInfo.haswebp == 1) ->
|
||||
(!galleryInfo.hash.isNullOrBlank()) && (galleryInfo.haswebp == 1) && lowQuality ->
|
||||
urlFromUrlFromHash(galleryID, galleryInfo, "webp")
|
||||
else ->
|
||||
urlFromUrlFromHash(galleryID, galleryInfo)
|
||||
|
||||
Reference in New Issue
Block a user