Skip to content

Commit

Permalink
Increase spaces thumbnails to support different screen sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
abelgardep committed Jan 13, 2023
1 parent 6a82970 commit 3aa2dfd
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,14 @@ private Bitmap doFileInBackground() {
}

private String getSpaceSpecialUri(SpaceSpecial spaceSpecial) {
// Converts dp to pixel
Resources r = MainApp.Companion.getAppContext().getResources();
Integer spacesThumbnailSize = Math.round(r.getDimension(R.dimen.spaces_thumbnail_height)) * 2;
return String.format(Locale.ROOT,
SPACE_SPECIAL_URI,
spaceSpecial.getWebDavUrl(),
getThumbnailDimension(),
getThumbnailDimension(),
spacesThumbnailSize,
spacesThumbnailSize,
spaceSpecial.getETag());
}

Expand All @@ -373,7 +376,7 @@ private Bitmap doSpaceImageInBackground() {
Bitmap thumbnail = getBitmapFromDiskCache(imageKey);

// Not found in disk cache
if (thumbnail == null) { // TODO: Check if the current thumbnail is outdated
if (thumbnail == null) {
int px = getThumbnailDimension();

// Download thumbnail from server
Expand Down
2 changes: 1 addition & 1 deletion owncloudApp/src/main/res/layout/spaces_list_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<ImageView
android:id="@+id/spaces_list_item_image"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_height="@dimen/spaces_thumbnail_height"
android:scaleType="center"
android:src="@drawable/ic_spaces" />

Expand Down
5 changes: 4 additions & 1 deletion owncloudApp/src/main/res/values-h640dp/dims.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,7 @@
<dimen name="passcode_margin_top">50dp</dimen>
<dimen name="passcode_margin_bottom">16dp</dimen>
<dimen name="passcode_margin_buttons">8dp</dimen>
</resources>

<!-- Spaces -->
<dimen name="spaces_thumbnail_height">192dp</dimen>
</resources>
5 changes: 4 additions & 1 deletion owncloudApp/src/main/res/values-h740dp/dims.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,7 @@
<dimen name="passcode_margin_top">100dp</dimen>
<dimen name="passcode_margin_bottom">32dp</dimen>
<dimen name="passcode_margin_buttons">8dp</dimen>
</resources>

<!-- Spaces -->
<dimen name="spaces_thumbnail_height">256dp</dimen>
</resources>
6 changes: 4 additions & 2 deletions owncloudApp/src/main/res/values/dims.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
ownCloud Android client application
Copyright (C) 2020 ownCloud GmbH.
Expand Down Expand Up @@ -77,4 +76,7 @@
<dimen name="passcode_margin_top">24dp</dimen>
<dimen name="passcode_margin_bottom">6dp</dimen>
<dimen name="passcode_margin_buttons">4dp</dimen>

<!-- Spaces -->
<dimen name="spaces_thumbnail_height">156dp</dimen>
</resources>

0 comments on commit 3aa2dfd

Please sign in to comment.