diff --git a/app/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java b/app/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java
index d080a626aceb..664d919431a2 100644
--- a/app/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java
+++ b/app/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java
@@ -68,6 +68,7 @@
import java.net.URLEncoder;
import java.util.List;
+import androidx.annotation.DimenRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
@@ -158,9 +159,19 @@ protected Void doInBackground(File... params) {
* @return int
*/
public static int getThumbnailDimension() {
+ return getThumbnailDimension(R.dimen.file_icon_size_grid);
+ }
+
+ /**
+ * Converts size of file icon from dp to pixel
+ * this function is required for custom thumbnail sizes
+ * @param thumbnailDimension dimension to be converted
+ * @return int
+ */
+ public static int getThumbnailDimension(@DimenRes int thumbnailDimension) {
// Converts dp to pixel
Resources r = MainApp.getAppContext().getResources();
- return Math.round(r.getDimension(R.dimen.file_icon_size_grid));
+ return Math.round(r.getDimension(thumbnailDimension));
}
/**
@@ -827,14 +838,25 @@ private enum Type {IMAGE, VIDEO}
private String mImageKey;
private final Context mContext;
private final ViewThemeUtils viewThemeUtils;
+ @DimenRes
+ private final int thumbnailDimension;
+
+ public MediaThumbnailGenerationTask(ImageView imageView,
+ Context context,
+ ViewThemeUtils viewThemeUtils) {
+ this(imageView, context, R.dimen.file_icon_size_grid, viewThemeUtils);
+ }
+ // constructor to generate thumbnails for the requested size
public MediaThumbnailGenerationTask(ImageView imageView,
Context context,
+ @DimenRes int thumbnailDimension,
ViewThemeUtils viewThemeUtils) {
// Use a WeakReference to ensure the ImageView can be garbage collected
mImageViewReference = new WeakReference<>(imageView);
mContext = context;
this.viewThemeUtils = viewThemeUtils;
+ this.thumbnailDimension = thumbnailDimension;
}
@Override
@@ -849,9 +871,9 @@ protected Bitmap doInBackground(Object... params) {
}
if (MimeTypeUtil.isImage(mFile)) {
- thumbnail = doFileInBackground(mFile, Type.IMAGE);
+ thumbnail = doFileInBackground(mFile, Type.IMAGE, thumbnailDimension);
} else if (MimeTypeUtil.isVideo(mFile)) {
- thumbnail = doFileInBackground(mFile, Type.VIDEO);
+ thumbnail = doFileInBackground(mFile, Type.VIDEO, thumbnailDimension);
}
}
} // the app should never break due to a problem with thumbnails
@@ -897,7 +919,7 @@ protected void onPostExecute(Bitmap bitmap) {
}
}
- private Bitmap doFileInBackground(File file, Type type) {
+ private Bitmap doFileInBackground(File file, Type type, @DimenRes int thumbnailDimension) {
final String imageKey;
if (mImageKey != null) {
@@ -913,7 +935,7 @@ private Bitmap doFileInBackground(File file, Type type) {
if (thumbnail == null) {
if (Type.IMAGE == type) {
- int px = getThumbnailDimension();
+ int px = getThumbnailDimension(thumbnailDimension);
Bitmap bitmap = BitmapUtils.decodeSampledBitmapFromFile(file.getAbsolutePath(), px, px);
@@ -939,7 +961,7 @@ private Bitmap doFileInBackground(File file, Type type) {
if (thumbnail != null) {
// Scale down bitmap if too large.
- int px = getThumbnailDimension();
+ int px = getThumbnailDimension(thumbnailDimension);
int width = thumbnail.getWidth();
int height = thumbnail.getHeight();
int max = Math.max(width, height);
diff --git a/app/src/main/java/com/owncloud/android/ui/adapter/SyncedFolderAdapter.kt b/app/src/main/java/com/owncloud/android/ui/adapter/SyncedFolderAdapter.kt
index 215f23f1f4b3..22f4875d23b1 100644
--- a/app/src/main/java/com/owncloud/android/ui/adapter/SyncedFolderAdapter.kt
+++ b/app/src/main/java/com/owncloud/android/ui/adapter/SyncedFolderAdapter.kt
@@ -16,9 +16,9 @@ import android.view.ViewGroup
import android.widget.ImageButton
import android.widget.PopupMenu
import androidx.annotation.VisibleForTesting
+import androidx.core.content.res.ResourcesCompat
import com.afollestad.sectionedrecyclerview.SectionedRecyclerViewAdapter
import com.afollestad.sectionedrecyclerview.SectionedViewHolder
-import com.nextcloud.android.common.ui.theme.utils.ColorRole
import com.nextcloud.client.core.Clock
import com.owncloud.android.R
import com.owncloud.android.databinding.GridSyncItemBinding
@@ -335,6 +335,9 @@ class SyncedFolderAdapter(
MediaThumbnailGenerationTask(
holder.binding.thumbnail,
context,
+ // due to 512dp(NMC) thumb size there was scroll lagging in auto upload
+ // so for auto upload we have to use different thumb size (NMC-2589)
+ R.dimen.auto_upload_file_thumb_size,
viewThemeUtils
)
@@ -439,9 +442,16 @@ class SyncedFolderAdapter(
private fun setSyncButtonActiveIcon(syncStatusButton: ImageButton, enabled: Boolean) {
if (enabled) {
- syncStatusButton.setImageDrawable(
- viewThemeUtils.platform.tintDrawable(context, R.drawable.ic_cloud_sync_on, ColorRole.PRIMARY)
- )
+ // NMC Customization theme color icon
+ val drawable = ResourcesCompat.getDrawable(context.resources, R.drawable.ic_cloud_sync_on, null)
+ drawable?.let {
+ syncStatusButton.setImageDrawable(
+ viewThemeUtils.platform.colorDrawable(
+ it,
+ ResourcesCompat.getColor(context.resources, R.color.primary, null)
+ )
+ )
+ }
} else {
syncStatusButton.setImageResource(R.drawable.ic_cloud_sync_off)
}
diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/parcel/SyncedFolderParcelable.java b/app/src/main/java/com/owncloud/android/ui/dialog/parcel/SyncedFolderParcelable.java
index 320d5e1766f4..6568d1096de2 100644
--- a/app/src/main/java/com/owncloud/android/ui/dialog/parcel/SyncedFolderParcelable.java
+++ b/app/src/main/java/com/owncloud/android/ui/dialog/parcel/SyncedFolderParcelable.java
@@ -127,10 +127,11 @@ public Integer getUploadActionInteger() {
switch (uploadAction) {
case FileUploadWorker.LOCAL_BEHAVIOUR_FORGET:
return 0;
- case FileUploadWorker.LOCAL_BEHAVIOUR_MOVE:
- return 1;
+ // NMC customization: No required move
+ /*case FileUploadWorker.LOCAL_BEHAVIOUR_MOVE:
+ return 1;*/
case FileUploadWorker.LOCAL_BEHAVIOUR_DELETE:
- return 2;
+ return 1;
}
return 0;
}
diff --git a/app/src/main/res/values-sw600dp/dims.xml b/app/src/main/res/values-sw600dp/dims.xml
index 7436d593a3c5..0d67561d21f4 100644
--- a/app/src/main/res/values-sw600dp/dims.xml
+++ b/app/src/main/res/values-sw600dp/dims.xml
@@ -9,4 +9,5 @@
6
512dp
+ 512dp
diff --git a/app/src/main/res/values/dims.xml b/app/src/main/res/values/dims.xml
index 1f6a3f88885b..fbf985ca54e1 100644
--- a/app/src/main/res/values/dims.xml
+++ b/app/src/main/res/values/dims.xml
@@ -131,6 +131,7 @@
24dp
-3dp
80dp
+ 128dp
16sp
18sp
24dp