Glimpse: Specify size of the image to load
It allows Coil to avoid caching the whole image for reel viewing Change-Id: I0994848364aea8592325570b8dcfd6fe9efd713b
This commit is contained in:
parent
2bfdb7abb3
commit
de55efce60
|
@ -15,6 +15,7 @@ import androidx.navigation.NavController
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import coil.load
|
||||
import org.lineageos.glimpse.R
|
||||
import org.lineageos.glimpse.ext.*
|
||||
import org.lineageos.glimpse.fragments.AlbumFragment
|
||||
import org.lineageos.glimpse.models.Album
|
||||
|
||||
|
@ -75,6 +76,7 @@ class AlbumThumbnailAdapter(
|
|||
)
|
||||
|
||||
thumbnailImageView.load(album.thumbnail) {
|
||||
size(ThumbnailLayoutManager.MAX_THUMBNAIL_SIZE.px)
|
||||
placeholder(R.drawable.thumbnail_placeholder)
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ import androidx.core.view.isVisible
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import coil.load
|
||||
import org.lineageos.glimpse.R
|
||||
import org.lineageos.glimpse.ext.*
|
||||
import org.lineageos.glimpse.models.Media
|
||||
import org.lineageos.glimpse.models.MediaType
|
||||
import java.time.ZoneId
|
||||
|
@ -192,6 +193,7 @@ class ThumbnailAdapter(
|
|||
this.position = position
|
||||
|
||||
thumbnailImageView.load(media.externalContentUri) {
|
||||
size(ThumbnailLayoutManager.MAX_THUMBNAIL_SIZE.px)
|
||||
placeholder(R.drawable.thumbnail_placeholder)
|
||||
}
|
||||
videoOverlayImageView.isVisible = media.mediaType == MediaType.VIDEO
|
||||
|
|
|
@ -43,7 +43,7 @@ class ThumbnailLayoutManager(
|
|||
/**
|
||||
* Maximum thumbnail size, useful for high density screens.
|
||||
*/
|
||||
private const val MAX_THUMBNAIL_SIZE = 128
|
||||
const val MAX_THUMBNAIL_SIZE = 128
|
||||
|
||||
private enum class Orientation {
|
||||
VERTICAL,
|
||||
|
|
Loading…
Reference in New Issue