mirror of
https://github.com/nextcloud/android.git
synced 2024-11-22 05:05:31 +03:00
Migrate primate drawable tinting
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
35fb67f0a6
commit
6bf79d5a5f
32 changed files with 144 additions and 155 deletions
|
@ -355,7 +355,7 @@ dependencies {
|
||||||
gplayImplementation "com.google.firebase:firebase-messaging:23.0.7"
|
gplayImplementation "com.google.firebase:firebase-messaging:23.0.7"
|
||||||
|
|
||||||
// TODO change back to tag before merging
|
// TODO change back to tag before merging
|
||||||
implementation 'com.github.nextcloud.android-common:ui:b2103712a1'
|
implementation 'com.github.nextcloud.android-common:ui:2c8987f0f2'
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations.all {
|
configurations.all {
|
||||||
|
|
|
@ -65,8 +65,7 @@ import com.owncloud.android.utils.BitmapUtils;
|
||||||
import com.owncloud.android.utils.DisplayUtils.AvatarGenerationListener;
|
import com.owncloud.android.utils.DisplayUtils.AvatarGenerationListener;
|
||||||
import com.owncloud.android.utils.FileStorageUtils;
|
import com.owncloud.android.utils.FileStorageUtils;
|
||||||
import com.owncloud.android.utils.MimeTypeUtil;
|
import com.owncloud.android.utils.MimeTypeUtil;
|
||||||
import com.owncloud.android.utils.theme.ThemeColorUtils;
|
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
|
||||||
import com.owncloud.android.utils.theme.ThemeDrawableUtils;
|
|
||||||
|
|
||||||
import org.apache.commons.httpclient.HttpStatus;
|
import org.apache.commons.httpclient.HttpStatus;
|
||||||
import org.apache.commons.httpclient.methods.GetMethod;
|
import org.apache.commons.httpclient.methods.GetMethod;
|
||||||
|
@ -757,18 +756,15 @@ public final class ThumbnailsCacheManager {
|
||||||
private File mFile;
|
private File mFile;
|
||||||
private String mImageKey;
|
private String mImageKey;
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final ThemeColorUtils themeColorUtils;
|
private final ViewThemeUtils viewThemeUtils;
|
||||||
private final ThemeDrawableUtils themeDrawableUtils;
|
|
||||||
|
|
||||||
public MediaThumbnailGenerationTask(ImageView imageView,
|
public MediaThumbnailGenerationTask(ImageView imageView,
|
||||||
Context context,
|
Context context,
|
||||||
ThemeColorUtils themeColorUtils,
|
ViewThemeUtils viewThemeUtils) {
|
||||||
ThemeDrawableUtils themeDrawableUtils) {
|
|
||||||
// Use a WeakReference to ensure the ImageView can be garbage collected
|
// Use a WeakReference to ensure the ImageView can be garbage collected
|
||||||
mImageViewReference = new WeakReference<>(imageView);
|
mImageViewReference = new WeakReference<>(imageView);
|
||||||
mContext = context;
|
mContext = context;
|
||||||
this.themeColorUtils = themeColorUtils;
|
this.viewThemeUtils = viewThemeUtils;
|
||||||
this.themeDrawableUtils = themeDrawableUtils;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -816,8 +812,7 @@ public final class ThumbnailsCacheManager {
|
||||||
if (mFile != null) {
|
if (mFile != null) {
|
||||||
if (mFile.isDirectory()) {
|
if (mFile.isDirectory()) {
|
||||||
imageView.setImageDrawable(MimeTypeUtil.getDefaultFolderIcon(mContext,
|
imageView.setImageDrawable(MimeTypeUtil.getDefaultFolderIcon(mContext,
|
||||||
themeColorUtils,
|
viewThemeUtils));
|
||||||
themeDrawableUtils));
|
|
||||||
} else {
|
} else {
|
||||||
if (MimeTypeUtil.isVideo(mFile)) {
|
if (MimeTypeUtil.isVideo(mFile)) {
|
||||||
imageView.setImageBitmap(ThumbnailsCacheManager.mDefaultVideo);
|
imageView.setImageBitmap(ThumbnailsCacheManager.mDefaultVideo);
|
||||||
|
@ -825,8 +820,7 @@ public final class ThumbnailsCacheManager {
|
||||||
imageView.setImageDrawable(MimeTypeUtil.getFileTypeIcon(null,
|
imageView.setImageDrawable(MimeTypeUtil.getFileTypeIcon(null,
|
||||||
mFile.getName(),
|
mFile.getName(),
|
||||||
mContext,
|
mContext,
|
||||||
themeColorUtils,
|
viewThemeUtils));
|
||||||
themeDrawableUtils));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,8 +116,7 @@ public class ActivitiesActivity extends DrawerActivity implements ActivityListIn
|
||||||
this,
|
this,
|
||||||
clientFactory,
|
clientFactory,
|
||||||
false,
|
false,
|
||||||
themeColorUtils,
|
viewThemeUtils);
|
||||||
themeDrawableUtils);
|
|
||||||
binding.list.setAdapter(adapter);
|
binding.list.setAdapter(adapter);
|
||||||
|
|
||||||
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
|
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
|
||||||
|
|
|
@ -43,6 +43,7 @@ import com.owncloud.android.datamodel.OCFile;
|
||||||
import com.owncloud.android.datamodel.ThumbnailsCacheManager;
|
import com.owncloud.android.datamodel.ThumbnailsCacheManager;
|
||||||
import com.owncloud.android.utils.DisplayUtils;
|
import com.owncloud.android.utils.DisplayUtils;
|
||||||
import com.owncloud.android.utils.MimeTypeUtil;
|
import com.owncloud.android.utils.MimeTypeUtil;
|
||||||
|
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
|
||||||
|
|
||||||
public abstract class EditorWebView extends ExternalSiteWebView {
|
public abstract class EditorWebView extends ExternalSiteWebView {
|
||||||
protected Snackbar loadingSnackbar;
|
protected Snackbar loadingSnackbar;
|
||||||
|
@ -159,8 +160,7 @@ public abstract class EditorWebView extends ExternalSiteWebView {
|
||||||
file.isGroupFolder(),
|
file.isGroupFolder(),
|
||||||
file.getMountType(),
|
file.getMountType(),
|
||||||
this,
|
this,
|
||||||
themeColorUtils,
|
viewThemeUtils));
|
||||||
themeDrawableUtils));
|
|
||||||
} 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?
|
||||||
|
@ -184,8 +184,7 @@ public abstract class EditorWebView extends ExternalSiteWebView {
|
||||||
file.getFileName(),
|
file.getFileName(),
|
||||||
user,
|
user,
|
||||||
getApplicationContext(),
|
getApplicationContext(),
|
||||||
themeColorUtils,
|
viewThemeUtils);
|
||||||
themeDrawableUtils);
|
|
||||||
binding.thumbnail.setImageDrawable(icon);
|
binding.thumbnail.setImageDrawable(icon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -769,8 +769,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
||||||
new int[]{R.id.filename},
|
new int[]{R.id.filename},
|
||||||
getStorageManager(),
|
getStorageManager(),
|
||||||
getUser().get(),
|
getUser().get(),
|
||||||
themeColorUtils,
|
viewThemeUtils);
|
||||||
themeDrawableUtils);
|
|
||||||
|
|
||||||
binding.list.setAdapter(sa);
|
binding.list.setAdapter(sa);
|
||||||
}
|
}
|
||||||
|
|
|
@ -760,7 +760,7 @@ public class SettingsActivity extends ThemedPreferenceActivity
|
||||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||||
actionBar.setDisplayShowTitleEnabled(true);
|
actionBar.setDisplayShowTitleEnabled(true);
|
||||||
if (this.getResources() != null) {
|
if (this.getResources() != null) {
|
||||||
viewThemeUtils.material.themeActionBar(this,
|
viewThemeUtils.androidx.themeActionBar(this,
|
||||||
actionBar,
|
actionBar,
|
||||||
getString(R.string.actionbar_settings),
|
getString(R.string.actionbar_settings),
|
||||||
ResourcesCompat.getDrawable(this.getResources(),
|
ResourcesCompat.getDrawable(this.getResources(),
|
||||||
|
|
|
@ -43,6 +43,7 @@ import com.owncloud.android.ui.fragment.FileDetailSharingFragment;
|
||||||
import com.owncloud.android.ui.fragment.FileDetailsSharingProcessFragment;
|
import com.owncloud.android.ui.fragment.FileDetailsSharingProcessFragment;
|
||||||
import com.owncloud.android.utils.DisplayUtils;
|
import com.owncloud.android.utils.DisplayUtils;
|
||||||
import com.owncloud.android.utils.MimeTypeUtil;
|
import com.owncloud.android.utils.MimeTypeUtil;
|
||||||
|
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
|
||||||
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
@ -79,15 +80,13 @@ public class ShareActivity extends FileActivity {
|
||||||
file.isGroupFolder(),
|
file.isGroupFolder(),
|
||||||
file.getMountType(),
|
file.getMountType(),
|
||||||
this,
|
this,
|
||||||
themeColorUtils,
|
viewThemeUtils));
|
||||||
themeDrawableUtils));
|
|
||||||
} else {
|
} else {
|
||||||
binding.shareFileIcon.setImageDrawable(MimeTypeUtil.getFileTypeIcon(file.getMimeType(),
|
binding.shareFileIcon.setImageDrawable(MimeTypeUtil.getFileTypeIcon(file.getMimeType(),
|
||||||
file.getFileName(),
|
file.getFileName(),
|
||||||
optionalUser.get(),
|
optionalUser.get(),
|
||||||
this,
|
this,
|
||||||
themeColorUtils,
|
viewThemeUtils));
|
||||||
themeDrawableUtils));
|
|
||||||
if (MimeTypeUtil.isImage(file)) {
|
if (MimeTypeUtil.isImage(file)) {
|
||||||
String remoteId = String.valueOf(file.getRemoteId());
|
String remoteId = String.valueOf(file.getRemoteId());
|
||||||
Bitmap thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache(remoteId);
|
Bitmap thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache(remoteId);
|
||||||
|
|
|
@ -252,7 +252,16 @@ class SyncedFoldersActivity :
|
||||||
private fun setupContent() {
|
private fun setupContent() {
|
||||||
val gridWidth = resources.getInteger(R.integer.media_grid_width)
|
val gridWidth = resources.getInteger(R.integer.media_grid_width)
|
||||||
val lightVersion = resources.getBoolean(R.bool.syncedFolder_light)
|
val lightVersion = resources.getBoolean(R.bool.syncedFolder_light)
|
||||||
adapter = SyncedFolderAdapter(this, clock, gridWidth, this, lightVersion, themeColorUtils, themeDrawableUtils)
|
adapter = SyncedFolderAdapter(
|
||||||
|
this,
|
||||||
|
clock,
|
||||||
|
gridWidth,
|
||||||
|
this,
|
||||||
|
lightVersion,
|
||||||
|
themeColorUtils,
|
||||||
|
themeDrawableUtils,
|
||||||
|
viewThemeUtils
|
||||||
|
)
|
||||||
syncedFolderProvider = SyncedFolderProvider(contentResolver, preferences, clock)
|
syncedFolderProvider = SyncedFolderProvider(contentResolver, preferences, clock)
|
||||||
binding.emptyList.emptyListIcon.setImageResource(R.drawable.nav_synced_folders)
|
binding.emptyList.emptyListIcon.setImageResource(R.drawable.nav_synced_folders)
|
||||||
viewThemeUtils.material.colorMaterialButtonPrimaryFilled(binding.emptyList.emptyListViewAction)
|
viewThemeUtils.material.colorMaterialButtonPrimaryFilled(binding.emptyList.emptyListViewAction)
|
||||||
|
|
|
@ -42,6 +42,7 @@ import com.owncloud.android.ui.interfaces.VersionListInterface;
|
||||||
import com.owncloud.android.utils.DisplayUtils;
|
import com.owncloud.android.utils.DisplayUtils;
|
||||||
import com.owncloud.android.utils.theme.ThemeColorUtils;
|
import com.owncloud.android.utils.theme.ThemeColorUtils;
|
||||||
import com.owncloud.android.utils.theme.ThemeDrawableUtils;
|
import com.owncloud.android.utils.theme.ThemeDrawableUtils;
|
||||||
|
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -61,16 +62,14 @@ public class ActivityAndVersionListAdapter extends ActivityListAdapter {
|
||||||
ActivityListInterface activityListInterface,
|
ActivityListInterface activityListInterface,
|
||||||
VersionListInterface.View versionListInterface,
|
VersionListInterface.View versionListInterface,
|
||||||
ClientFactory clientFactory,
|
ClientFactory clientFactory,
|
||||||
ThemeColorUtils themeColorUtils,
|
ViewThemeUtils viewThemeUtils
|
||||||
ThemeDrawableUtils themeDrawableUtils
|
|
||||||
) {
|
) {
|
||||||
super(context,
|
super(context,
|
||||||
currentAccountProvider,
|
currentAccountProvider,
|
||||||
activityListInterface,
|
activityListInterface,
|
||||||
clientFactory,
|
clientFactory,
|
||||||
true,
|
true,
|
||||||
themeColorUtils,
|
viewThemeUtils);
|
||||||
themeDrawableUtils);
|
|
||||||
|
|
||||||
this.versionListInterface = versionListInterface;
|
this.versionListInterface = versionListInterface;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,7 @@ import com.owncloud.android.utils.svg.SvgBitmapTranscoder;
|
||||||
import com.owncloud.android.utils.svg.SvgDecoder;
|
import com.owncloud.android.utils.svg.SvgDecoder;
|
||||||
import com.owncloud.android.utils.theme.ThemeColorUtils;
|
import com.owncloud.android.utils.theme.ThemeColorUtils;
|
||||||
import com.owncloud.android.utils.theme.ThemeDrawableUtils;
|
import com.owncloud.android.utils.theme.ThemeDrawableUtils;
|
||||||
|
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -100,8 +101,7 @@ public class ActivityListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
private ClientFactory clientFactory;
|
private ClientFactory clientFactory;
|
||||||
protected List<Object> values;
|
protected List<Object> values;
|
||||||
private boolean isDetailView;
|
private boolean isDetailView;
|
||||||
private ThemeColorUtils themeColorUtils;
|
private ViewThemeUtils viewThemeUtils;
|
||||||
private ThemeDrawableUtils themeDrawableUtils;
|
|
||||||
|
|
||||||
public ActivityListAdapter(
|
public ActivityListAdapter(
|
||||||
Context context,
|
Context context,
|
||||||
|
@ -109,8 +109,7 @@ public class ActivityListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
ActivityListInterface activityListInterface,
|
ActivityListInterface activityListInterface,
|
||||||
ClientFactory clientFactory,
|
ClientFactory clientFactory,
|
||||||
boolean isDetailView,
|
boolean isDetailView,
|
||||||
ThemeColorUtils themeColorUtils,
|
ViewThemeUtils viewThemeUtils) {
|
||||||
ThemeDrawableUtils themeDrawableUtils) {
|
|
||||||
this.values = new ArrayList<>();
|
this.values = new ArrayList<>();
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.currentAccountProvider = currentAccountProvider;
|
this.currentAccountProvider = currentAccountProvider;
|
||||||
|
@ -118,8 +117,7 @@ public class ActivityListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
this.clientFactory = clientFactory;
|
this.clientFactory = clientFactory;
|
||||||
px = getThumbnailDimension();
|
px = getThumbnailDimension();
|
||||||
this.isDetailView = isDetailView;
|
this.isDetailView = isDetailView;
|
||||||
this.themeColorUtils = themeColorUtils;
|
this.viewThemeUtils = viewThemeUtils;
|
||||||
this.themeDrawableUtils = themeDrawableUtils;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setActivityItems(List<Object> activityItems, NextcloudClient client, boolean clear) {
|
public void setActivityItems(List<Object> activityItems, NextcloudClient client, boolean clear) {
|
||||||
|
@ -287,14 +285,12 @@ public class ActivityListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
} else {
|
} else {
|
||||||
if (MimeTypeUtil.isFolder(previewObject.getMimeType())) {
|
if (MimeTypeUtil.isFolder(previewObject.getMimeType())) {
|
||||||
imageView.setImageDrawable(MimeTypeUtil.getDefaultFolderIcon(context,
|
imageView.setImageDrawable(MimeTypeUtil.getDefaultFolderIcon(context,
|
||||||
themeColorUtils,
|
viewThemeUtils));
|
||||||
themeDrawableUtils));
|
|
||||||
} else {
|
} else {
|
||||||
imageView.setImageDrawable(MimeTypeUtil.getFileTypeIcon(previewObject.getMimeType(),
|
imageView.setImageDrawable(MimeTypeUtil.getFileTypeIcon(previewObject.getMimeType(),
|
||||||
"",
|
"",
|
||||||
context,
|
context,
|
||||||
themeColorUtils,
|
viewThemeUtils));
|
||||||
themeDrawableUtils));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ import com.owncloud.android.utils.FileStorageUtils
|
||||||
import com.owncloud.android.utils.MimeTypeUtil
|
import com.owncloud.android.utils.MimeTypeUtil
|
||||||
import com.owncloud.android.utils.theme.ThemeColorUtils
|
import com.owncloud.android.utils.theme.ThemeColorUtils
|
||||||
import com.owncloud.android.utils.theme.ThemeDrawableUtils
|
import com.owncloud.android.utils.theme.ThemeDrawableUtils
|
||||||
|
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils
|
||||||
import me.zhanghai.android.fastscroll.PopupTextProvider
|
import me.zhanghai.android.fastscroll.PopupTextProvider
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
|
@ -63,7 +64,8 @@ class GalleryAdapter(
|
||||||
preferences: AppPreferences,
|
preferences: AppPreferences,
|
||||||
transferServiceGetter: ComponentsGetter,
|
transferServiceGetter: ComponentsGetter,
|
||||||
themeColorUtils: ThemeColorUtils,
|
themeColorUtils: ThemeColorUtils,
|
||||||
themeDrawableUtils: ThemeDrawableUtils
|
themeDrawableUtils: ThemeDrawableUtils,
|
||||||
|
viewThemeUtils: ViewThemeUtils
|
||||||
) : SectionedRecyclerViewAdapter<SectionedViewHolder>(), CommonOCFileListAdapterInterface, PopupTextProvider {
|
) : SectionedRecyclerViewAdapter<SectionedViewHolder>(), CommonOCFileListAdapterInterface, PopupTextProvider {
|
||||||
var files: List<GalleryItems> = mutableListOf()
|
var files: List<GalleryItems> = mutableListOf()
|
||||||
private val ocFileListDelegate: OCFileListDelegate
|
private val ocFileListDelegate: OCFileListDelegate
|
||||||
|
@ -84,7 +86,8 @@ class GalleryAdapter(
|
||||||
showMetadata = false,
|
showMetadata = false,
|
||||||
showShareAvatar = false,
|
showShareAvatar = false,
|
||||||
themeColorUtils,
|
themeColorUtils,
|
||||||
themeDrawableUtils
|
themeDrawableUtils,
|
||||||
|
viewThemeUtils
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ import com.owncloud.android.utils.FileSortOrder;
|
||||||
import com.owncloud.android.utils.MimeTypeUtil;
|
import com.owncloud.android.utils.MimeTypeUtil;
|
||||||
import com.owncloud.android.utils.theme.ThemeColorUtils;
|
import com.owncloud.android.utils.theme.ThemeColorUtils;
|
||||||
import com.owncloud.android.utils.theme.ThemeDrawableUtils;
|
import com.owncloud.android.utils.theme.ThemeDrawableUtils;
|
||||||
|
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -73,8 +74,7 @@ public class LocalFileListAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||||
private boolean gridView = false;
|
private boolean gridView = false;
|
||||||
private LocalFileListFragmentInterface localFileListFragmentInterface;
|
private LocalFileListFragmentInterface localFileListFragmentInterface;
|
||||||
private Set<File> checkedFiles;
|
private Set<File> checkedFiles;
|
||||||
private ThemeColorUtils themeColorUtils;
|
private ViewThemeUtils viewThemeUtils;
|
||||||
private ThemeDrawableUtils themeDrawableUtils;
|
|
||||||
|
|
||||||
private static final int VIEWTYPE_ITEM = 0;
|
private static final int VIEWTYPE_ITEM = 0;
|
||||||
private static final int VIEWTYPE_FOOTER = 1;
|
private static final int VIEWTYPE_FOOTER = 1;
|
||||||
|
@ -92,8 +92,7 @@ public class LocalFileListAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||||
mLocalFolderPicker = localFolderPickerMode;
|
mLocalFolderPicker = localFolderPickerMode;
|
||||||
this.localFileListFragmentInterface = localFileListFragmentInterface;
|
this.localFileListFragmentInterface = localFileListFragmentInterface;
|
||||||
checkedFiles = new HashSet<>();
|
checkedFiles = new HashSet<>();
|
||||||
this.themeColorUtils = themeColorUtils;
|
this.viewThemeUtils = viewThemeUtils;
|
||||||
this.themeDrawableUtils = themeDrawableUtils;
|
|
||||||
|
|
||||||
swapDirectory(directory);
|
swapDirectory(directory);
|
||||||
}
|
}
|
||||||
|
@ -181,9 +180,9 @@ public class LocalFileListAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||||
if (isCheckedFile(file)) {
|
if (isCheckedFile(file)) {
|
||||||
gridViewHolder.itemLayout.setBackgroundColor(mContext.getResources()
|
gridViewHolder.itemLayout.setBackgroundColor(mContext.getResources()
|
||||||
.getColor(R.color.selected_item_background));
|
.getColor(R.color.selected_item_background));
|
||||||
|
|
||||||
gridViewHolder.checkbox.setImageDrawable(
|
gridViewHolder.checkbox.setImageDrawable(
|
||||||
themeDrawableUtils.tintDrawable(R.drawable.ic_checkbox_marked,
|
viewThemeUtils.platform.tintPrimaryDrawable(mContext, R.drawable.ic_checkbox_marked));
|
||||||
themeColorUtils.primaryColor(mContext)));
|
|
||||||
} else {
|
} else {
|
||||||
gridViewHolder.itemLayout.setBackgroundColor(mContext.getResources().getColor(R.color.bg_default));
|
gridViewHolder.itemLayout.setBackgroundColor(mContext.getResources().getColor(R.color.bg_default));
|
||||||
gridViewHolder.checkbox.setImageResource(R.drawable.ic_checkbox_blank_outline);
|
gridViewHolder.checkbox.setImageResource(R.drawable.ic_checkbox_blank_outline);
|
||||||
|
@ -193,7 +192,7 @@ public class LocalFileListAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||||
}
|
}
|
||||||
|
|
||||||
gridViewHolder.thumbnail.setTag(file.hashCode());
|
gridViewHolder.thumbnail.setTag(file.hashCode());
|
||||||
setThumbnail(file, gridViewHolder.thumbnail, mContext, themeColorUtils, themeDrawableUtils);
|
setThumbnail(file, gridViewHolder.thumbnail, mContext, viewThemeUtils);
|
||||||
|
|
||||||
gridViewHolder.itemLayout.setOnClickListener(v -> localFileListFragmentInterface
|
gridViewHolder.itemLayout.setOnClickListener(v -> localFileListFragmentInterface
|
||||||
.onItemClicked(finalFile));
|
.onItemClicked(finalFile));
|
||||||
|
@ -231,12 +230,9 @@ public class LocalFileListAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||||
public static void setThumbnail(File file,
|
public static void setThumbnail(File file,
|
||||||
ImageView thumbnailView,
|
ImageView thumbnailView,
|
||||||
Context context,
|
Context context,
|
||||||
ThemeColorUtils themeColorUtils,
|
ViewThemeUtils viewThemeUtils) {
|
||||||
ThemeDrawableUtils themeDrawableUtils) {
|
|
||||||
if (file.isDirectory()) {
|
if (file.isDirectory()) {
|
||||||
thumbnailView.setImageDrawable(MimeTypeUtil.getDefaultFolderIcon(context,
|
thumbnailView.setImageDrawable(MimeTypeUtil.getDefaultFolderIcon(context, viewThemeUtils));
|
||||||
themeColorUtils,
|
|
||||||
themeDrawableUtils));
|
|
||||||
} else {
|
} else {
|
||||||
thumbnailView.setImageResource(R.drawable.file);
|
thumbnailView.setImageResource(R.drawable.file);
|
||||||
|
|
||||||
|
@ -282,8 +278,7 @@ public class LocalFileListAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||||
thumbnailView.setImageDrawable(MimeTypeUtil.getFileTypeIcon(null,
|
thumbnailView.setImageDrawable(MimeTypeUtil.getFileTypeIcon(null,
|
||||||
file.getName(),
|
file.getName(),
|
||||||
context,
|
context,
|
||||||
themeColorUtils,
|
viewThemeUtils));
|
||||||
themeDrawableUtils));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,7 +182,8 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||||
.getVersion()
|
.getVersion()
|
||||||
.isShareesOnDavSupported(),
|
.isShareesOnDavSupported(),
|
||||||
themeColorUtils,
|
themeColorUtils,
|
||||||
themeDrawableUtils);
|
themeDrawableUtils,
|
||||||
|
viewThemeUtils);
|
||||||
|
|
||||||
// initialise thumbnails cache on background thread
|
// initialise thumbnails cache on background thread
|
||||||
new ThumbnailsCacheManager.InitDiskCacheTask().execute();
|
new ThumbnailsCacheManager.InitDiskCacheTask().execute();
|
||||||
|
|
|
@ -36,6 +36,7 @@ import com.owncloud.android.ui.interfaces.OCFileListFragmentInterface
|
||||||
import com.owncloud.android.utils.DisplayUtils
|
import com.owncloud.android.utils.DisplayUtils
|
||||||
import com.owncloud.android.utils.theme.ThemeColorUtils
|
import com.owncloud.android.utils.theme.ThemeColorUtils
|
||||||
import com.owncloud.android.utils.theme.ThemeDrawableUtils
|
import com.owncloud.android.utils.theme.ThemeDrawableUtils
|
||||||
|
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils
|
||||||
|
|
||||||
@Suppress("LongParameterList", "TooManyFunctions")
|
@Suppress("LongParameterList", "TooManyFunctions")
|
||||||
class OCFileListDelegate(
|
class OCFileListDelegate(
|
||||||
|
@ -50,7 +51,8 @@ class OCFileListDelegate(
|
||||||
private val showMetadata: Boolean,
|
private val showMetadata: Boolean,
|
||||||
private var showShareAvatar: Boolean,
|
private var showShareAvatar: Boolean,
|
||||||
private var themeColorUtils: ThemeColorUtils,
|
private var themeColorUtils: ThemeColorUtils,
|
||||||
private var themeDrawableUtils: ThemeDrawableUtils
|
private var themeDrawableUtils: ThemeDrawableUtils,
|
||||||
|
private var viewThemeUtils: ViewThemeUtils
|
||||||
) {
|
) {
|
||||||
private val checkedFiles: MutableSet<OCFile> = HashSet()
|
private val checkedFiles: MutableSet<OCFile> = HashSet()
|
||||||
private var highlightedItem: OCFile? = null
|
private var highlightedItem: OCFile? = null
|
||||||
|
@ -106,8 +108,7 @@ class OCFileListDelegate(
|
||||||
context,
|
context,
|
||||||
gridViewHolder.shimmerThumbnail,
|
gridViewHolder.shimmerThumbnail,
|
||||||
preferences,
|
preferences,
|
||||||
themeColorUtils,
|
viewThemeUtils
|
||||||
themeDrawableUtils
|
|
||||||
)
|
)
|
||||||
// item layout + click listeners
|
// item layout + click listeners
|
||||||
bindGridItemLayout(file, gridViewHolder)
|
bindGridItemLayout(file, gridViewHolder)
|
||||||
|
|
|
@ -42,6 +42,7 @@ import com.owncloud.android.datamodel.SyncedFolderDisplayItem;
|
||||||
import com.owncloud.android.datamodel.ThumbnailsCacheManager;
|
import com.owncloud.android.datamodel.ThumbnailsCacheManager;
|
||||||
import com.owncloud.android.utils.theme.ThemeColorUtils;
|
import com.owncloud.android.utils.theme.ThemeColorUtils;
|
||||||
import com.owncloud.android.utils.theme.ThemeDrawableUtils;
|
import com.owncloud.android.utils.theme.ThemeDrawableUtils;
|
||||||
|
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -72,6 +73,7 @@ public class SyncedFolderAdapter extends SectionedRecyclerViewAdapter<SectionedV
|
||||||
private boolean hideItems;
|
private boolean hideItems;
|
||||||
private final ThemeColorUtils themeColorUtils;
|
private final ThemeColorUtils themeColorUtils;
|
||||||
private final ThemeDrawableUtils themeDrawableUtils;
|
private final ThemeDrawableUtils themeDrawableUtils;
|
||||||
|
private final ViewThemeUtils viewThemeUtils;
|
||||||
private final Executor thumbnailThreadPool;
|
private final Executor thumbnailThreadPool;
|
||||||
|
|
||||||
public SyncedFolderAdapter(Context context,
|
public SyncedFolderAdapter(Context context,
|
||||||
|
@ -80,7 +82,8 @@ public class SyncedFolderAdapter extends SectionedRecyclerViewAdapter<SectionedV
|
||||||
ClickListener listener,
|
ClickListener listener,
|
||||||
boolean light,
|
boolean light,
|
||||||
ThemeColorUtils themeColorUtils,
|
ThemeColorUtils themeColorUtils,
|
||||||
ThemeDrawableUtils themeDrawableUtils) {
|
ThemeDrawableUtils themeDrawableUtils,
|
||||||
|
ViewThemeUtils viewThemeUtils) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.clock = clock;
|
this.clock = clock;
|
||||||
this.gridWidth = gridWidth;
|
this.gridWidth = gridWidth;
|
||||||
|
@ -92,6 +95,7 @@ public class SyncedFolderAdapter extends SectionedRecyclerViewAdapter<SectionedV
|
||||||
this.hideItems = true;
|
this.hideItems = true;
|
||||||
this.themeColorUtils = themeColorUtils;
|
this.themeColorUtils = themeColorUtils;
|
||||||
this.themeDrawableUtils = themeDrawableUtils;
|
this.themeDrawableUtils = themeDrawableUtils;
|
||||||
|
this.viewThemeUtils = viewThemeUtils;
|
||||||
this.thumbnailThreadPool = Executors.newCachedThreadPool();
|
this.thumbnailThreadPool = Executors.newCachedThreadPool();
|
||||||
|
|
||||||
shouldShowHeadersForEmptySections(true);
|
shouldShowHeadersForEmptySections(true);
|
||||||
|
@ -348,8 +352,7 @@ public class SyncedFolderAdapter extends SectionedRecyclerViewAdapter<SectionedV
|
||||||
ThumbnailsCacheManager.MediaThumbnailGenerationTask task =
|
ThumbnailsCacheManager.MediaThumbnailGenerationTask task =
|
||||||
new ThumbnailsCacheManager.MediaThumbnailGenerationTask(holder.binding.thumbnail,
|
new ThumbnailsCacheManager.MediaThumbnailGenerationTask(holder.binding.thumbnail,
|
||||||
context,
|
context,
|
||||||
themeColorUtils,
|
viewThemeUtils);
|
||||||
themeDrawableUtils);
|
|
||||||
|
|
||||||
ThumbnailsCacheManager.AsyncMediaThumbnailDrawable asyncDrawable =
|
ThumbnailsCacheManager.AsyncMediaThumbnailDrawable asyncDrawable =
|
||||||
new ThumbnailsCacheManager.AsyncMediaThumbnailDrawable(
|
new ThumbnailsCacheManager.AsyncMediaThumbnailDrawable(
|
||||||
|
|
|
@ -40,7 +40,7 @@ import com.owncloud.android.lib.common.TemplateList;
|
||||||
import com.owncloud.android.utils.MimeTypeUtil;
|
import com.owncloud.android.utils.MimeTypeUtil;
|
||||||
import com.owncloud.android.utils.glide.CustomGlideStreamLoader;
|
import com.owncloud.android.utils.glide.CustomGlideStreamLoader;
|
||||||
import com.owncloud.android.utils.theme.ThemeColorUtils;
|
import com.owncloud.android.utils.theme.ThemeColorUtils;
|
||||||
import com.owncloud.android.utils.theme.ThemeDrawableUtils;
|
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
@ -61,8 +61,7 @@ public class TemplateAdapter extends RecyclerView.Adapter<TemplateAdapter.ViewHo
|
||||||
private Template selectedTemplate;
|
private Template selectedTemplate;
|
||||||
private final int colorSelected;
|
private final int colorSelected;
|
||||||
private final int colorUnselected;
|
private final int colorUnselected;
|
||||||
private final ThemeColorUtils themeColorUtils;
|
private final ViewThemeUtils viewThemeUtils;
|
||||||
private final ThemeDrawableUtils themeDrawableUtils;
|
|
||||||
|
|
||||||
public TemplateAdapter(
|
public TemplateAdapter(
|
||||||
String mimetype,
|
String mimetype,
|
||||||
|
@ -71,7 +70,7 @@ public class TemplateAdapter extends RecyclerView.Adapter<TemplateAdapter.ViewHo
|
||||||
CurrentAccountProvider currentAccountProvider,
|
CurrentAccountProvider currentAccountProvider,
|
||||||
ClientFactory clientFactory,
|
ClientFactory clientFactory,
|
||||||
ThemeColorUtils themeColorUtils,
|
ThemeColorUtils themeColorUtils,
|
||||||
ThemeDrawableUtils themeDrawableUtils
|
ViewThemeUtils viewThemeUtils
|
||||||
) {
|
) {
|
||||||
this.mimetype = mimetype;
|
this.mimetype = mimetype;
|
||||||
this.clickListener = clickListener;
|
this.clickListener = clickListener;
|
||||||
|
@ -80,8 +79,7 @@ public class TemplateAdapter extends RecyclerView.Adapter<TemplateAdapter.ViewHo
|
||||||
this.clientFactory = clientFactory;
|
this.clientFactory = clientFactory;
|
||||||
colorSelected = themeColorUtils.primaryColor(context, true);
|
colorSelected = themeColorUtils.primaryColor(context, true);
|
||||||
colorUnselected = context.getResources().getColor(R.color.grey_200);
|
colorUnselected = context.getResources().getColor(R.color.grey_200);
|
||||||
this.themeColorUtils = themeColorUtils;
|
this.viewThemeUtils = viewThemeUtils;
|
||||||
this.themeDrawableUtils = themeDrawableUtils;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
|
@ -96,7 +94,7 @@ public class TemplateAdapter extends RecyclerView.Adapter<TemplateAdapter.ViewHo
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||||
holder.setData(new ArrayList<>(templateList.getTemplates().values()).get(position), themeColorUtils, themeDrawableUtils);
|
holder.setData(new ArrayList<>(templateList.getTemplates().values()).get(position));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTemplateList(TemplateList templateList) {
|
public void setTemplateList(TemplateList templateList) {
|
||||||
|
@ -135,15 +133,14 @@ public class TemplateAdapter extends RecyclerView.Adapter<TemplateAdapter.ViewHo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setData(Template template, ThemeColorUtils themeColorUtils, ThemeDrawableUtils themeDrawableUtils) {
|
public void setData(Template template) {
|
||||||
this.template = template;
|
this.template = template;
|
||||||
|
|
||||||
Drawable placeholder = MimeTypeUtil.getFileTypeIcon(mimetype,
|
Drawable placeholder = MimeTypeUtil.getFileTypeIcon(mimetype,
|
||||||
template.getTitle(),
|
template.getTitle(),
|
||||||
currentAccountProvider.getUser(),
|
currentAccountProvider.getUser(),
|
||||||
context,
|
context,
|
||||||
themeColorUtils,
|
viewThemeUtils);
|
||||||
themeDrawableUtils);
|
|
||||||
|
|
||||||
Glide.with(context).using(new CustomGlideStreamLoader(currentAccountProvider.getUser(), clientFactory))
|
Glide.with(context).using(new CustomGlideStreamLoader(currentAccountProvider.getUser(), clientFactory))
|
||||||
.load(template.getPreview())
|
.load(template.getPreview())
|
||||||
|
|
|
@ -42,8 +42,7 @@ import com.owncloud.android.ui.interfaces.TrashbinActivityInterface;
|
||||||
import com.owncloud.android.utils.DisplayUtils;
|
import com.owncloud.android.utils.DisplayUtils;
|
||||||
import com.owncloud.android.utils.FileSortOrder;
|
import com.owncloud.android.utils.FileSortOrder;
|
||||||
import com.owncloud.android.utils.MimeTypeUtil;
|
import com.owncloud.android.utils.MimeTypeUtil;
|
||||||
import com.owncloud.android.utils.theme.ThemeColorUtils;
|
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
|
||||||
import com.owncloud.android.utils.theme.ThemeDrawableUtils;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -70,8 +69,7 @@ public class TrashbinListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
private final FileDataStorageManager storageManager;
|
private final FileDataStorageManager storageManager;
|
||||||
private final AppPreferences preferences;
|
private final AppPreferences preferences;
|
||||||
private final List<ThumbnailsCacheManager.ThumbnailGenerationTask> asyncTasks = new ArrayList<>();
|
private final List<ThumbnailsCacheManager.ThumbnailGenerationTask> asyncTasks = new ArrayList<>();
|
||||||
private final ThemeColorUtils themeColorUtils;
|
private final ViewThemeUtils viewThemeUtils;
|
||||||
private final ThemeDrawableUtils themeDrawableUtils;
|
|
||||||
|
|
||||||
public TrashbinListAdapter(
|
public TrashbinListAdapter(
|
||||||
TrashbinActivityInterface trashbinActivityInterface,
|
TrashbinActivityInterface trashbinActivityInterface,
|
||||||
|
@ -79,8 +77,7 @@ public class TrashbinListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
AppPreferences preferences,
|
AppPreferences preferences,
|
||||||
Context context,
|
Context context,
|
||||||
User user,
|
User user,
|
||||||
ThemeColorUtils themeColorUtils,
|
ViewThemeUtils viewThemeUtils
|
||||||
ThemeDrawableUtils themeDrawableUtils
|
|
||||||
) {
|
) {
|
||||||
this.files = new ArrayList<>();
|
this.files = new ArrayList<>();
|
||||||
this.trashbinActivityInterface = trashbinActivityInterface;
|
this.trashbinActivityInterface = trashbinActivityInterface;
|
||||||
|
@ -88,8 +85,7 @@ public class TrashbinListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
this.storageManager = storageManager;
|
this.storageManager = storageManager;
|
||||||
this.preferences = preferences;
|
this.preferences = preferences;
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.themeColorUtils = themeColorUtils;
|
this.viewThemeUtils = viewThemeUtils;
|
||||||
this.themeDrawableUtils = themeDrawableUtils;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTrashbinFiles(List<Object> trashbinFiles, boolean clear) {
|
public void setTrashbinFiles(List<Object> trashbinFiles, boolean clear) {
|
||||||
|
@ -226,8 +222,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(MimeTypeUtil.getDefaultFolderIcon(context,
|
||||||
themeColorUtils,
|
viewThemeUtils));
|
||||||
themeDrawableUtils));
|
|
||||||
} 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?
|
||||||
|
@ -273,8 +268,7 @@ public class TrashbinListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
file.getFileName(),
|
file.getFileName(),
|
||||||
user,
|
user,
|
||||||
context,
|
context,
|
||||||
themeColorUtils,
|
viewThemeUtils));
|
||||||
themeDrawableUtils));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ import com.owncloud.android.utils.MimeTypeUtil
|
||||||
import com.owncloud.android.utils.glide.CustomGlideStreamLoader
|
import com.owncloud.android.utils.glide.CustomGlideStreamLoader
|
||||||
import com.owncloud.android.utils.theme.ThemeColorUtils
|
import com.owncloud.android.utils.theme.ThemeColorUtils
|
||||||
import com.owncloud.android.utils.theme.ThemeDrawableUtils
|
import com.owncloud.android.utils.theme.ThemeDrawableUtils
|
||||||
|
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils
|
||||||
|
|
||||||
@Suppress("LongParameterList")
|
@Suppress("LongParameterList")
|
||||||
class UnifiedSearchItemViewHolder(
|
class UnifiedSearchItemViewHolder(
|
||||||
|
@ -54,7 +55,7 @@ class UnifiedSearchItemViewHolder(
|
||||||
private val listInterface: UnifiedSearchListInterface,
|
private val listInterface: UnifiedSearchListInterface,
|
||||||
val context: Context,
|
val context: Context,
|
||||||
private val themeColorUtils: ThemeColorUtils,
|
private val themeColorUtils: ThemeColorUtils,
|
||||||
private val themeDrawableUtils: ThemeDrawableUtils
|
private val viewThemeUtils: ViewThemeUtils
|
||||||
) :
|
) :
|
||||||
SectionedViewHolder(binding.root) {
|
SectionedViewHolder(binding.root) {
|
||||||
|
|
||||||
|
@ -101,7 +102,7 @@ class UnifiedSearchItemViewHolder(
|
||||||
startsWith("icon-deck") ->
|
startsWith("icon-deck") ->
|
||||||
ResourcesCompat.getDrawable(context.resources, R.drawable.ic_deck, null)
|
ResourcesCompat.getDrawable(context.resources, R.drawable.ic_deck, null)
|
||||||
else ->
|
else ->
|
||||||
MimeTypeUtil.getFileTypeIcon(mimetype, entry.title, context, themeColorUtils, themeDrawableUtils)
|
MimeTypeUtil.getFileTypeIcon(mimetype, entry.title, context, viewThemeUtils)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val color = themeColorUtils.primaryColor(context)
|
val color = themeColorUtils.primaryColor(context)
|
||||||
|
|
|
@ -42,6 +42,7 @@ import com.owncloud.android.ui.interfaces.UnifiedSearchListInterface
|
||||||
import com.owncloud.android.ui.unifiedsearch.UnifiedSearchSection
|
import com.owncloud.android.ui.unifiedsearch.UnifiedSearchSection
|
||||||
import com.owncloud.android.utils.theme.ThemeColorUtils
|
import com.owncloud.android.utils.theme.ThemeColorUtils
|
||||||
import com.owncloud.android.utils.theme.ThemeDrawableUtils
|
import com.owncloud.android.utils.theme.ThemeDrawableUtils
|
||||||
|
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This Adapter populates a SectionedRecyclerView with search results by unified search
|
* This Adapter populates a SectionedRecyclerView with search results by unified search
|
||||||
|
@ -54,7 +55,7 @@ class UnifiedSearchListAdapter(
|
||||||
private val clientFactory: ClientFactory,
|
private val clientFactory: ClientFactory,
|
||||||
private val context: Context,
|
private val context: Context,
|
||||||
private val themeColorUtils: ThemeColorUtils,
|
private val themeColorUtils: ThemeColorUtils,
|
||||||
private val themeDrawableUtils: ThemeDrawableUtils
|
private val viewThemeUtils: ViewThemeUtils
|
||||||
) : SectionedRecyclerViewAdapter<SectionedViewHolder>() {
|
) : SectionedRecyclerViewAdapter<SectionedViewHolder>() {
|
||||||
companion object {
|
companion object {
|
||||||
private const val VIEW_TYPE_EMPTY = Int.MAX_VALUE
|
private const val VIEW_TYPE_EMPTY = Int.MAX_VALUE
|
||||||
|
@ -95,7 +96,7 @@ class UnifiedSearchListAdapter(
|
||||||
listInterface,
|
listInterface,
|
||||||
context,
|
context,
|
||||||
themeColorUtils,
|
themeColorUtils,
|
||||||
themeDrawableUtils
|
viewThemeUtils
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
VIEW_TYPE_EMPTY -> {
|
VIEW_TYPE_EMPTY -> {
|
||||||
|
|
|
@ -493,8 +493,7 @@ public class UploadListAdapter extends SectionedRecyclerViewAdapter<SectionedVie
|
||||||
fileName,
|
fileName,
|
||||||
user,
|
user,
|
||||||
parentActivity,
|
parentActivity,
|
||||||
themeColorUtils,
|
viewThemeUtils);
|
||||||
themeDrawableUtils);
|
|
||||||
itemViewHolder.binding.thumbnail.setImageDrawable(icon);
|
itemViewHolder.binding.thumbnail.setImageDrawable(icon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ import com.owncloud.android.utils.DisplayUtils;
|
||||||
import com.owncloud.android.utils.MimeTypeUtil;
|
import com.owncloud.android.utils.MimeTypeUtil;
|
||||||
import com.owncloud.android.utils.theme.ThemeColorUtils;
|
import com.owncloud.android.utils.theme.ThemeColorUtils;
|
||||||
import com.owncloud.android.utils.theme.ThemeDrawableUtils;
|
import com.owncloud.android.utils.theme.ThemeDrawableUtils;
|
||||||
|
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -51,8 +52,7 @@ public class UploaderAdapter extends SimpleAdapter {
|
||||||
private final User user;
|
private final User user;
|
||||||
private final FileDataStorageManager mStorageManager;
|
private final FileDataStorageManager mStorageManager;
|
||||||
private final LayoutInflater inflater;
|
private final LayoutInflater inflater;
|
||||||
private final ThemeColorUtils themeColorUtils;
|
private final ViewThemeUtils viewThemeUtils;
|
||||||
private final ThemeDrawableUtils themeDrawableUtils;
|
|
||||||
|
|
||||||
public UploaderAdapter(Context context,
|
public UploaderAdapter(Context context,
|
||||||
List<? extends Map<String, ?>> data,
|
List<? extends Map<String, ?>> data,
|
||||||
|
@ -61,15 +61,13 @@ public class UploaderAdapter extends SimpleAdapter {
|
||||||
int[] to,
|
int[] to,
|
||||||
FileDataStorageManager storageManager,
|
FileDataStorageManager storageManager,
|
||||||
User user,
|
User user,
|
||||||
ThemeColorUtils themeColorUtils,
|
ViewThemeUtils viewThemeUtils) {
|
||||||
ThemeDrawableUtils themeDrawableUtils) {
|
|
||||||
super(context, data, resource, from, to);
|
super(context, data, resource, from, to);
|
||||||
this.user = user;
|
this.user = user;
|
||||||
mStorageManager = storageManager;
|
mStorageManager = storageManager;
|
||||||
mContext = context;
|
mContext = context;
|
||||||
inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
this.themeColorUtils = themeColorUtils;
|
this.viewThemeUtils = viewThemeUtils;
|
||||||
this.themeDrawableUtils = themeDrawableUtils;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -112,8 +110,7 @@ public class UploaderAdapter extends SimpleAdapter {
|
||||||
user,
|
user,
|
||||||
file.getMountType(),
|
file.getMountType(),
|
||||||
mContext,
|
mContext,
|
||||||
themeColorUtils,
|
viewThemeUtils);
|
||||||
themeDrawableUtils);
|
|
||||||
fileIcon.setImageDrawable(icon);
|
fileIcon.setImageDrawable(icon);
|
||||||
} else {
|
} else {
|
||||||
// get Thumbnail if file is image
|
// get Thumbnail if file is image
|
||||||
|
@ -150,8 +147,7 @@ public class UploaderAdapter extends SimpleAdapter {
|
||||||
file.getFileName(),
|
file.getFileName(),
|
||||||
user,
|
user,
|
||||||
mContext,
|
mContext,
|
||||||
themeColorUtils,
|
viewThemeUtils);
|
||||||
themeDrawableUtils);
|
|
||||||
fileIcon.setImageDrawable(icon);
|
fileIcon.setImageDrawable(icon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,7 +167,7 @@ class ChooseTemplateDialogFragment : DialogFragment(), View.OnClickListener, Tem
|
||||||
currentAccount,
|
currentAccount,
|
||||||
clientFactory,
|
clientFactory,
|
||||||
themeColorUtils,
|
themeColorUtils,
|
||||||
themeDrawableUtils
|
viewThemeUtils
|
||||||
)
|
)
|
||||||
binding.list.adapter = adapter
|
binding.list.adapter = adapter
|
||||||
|
|
||||||
|
|
|
@ -198,8 +198,7 @@ public class ConflictsResolveDialog extends DialogFragment implements Injectable
|
||||||
LocalFileListAdapter.setThumbnail(newFile,
|
LocalFileListAdapter.setThumbnail(newFile,
|
||||||
binding.newThumbnail,
|
binding.newThumbnail,
|
||||||
getContext(),
|
getContext(),
|
||||||
themeColorUtils,
|
viewThemeUtils);
|
||||||
themeDrawableUtils);
|
|
||||||
|
|
||||||
// set info for existing file
|
// set info for existing file
|
||||||
binding.existingSize.setText(DisplayUtils.bytesToHumanReadable(existingFile.getFileLength()));
|
binding.existingSize.setText(DisplayUtils.bytesToHumanReadable(existingFile.getFileLength()));
|
||||||
|
@ -217,8 +216,7 @@ public class ConflictsResolveDialog extends DialogFragment implements Injectable
|
||||||
getContext(),
|
getContext(),
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
themeColorUtils,
|
viewThemeUtils);
|
||||||
themeDrawableUtils);
|
|
||||||
|
|
||||||
View.OnClickListener checkBoxClickListener = v ->
|
View.OnClickListener checkBoxClickListener = v ->
|
||||||
positiveButton.setEnabled(binding.newCheckbox.isChecked() || binding.existingCheckbox.isChecked());
|
positiveButton.setEnabled(binding.newCheckbox.isChecked() || binding.existingCheckbox.isChecked());
|
||||||
|
|
|
@ -240,8 +240,7 @@ public class FileDetailActivitiesFragment extends Fragment implements
|
||||||
this,
|
this,
|
||||||
this,
|
this,
|
||||||
clientFactory,
|
clientFactory,
|
||||||
themeColorUtils,
|
viewThemeUtils
|
||||||
themeDrawableUtils
|
|
||||||
);
|
);
|
||||||
binding.list.setAdapter(adapter);
|
binding.list.setAdapter(adapter);
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,8 @@ public class GalleryFragment extends OCFileListFragment implements GalleryFragme
|
||||||
preferences,
|
preferences,
|
||||||
mContainerActivity,
|
mContainerActivity,
|
||||||
themeColorUtils,
|
themeColorUtils,
|
||||||
themeDrawableUtils);
|
themeDrawableUtils,
|
||||||
|
viewThemeUtils);
|
||||||
|
|
||||||
setRecyclerViewAdapter(mAdapter);
|
setRecyclerViewAdapter(mAdapter);
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ import com.owncloud.android.utils.MimeTypeUtil;
|
||||||
import com.owncloud.android.utils.theme.ThemeColorUtils;
|
import com.owncloud.android.utils.theme.ThemeColorUtils;
|
||||||
import com.owncloud.android.utils.theme.ThemeDrawableUtils;
|
import com.owncloud.android.utils.theme.ThemeDrawableUtils;
|
||||||
import com.owncloud.android.utils.theme.ThemeUtils;
|
import com.owncloud.android.utils.theme.ThemeUtils;
|
||||||
|
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
@ -62,6 +63,7 @@ public class OCFileListBottomSheetDialog extends BottomSheetDialog implements In
|
||||||
private final ThemeColorUtils themeColorUtils;
|
private final ThemeColorUtils themeColorUtils;
|
||||||
private final ThemeUtils themeUtils;
|
private final ThemeUtils themeUtils;
|
||||||
private final ThemeDrawableUtils themeDrawableUtils;
|
private final ThemeDrawableUtils themeDrawableUtils;
|
||||||
|
private final ViewThemeUtils viewThemeUtils;
|
||||||
|
|
||||||
|
|
||||||
public OCFileListBottomSheetDialog(FileActivity fileActivity,
|
public OCFileListBottomSheetDialog(FileActivity fileActivity,
|
||||||
|
@ -71,7 +73,8 @@ public class OCFileListBottomSheetDialog extends BottomSheetDialog implements In
|
||||||
OCFile file,
|
OCFile file,
|
||||||
ThemeColorUtils themeColorUtils,
|
ThemeColorUtils themeColorUtils,
|
||||||
ThemeUtils themeUtils,
|
ThemeUtils themeUtils,
|
||||||
ThemeDrawableUtils themeDrawableUtils) {
|
ThemeDrawableUtils themeDrawableUtils,
|
||||||
|
ViewThemeUtils viewThemeUtils) {
|
||||||
super(fileActivity);
|
super(fileActivity);
|
||||||
this.actions = actions;
|
this.actions = actions;
|
||||||
this.fileActivity = fileActivity;
|
this.fileActivity = fileActivity;
|
||||||
|
@ -81,6 +84,7 @@ public class OCFileListBottomSheetDialog extends BottomSheetDialog implements In
|
||||||
this.themeColorUtils = themeColorUtils;
|
this.themeColorUtils = themeColorUtils;
|
||||||
this.themeUtils = themeUtils;
|
this.themeUtils = themeUtils;
|
||||||
this.themeDrawableUtils = themeDrawableUtils;
|
this.themeDrawableUtils = themeDrawableUtils;
|
||||||
|
this.viewThemeUtils = viewThemeUtils;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -93,11 +97,14 @@ public class OCFileListBottomSheetDialog extends BottomSheetDialog implements In
|
||||||
getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
int primaryColor = themeColorUtils.primaryColor(getContext(), true);
|
viewThemeUtils.platform.themeDialog(binding.getRoot());
|
||||||
themeDrawableUtils.tintDrawable(binding.menuIconUploadFiles.getDrawable(), primaryColor);
|
|
||||||
themeDrawableUtils.tintDrawable(binding.menuIconUploadFromApp.getDrawable(), primaryColor);
|
viewThemeUtils.platform.colorImageView(binding.menuIconUploadFiles);
|
||||||
themeDrawableUtils.tintDrawable(binding.menuIconDirectCameraUpload.getDrawable(), primaryColor);
|
viewThemeUtils.platform.colorImageView(binding.menuIconUploadFromApp);
|
||||||
themeDrawableUtils.tintDrawable(binding.menuIconMkdir.getDrawable(), primaryColor);
|
viewThemeUtils.platform.colorImageView(binding.menuIconDirectCameraUpload);
|
||||||
|
viewThemeUtils.platform.colorImageView(binding.menuIconScanDocUpload);
|
||||||
|
viewThemeUtils.platform.colorImageView(binding.menuIconMkdir);
|
||||||
|
viewThemeUtils.platform.colorImageView(binding.menuIconAddFolderInfo);
|
||||||
|
|
||||||
binding.addToCloud.setText(getContext().getResources().getString(R.string.add_to_cloud,
|
binding.addToCloud.setText(getContext().getResources().getString(R.string.add_to_cloud,
|
||||||
themeUtils.getDefaultDisplayNameForRootFolder(getContext())));
|
themeUtils.getDefaultDisplayNameForRootFolder(getContext())));
|
||||||
|
@ -136,9 +143,8 @@ public class OCFileListBottomSheetDialog extends BottomSheetDialog implements In
|
||||||
MimeTypeUtil.getFileTypeIcon(creator.getMimetype(),
|
MimeTypeUtil.getFileTypeIcon(creator.getMimetype(),
|
||||||
creator.getExtension(),
|
creator.getExtension(),
|
||||||
user,
|
user,
|
||||||
getContext(),
|
creatorViewBinding.creatorThumbnail.getContext(),
|
||||||
themeColorUtils,
|
viewThemeUtils));
|
||||||
themeDrawableUtils));
|
|
||||||
|
|
||||||
creatorView.setOnClickListener(v -> {
|
creatorView.setOnClickListener(v -> {
|
||||||
actions.showTemplate(creator, creatorViewBinding.creatorName.getText().toString());
|
actions.showTemplate(creator, creatorViewBinding.creatorName.getText().toString());
|
||||||
|
|
|
@ -32,6 +32,7 @@ import com.owncloud.android.ui.activity.FileActivity
|
||||||
import com.owncloud.android.utils.theme.ThemeColorUtils
|
import com.owncloud.android.utils.theme.ThemeColorUtils
|
||||||
import com.owncloud.android.utils.theme.ThemeDrawableUtils
|
import com.owncloud.android.utils.theme.ThemeDrawableUtils
|
||||||
import com.owncloud.android.utils.theme.ThemeUtils
|
import com.owncloud.android.utils.theme.ThemeUtils
|
||||||
|
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class OCFileListBottomSheetDialogFragment(
|
class OCFileListBottomSheetDialogFragment(
|
||||||
|
@ -51,6 +52,9 @@ class OCFileListBottomSheetDialogFragment(
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var themeDrawableUtils: ThemeDrawableUtils
|
lateinit var themeDrawableUtils: ThemeDrawableUtils
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
lateinit var viewThemeUtils: ViewThemeUtils
|
||||||
|
|
||||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||||
return OCFileListBottomSheetDialog(
|
return OCFileListBottomSheetDialog(
|
||||||
fileActivity,
|
fileActivity,
|
||||||
|
@ -60,7 +64,8 @@ class OCFileListBottomSheetDialogFragment(
|
||||||
file,
|
file,
|
||||||
themeColorUtils,
|
themeColorUtils,
|
||||||
themeUtils,
|
themeUtils,
|
||||||
themeDrawableUtils
|
themeDrawableUtils,
|
||||||
|
viewThemeUtils
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,7 @@ import com.owncloud.android.ui.unifiedsearch.UnifiedSearchViewModel
|
||||||
import com.owncloud.android.utils.DisplayUtils
|
import com.owncloud.android.utils.DisplayUtils
|
||||||
import com.owncloud.android.utils.theme.ThemeColorUtils
|
import com.owncloud.android.utils.theme.ThemeColorUtils
|
||||||
import com.owncloud.android.utils.theme.ThemeDrawableUtils
|
import com.owncloud.android.utils.theme.ThemeDrawableUtils
|
||||||
|
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -86,6 +87,9 @@ class UnifiedSearchFragment : Fragment(), Injectable, UnifiedSearchListInterface
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var themeColorUtils: ThemeColorUtils
|
lateinit var themeColorUtils: ThemeColorUtils
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
lateinit var viewThemeUtils: ViewThemeUtils
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var themeDrawableUtils: ThemeDrawableUtils
|
lateinit var themeDrawableUtils: ThemeDrawableUtils
|
||||||
|
|
||||||
|
@ -187,7 +191,7 @@ class UnifiedSearchFragment : Fragment(), Injectable, UnifiedSearchListInterface
|
||||||
clientFactory,
|
clientFactory,
|
||||||
requireContext(),
|
requireContext(),
|
||||||
themeColorUtils,
|
themeColorUtils,
|
||||||
themeDrawableUtils
|
viewThemeUtils
|
||||||
)
|
)
|
||||||
adapter.shouldShowFooters(true)
|
adapter.shouldShowFooters(true)
|
||||||
adapter.setLayoutManager(gridLayoutManager)
|
adapter.setLayoutManager(gridLayoutManager)
|
||||||
|
|
|
@ -144,8 +144,7 @@ public class TrashbinActivity extends DrawerActivity implements
|
||||||
preferences,
|
preferences,
|
||||||
this,
|
this,
|
||||||
getUser().orElse(accountProvider.getUser()),
|
getUser().orElse(accountProvider.getUser()),
|
||||||
themeColorUtils,
|
viewThemeUtils
|
||||||
themeDrawableUtils
|
|
||||||
);
|
);
|
||||||
recyclerView.setAdapter(trashbinListAdapter);
|
recyclerView.setAdapter(trashbinListAdapter);
|
||||||
recyclerView.setHasFixedSize(true);
|
recyclerView.setHasFixedSize(true);
|
||||||
|
|
|
@ -82,6 +82,7 @@ import com.owncloud.android.utils.svg.SvgDecoder;
|
||||||
import com.owncloud.android.utils.svg.SvgDrawableTranscoder;
|
import com.owncloud.android.utils.svg.SvgDrawableTranscoder;
|
||||||
import com.owncloud.android.utils.theme.ThemeColorUtils;
|
import com.owncloud.android.utils.theme.ThemeColorUtils;
|
||||||
import com.owncloud.android.utils.theme.ThemeDrawableUtils;
|
import com.owncloud.android.utils.theme.ThemeDrawableUtils;
|
||||||
|
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
|
@ -846,8 +847,7 @@ public final class DisplayUtils {
|
||||||
Context context,
|
Context context,
|
||||||
LoaderImageView shimmerThumbnail,
|
LoaderImageView shimmerThumbnail,
|
||||||
AppPreferences preferences,
|
AppPreferences preferences,
|
||||||
ThemeColorUtils themeColorUtils,
|
ViewThemeUtils viewThemeUtils) {
|
||||||
ThemeDrawableUtils themeDrawableUtils) {
|
|
||||||
if (file.isFolder()) {
|
if (file.isFolder()) {
|
||||||
stopShimmer(shimmerThumbnail, thumbnailView);
|
stopShimmer(shimmerThumbnail, thumbnailView);
|
||||||
thumbnailView.setImageDrawable(MimeTypeUtil
|
thumbnailView.setImageDrawable(MimeTypeUtil
|
||||||
|
@ -857,8 +857,7 @@ public final class DisplayUtils {
|
||||||
file.isGroupFolder(),
|
file.isGroupFolder(),
|
||||||
file.getMountType(),
|
file.getMountType(),
|
||||||
context,
|
context,
|
||||||
themeColorUtils,
|
viewThemeUtils));
|
||||||
themeDrawableUtils));
|
|
||||||
} else {
|
} else {
|
||||||
if (file.getRemoteId() != null && file.isPreviewAvailable()) {
|
if (file.getRemoteId() != null && file.isPreviewAvailable()) {
|
||||||
// Thumbnail in cache?
|
// Thumbnail in cache?
|
||||||
|
@ -901,8 +900,7 @@ public final class DisplayUtils {
|
||||||
file.getFileName(),
|
file.getFileName(),
|
||||||
user,
|
user,
|
||||||
context,
|
context,
|
||||||
themeColorUtils,
|
viewThemeUtils);
|
||||||
themeDrawableUtils);
|
|
||||||
if (drawable == null) {
|
if (drawable == null) {
|
||||||
drawable = ResourcesCompat.getDrawable(context.getResources(),
|
drawable = ResourcesCompat.getDrawable(context.getResources(),
|
||||||
R.drawable.file_image,
|
R.drawable.file_image,
|
||||||
|
@ -954,8 +952,7 @@ public final class DisplayUtils {
|
||||||
file.getFileName(),
|
file.getFileName(),
|
||||||
user,
|
user,
|
||||||
context,
|
context,
|
||||||
themeColorUtils,
|
viewThemeUtils));
|
||||||
themeDrawableUtils));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,8 +28,7 @@ import com.owncloud.android.R;
|
||||||
import com.owncloud.android.datamodel.OCFile;
|
import com.owncloud.android.datamodel.OCFile;
|
||||||
import com.owncloud.android.lib.common.network.WebdavEntry;
|
import com.owncloud.android.lib.common.network.WebdavEntry;
|
||||||
import com.owncloud.android.lib.resources.files.model.ServerFileInterface;
|
import com.owncloud.android.lib.resources.files.model.ServerFileInterface;
|
||||||
import com.owncloud.android.utils.theme.ThemeColorUtils;
|
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
|
||||||
import com.owncloud.android.utils.theme.ThemeDrawableUtils;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -95,9 +94,8 @@ public final class MimeTypeUtil {
|
||||||
public static Drawable getFileTypeIcon(String mimetype,
|
public static Drawable getFileTypeIcon(String mimetype,
|
||||||
String filename,
|
String filename,
|
||||||
Context context,
|
Context context,
|
||||||
ThemeColorUtils themeColorUtils,
|
ViewThemeUtils viewThemeUtils) {
|
||||||
ThemeDrawableUtils themeDrawableUtils) {
|
return getFileTypeIcon(mimetype, filename, null, context, viewThemeUtils);
|
||||||
return getFileTypeIcon(mimetype, filename, null, context, themeColorUtils, themeDrawableUtils);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -113,14 +111,13 @@ public final class MimeTypeUtil {
|
||||||
String filename,
|
String filename,
|
||||||
@Nullable User user,
|
@Nullable User user,
|
||||||
Context context,
|
Context context,
|
||||||
ThemeColorUtils themeColorUtils,
|
ViewThemeUtils viewThemeUtils) {
|
||||||
ThemeDrawableUtils themeDrawableUtils) {
|
|
||||||
if (context != null) {
|
if (context != null) {
|
||||||
int iconId = MimeTypeUtil.getFileTypeIconId(mimetype, filename);
|
int iconId = MimeTypeUtil.getFileTypeIconId(mimetype, filename);
|
||||||
Drawable icon = ContextCompat.getDrawable(context, iconId);
|
Drawable icon = ContextCompat.getDrawable(context, iconId);
|
||||||
|
|
||||||
if (R.drawable.file_zip == iconId) {
|
if (R.drawable.file_zip == iconId) {
|
||||||
themeDrawableUtils.tintDrawable(icon, themeColorUtils.primaryColor(user, true, context));
|
viewThemeUtils.platform.tintPrimaryDrawable(context, icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
return icon;
|
return icon;
|
||||||
|
@ -160,8 +157,7 @@ public final class MimeTypeUtil {
|
||||||
boolean isGroupfolder,
|
boolean isGroupfolder,
|
||||||
WebdavEntry.MountType mountType,
|
WebdavEntry.MountType mountType,
|
||||||
Context context,
|
Context context,
|
||||||
ThemeColorUtils themeColorUtils,
|
ViewThemeUtils viewThemeUtils) {
|
||||||
ThemeDrawableUtils themeDrawableUtils) {
|
|
||||||
return getFolderTypeIcon(isSharedViaUsers,
|
return getFolderTypeIcon(isSharedViaUsers,
|
||||||
isSharedViaLink,
|
isSharedViaLink,
|
||||||
isEncrypted,
|
isEncrypted,
|
||||||
|
@ -169,8 +165,7 @@ public final class MimeTypeUtil {
|
||||||
null,
|
null,
|
||||||
mountType,
|
mountType,
|
||||||
context,
|
context,
|
||||||
themeColorUtils,
|
viewThemeUtils);
|
||||||
themeDrawableUtils);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -189,8 +184,7 @@ public final class MimeTypeUtil {
|
||||||
@Nullable User user,
|
@Nullable User user,
|
||||||
WebdavEntry.MountType mountType,
|
WebdavEntry.MountType mountType,
|
||||||
Context context,
|
Context context,
|
||||||
ThemeColorUtils themeColorUtils,
|
ViewThemeUtils viewThemeUtils) {
|
||||||
ThemeDrawableUtils themeDrawableUtils) {
|
|
||||||
int drawableId;
|
int drawableId;
|
||||||
|
|
||||||
if (isSharedViaLink) {
|
if (isSharedViaLink) {
|
||||||
|
@ -207,26 +201,22 @@ public final class MimeTypeUtil {
|
||||||
drawableId = R.drawable.folder;
|
drawableId = R.drawable.folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
int color = themeColorUtils.primaryColor(user != null ? user.toPlatformAccount() : null,
|
Drawable drawable = ContextCompat.getDrawable(context, drawableId);
|
||||||
true,
|
viewThemeUtils.platform.tintPrimaryDrawable(context, drawable);
|
||||||
context);
|
return drawable;
|
||||||
return themeDrawableUtils.tintDrawable(drawableId, color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Drawable getDefaultFolderIcon(Context context,
|
public static Drawable getDefaultFolderIcon(Context context,
|
||||||
ThemeColorUtils themeColorUtils,
|
ViewThemeUtils viewThemeUtils) {
|
||||||
ThemeDrawableUtils themeDrawableUtils) {
|
|
||||||
return getFolderTypeIcon(false,
|
return getFolderTypeIcon(false,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
WebdavEntry.MountType.INTERNAL,
|
WebdavEntry.MountType.INTERNAL,
|
||||||
context,
|
context,
|
||||||
themeColorUtils,
|
viewThemeUtils);
|
||||||
themeDrawableUtils);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a single MIME type of all the possible, by inspection of the file extension, and taking
|
* 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.
|
* into account the MIME types known by ownCloud first.
|
||||||
|
|
|
@ -32,6 +32,7 @@ import com.owncloud.android.ui.activity.ComponentsGetter
|
||||||
import com.owncloud.android.ui.interfaces.OCFileListFragmentInterface
|
import com.owncloud.android.ui.interfaces.OCFileListFragmentInterface
|
||||||
import com.owncloud.android.utils.theme.ThemeColorUtils
|
import com.owncloud.android.utils.theme.ThemeColorUtils
|
||||||
import com.owncloud.android.utils.theme.ThemeDrawableUtils
|
import com.owncloud.android.utils.theme.ThemeDrawableUtils
|
||||||
|
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils
|
||||||
import junit.framework.Assert.assertEquals
|
import junit.framework.Assert.assertEquals
|
||||||
import org.junit.After
|
import org.junit.After
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
|
@ -66,6 +67,9 @@ class GalleryAdapterTest {
|
||||||
@Mock
|
@Mock
|
||||||
lateinit var themeDrawableUtils: ThemeDrawableUtils
|
lateinit var themeDrawableUtils: ThemeDrawableUtils
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
lateinit var viewThemeUtils: ViewThemeUtils
|
||||||
|
|
||||||
private lateinit var mocks: AutoCloseable
|
private lateinit var mocks: AutoCloseable
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
@ -89,7 +93,8 @@ class GalleryAdapterTest {
|
||||||
preferences,
|
preferences,
|
||||||
transferServiceGetter,
|
transferServiceGetter,
|
||||||
themeColorUtils,
|
themeColorUtils,
|
||||||
themeDrawableUtils
|
themeDrawableUtils,
|
||||||
|
viewThemeUtils
|
||||||
)
|
)
|
||||||
|
|
||||||
val list = listOf(
|
val list = listOf(
|
||||||
|
|
Loading…
Reference in a new issue