Hiyobi file structure changed
This commit is contained in:
@@ -90,7 +90,7 @@ class GalleryBlockAdapter(context: Context, private val galleries: List<GalleryB
|
||||
|
||||
if (visibility == View.GONE) {
|
||||
visibility = View.VISIBLE
|
||||
max = reader.galleryInfo.size
|
||||
max = reader.galleryInfo.files.size
|
||||
}
|
||||
|
||||
if (progress == max) {
|
||||
@@ -160,7 +160,7 @@ class GalleryBlockAdapter(context: Context, private val galleries: List<GalleryB
|
||||
} ?: 0
|
||||
|
||||
with(galleryblock_progressbar) {
|
||||
max = reader.galleryInfo.size
|
||||
max = reader.galleryInfo.files.size
|
||||
progress = count
|
||||
|
||||
visibility = View.VISIBLE
|
||||
|
||||
@@ -52,7 +52,7 @@ class ReaderAdapter(private val context: Context,
|
||||
|
||||
//region Glide.RecyclerView
|
||||
val sizeProvider = ListPreloader.PreloadSizeProvider<File> { _, _, position ->
|
||||
Cache(context).getReaderOrNull(galleryID)?.galleryInfo?.getOrNull(position)?.let {
|
||||
Cache(context).getReaderOrNull(galleryID)?.galleryInfo?.files?.getOrNull(position)?.let {
|
||||
arrayOf(it.width, it.height).toIntArray()
|
||||
}
|
||||
}
|
||||
@@ -114,7 +114,7 @@ class ReaderAdapter(private val context: Context,
|
||||
|
||||
if (!isFullScreen)
|
||||
(holder.view.container.layoutParams as ConstraintLayout.LayoutParams)
|
||||
.dimensionRatio = "${reader!!.galleryInfo[position].width}:${reader!!.galleryInfo[position].height}"
|
||||
.dimensionRatio = "${reader!!.galleryInfo.files[position].width}:${reader!!.galleryInfo.files[position].height}"
|
||||
|
||||
holder.view.reader_index.text = (position+1).toString()
|
||||
|
||||
@@ -161,6 +161,6 @@ class ReaderAdapter(private val context: Context,
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount() = reader?.galleryInfo?.size ?: 0
|
||||
override fun getItemCount() = reader?.galleryInfo?.files?.size ?: 0
|
||||
|
||||
}
|
||||
@@ -263,8 +263,8 @@ class ReaderActivity : AppCompatActivity() {
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
title = reader.title
|
||||
menu?.findItem(R.id.reader_menu_page_indicator)?.title = "$currentPage/${reader.galleryInfo.size}"
|
||||
title = reader.galleryInfo.title
|
||||
menu?.findItem(R.id.reader_menu_page_indicator)?.title = "$currentPage/${reader.galleryInfo.files.size}"
|
||||
|
||||
menu?.findItem(R.id.reader_type)?.icon = ContextCompat.getDrawable(this@ReaderActivity,
|
||||
when (reader.code) {
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.content.Context
|
||||
import android.content.ContextWrapper
|
||||
import android.util.Base64
|
||||
import androidx.preference.PreferenceManager
|
||||
import com.crashlytics.android.Crashlytics
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.async
|
||||
@@ -106,9 +107,11 @@ class Cache(context: Context) : ContextWrapper(context) {
|
||||
var galleryBlock: GalleryBlock? = null
|
||||
|
||||
for (source in sources) {
|
||||
galleryBlock = kotlin.runCatching {
|
||||
galleryBlock = try {
|
||||
source.invoke()
|
||||
}.getOrNull()
|
||||
} catch (e: Exception) {
|
||||
null
|
||||
}
|
||||
|
||||
if (galleryBlock != null)
|
||||
break
|
||||
@@ -158,6 +161,7 @@ class Cache(context: Context) : ContextWrapper(context) {
|
||||
retval = try {
|
||||
source.value.invoke()
|
||||
} catch (e: Exception) {
|
||||
Crashlytics.logException(e)
|
||||
null
|
||||
}
|
||||
|
||||
|
||||
@@ -213,7 +213,7 @@ class DownloadWorker private constructor(context: Context) : ContextWrapper(cont
|
||||
url(
|
||||
urlFromUrlFromHash(
|
||||
galleryID,
|
||||
reader.galleryInfo[index],
|
||||
reader.galleryInfo.files[index],
|
||||
if (lowQuality) "webp" else null
|
||||
)
|
||||
)
|
||||
@@ -251,18 +251,18 @@ class DownloadWorker private constructor(context: Context) : ContextWrapper(cont
|
||||
|
||||
val cache = Cache(this@DownloadWorker).getImages(galleryID)
|
||||
|
||||
progress.put(galleryID, reader.galleryInfo.indices.map { index ->
|
||||
progress.put(galleryID, reader.galleryInfo.files.indices.map { index ->
|
||||
if (cache?.getOrNull(index) != null)
|
||||
Float.POSITIVE_INFINITY
|
||||
else
|
||||
0F
|
||||
}.toMutableList())
|
||||
exception.put(galleryID, reader.galleryInfo.map { null }.toMutableList())
|
||||
exception.put(galleryID, reader.galleryInfo.files.map { null }.toMutableList())
|
||||
|
||||
if (notification[galleryID] == null)
|
||||
initNotification(galleryID)
|
||||
|
||||
notification[galleryID].setContentTitle(reader.title)
|
||||
notification[galleryID].setContentTitle(reader.galleryInfo.title)
|
||||
notify(galleryID)
|
||||
|
||||
if (isCompleted(galleryID)) {
|
||||
@@ -276,7 +276,7 @@ class DownloadWorker private constructor(context: Context) : ContextWrapper(cont
|
||||
return@launch
|
||||
}
|
||||
|
||||
for (i in reader.galleryInfo.indices) {
|
||||
for (i in reader.galleryInfo.files.indices) {
|
||||
val callback = object : Callback {
|
||||
override fun onFailure(call: Call, e: IOException) {
|
||||
if (Fabric.isInitialized() && e.message != "Canceled")
|
||||
|
||||
Reference in New Issue
Block a user