Skip to content

Commit

Permalink
enable full span view only if load large preview, fix #92
Browse files Browse the repository at this point in the history
  • Loading branch information
ultranity committed Dec 6, 2024
1 parent e82b396 commit ff2fa14
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions app/src/main/java/com/perol/asdpl/pixivez/core/PicListAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.perol.asdpl.pixivez.core
import android.annotation.SuppressLint
import android.app.Activity
import android.app.ActivityOptions
import android.content.res.Configuration.ORIENTATION_LANDSCAPE
import android.graphics.drawable.ColorDrawable
import android.graphics.drawable.Drawable
import android.os.Bundle
Expand All @@ -22,6 +23,7 @@ import com.bumptech.glide.request.transition.Transition
import com.chad.brvah.viewholder.BaseViewHolder
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.perol.asdpl.pixivez.R
import com.perol.asdpl.pixivez.base.KotlinUtil.Int
import com.perol.asdpl.pixivez.base.KotlinUtil.alsoIf
import com.perol.asdpl.pixivez.base.LBaseQuickAdapter
import com.perol.asdpl.pixivez.base.UtilFunc.compute
Expand Down Expand Up @@ -328,9 +330,15 @@ abstract class PicListAdapter(
return
}
showItemView(holder.itemView)
// if (!context.resources.configuration.orientation==ORIENTATION_LANDSCAPE)
val needSmall = if (quality == 1) {
(1.0 * item.height / item.width > 3) || (1.0 * item.width / item.height > 4)
} else {
item.height > 1800
}
val needFullSpan = !needSmall and ((1.0 * item.width / item.height) >
((context.resources.configuration.orientation == ORIENTATION_LANDSCAPE).Int() * 2 + 2.1))
if (!blockedFlag[pos])
setFullSpan(holder, (1.0 * item.width / item.height > 2.1))
setFullSpan(holder, needFullSpan)

val numLayout = holder.getView<TextView>(R.id.textview_num)
if (item.type == "ugoira") {
Expand Down Expand Up @@ -359,11 +367,6 @@ abstract class PicListAdapter(

// Load Images
mainImage.setTag(R.id.tag_first, item.meta[0].medium)
val needSmall = if (quality == 1) {
(1.0 * item.height / item.width > 3) || (item.width / item.height > 4)
} else {
item.height > 1800
}
val loadUrl = if (needSmall) {
item.meta[0].square_medium
} else {
Expand Down

0 comments on commit ff2fa14

Please sign in to comment.