Skip to content

Commit

Permalink
Simplify image url
Browse files Browse the repository at this point in the history
Signed-off-by: alperozturk <[email protected]>
  • Loading branch information
alperozturk96 committed Nov 3, 2023
1 parent 27939b8 commit 0f4759f
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class GalleryRowHolder(
@Suppress("DEPRECATION")
private val baseUri = client.getClientFor(user.toOwnCloudAccount(), context).baseUri
private val previewLink = "/index.php/core/preview.png?file="
private val imageDownloadWidth = "&x=$defaultThumbnailSize"
private val imageDownloadHeight = "&y=$defaultThumbnailSize"
private val mode = "&a=1&mode=cover&forceIcon=0"

interface GalleryRowItemClick {
Expand All @@ -80,15 +82,13 @@ class GalleryRowHolder(
row.files.forEach { file ->
val thumbnail = ImageView(context)

val imageUrl: String = (
(
(
baseUri.toString() + previewLink +
URLEncoder.encode(file.remotePath, Charsets.UTF_8.name()) +
"&x=" + (defaultThumbnailSize)
) + "&y=" + (defaultThumbnailSize)
) + mode
)
val imageUrl: String =
baseUri.toString() +
previewLink +
URLEncoder.encode(file.remotePath, Charsets.UTF_8.name()) +
imageDownloadWidth +
imageDownloadHeight +
mode

Glide
.with(context)
Expand Down Expand Up @@ -177,12 +177,15 @@ class GalleryRowHolder(
2 -> {
c = 5 / 2f
}

3 -> {
c = 4 / 3f
}

4 -> {
c = 4 / 5f
}

5 -> {
c = 1f
}
Expand Down

0 comments on commit 0f4759f

Please sign in to comment.