Remove duplicated default folder icon func from MimeTypeUtil

Signed-off-by: Alper Ozturk <alperozturk@lions-macbook.local>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
Alper Ozturk 2023-10-03 14:51:46 +02:00 committed by alperozturk
parent 3aa9c8aa32
commit 9870a80e87
No known key found for this signature in database
GPG key ID: 4E577DC593B59BDF
5 changed files with 8 additions and 12 deletions

View file

@ -83,6 +83,7 @@ import java.util.List;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import androidx.core.content.ContextCompat;
import androidx.core.content.res.ResourcesCompat; import androidx.core.content.res.ResourcesCompat;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import kotlin.text.Charsets; import kotlin.text.Charsets;
@ -899,8 +900,7 @@ public final class ThumbnailsCacheManager {
} else { } else {
if (mFile != null) { if (mFile != null) {
if (mFile.isDirectory()) { if (mFile.isDirectory()) {
imageView.setImageDrawable(MimeTypeUtil.getDefaultFolderIcon(mContext, imageView.setImageDrawable(ContextCompat.getDrawable(mContext, R.drawable.folder));
viewThemeUtils));
} else { } else {
if (MimeTypeUtil.isVideo(mFile)) { if (MimeTypeUtil.isVideo(mFile)) {
imageView.setImageBitmap(ThumbnailsCacheManager.mDefaultVideo); imageView.setImageBitmap(ThumbnailsCacheManager.mDefaultVideo);

View file

@ -80,6 +80,7 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
/** /**
@ -271,8 +272,7 @@ public class ActivityListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
.into(imageView); .into(imageView);
} else { } else {
if (MimeTypeUtil.isFolder(previewObject.getMimeType())) { if (MimeTypeUtil.isFolder(previewObject.getMimeType())) {
imageView.setImageDrawable(MimeTypeUtil.getDefaultFolderIcon(context, imageView.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.folder));
viewThemeUtils));
} else { } else {
imageView.setImageDrawable(MimeTypeUtil.getFileTypeIcon(previewObject.getMimeType(), imageView.setImageDrawable(MimeTypeUtil.getFileTypeIcon(previewObject.getMimeType(),
"", "",

View file

@ -54,6 +54,7 @@ import java.util.concurrent.Executors;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
/** /**
@ -243,7 +244,7 @@ public class LocalFileListAdapter extends RecyclerView.Adapter<RecyclerView.View
Context context, Context context,
ViewThemeUtils viewThemeUtils) { ViewThemeUtils viewThemeUtils) {
if (file.isDirectory()) { if (file.isDirectory()) {
thumbnailView.setImageDrawable(MimeTypeUtil.getDefaultFolderIcon(context, viewThemeUtils)); thumbnailView.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.folder));
} else { } else {
thumbnailView.setImageResource(R.drawable.file); thumbnailView.setImageResource(R.drawable.file);

View file

@ -48,6 +48,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import static com.owncloud.android.datamodel.OCFile.PATH_SEPARATOR; import static com.owncloud.android.datamodel.OCFile.PATH_SEPARATOR;
@ -219,8 +220,7 @@ public class TrashbinListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
private void setThumbnail(TrashbinFile file, ImageView thumbnailView) { private void setThumbnail(TrashbinFile file, ImageView thumbnailView) {
if (file.isFolder()) { if (file.isFolder()) {
thumbnailView.setImageDrawable(MimeTypeUtil.getDefaultFolderIcon(context, thumbnailView.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.folder));
viewThemeUtils));
} else { } else {
if ((MimeTypeUtil.isImage(file) || MimeTypeUtil.isVideo(file)) && file.getRemoteId() != null) { if ((MimeTypeUtil.isImage(file) || MimeTypeUtil.isVideo(file)) && file.getRemoteId() != null) {
// Thumbnail in cache? // Thumbnail in cache?

View file

@ -134,11 +134,6 @@ public final class MimeTypeUtil {
return determineIconIdByMimeTypeList(possibleMimeTypes); return determineIconIdByMimeTypeList(possibleMimeTypes);
} }
public static Drawable getDefaultFolderIcon(Context context,
ViewThemeUtils viewThemeUtils) {
return ContextCompat.getDrawable(context, R.drawable.folder);
}
/** /**
* Returns a single MIME type of all the possible, by inspection of the file extension, and taking into account the * Returns a single MIME type of all the possible, by inspection of the file extension, and taking into account the
* MIME types known by ownCloud first. * MIME types known by ownCloud first.