Rename view holder interface for prevent confusion

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2024-08-15 15:55:48 +02:00
parent 5dab3e81fb
commit 8f0da11fb6
No known key found for this signature in database
GPG key ID: 4E577DC593B59BDF
5 changed files with 25 additions and 25 deletions

View file

@ -9,6 +9,6 @@ package com.owncloud.android.ui.adapter
import android.widget.TextView
internal interface ListGridItemViewHolder : ListGridImageViewHolder {
internal interface ListGridItemViewHolder : ListViewHolder {
val fileName: TextView
}

View file

@ -14,7 +14,7 @@ import android.widget.LinearLayout
import android.widget.TextView
import com.elyeproj.loaderviewlibrary.LoaderImageView
interface ListGridImageViewHolder {
interface ListViewHolder {
val thumbnail: ImageView
fun showVideoOverlay()
val shimmerThumbnail: LoaderImageView

View file

@ -99,8 +99,8 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
private static final int showFilenameColumnThreshold = 4;
private final String userId;
private Activity activity;
private AppPreferences preferences;
private final Activity activity;
private final AppPreferences preferences;
private List<OCFile> mFiles = new ArrayList<>();
private List<OCFile> mFilesAll = new ArrayList<>();
private boolean hideItemOptions;
@ -109,7 +109,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
public ArrayList<String> listOfHiddenFiles = new ArrayList<>();
private FileDataStorageManager mStorageManager;
private User user;
private OCFileListFragmentInterface ocFileListFragmentInterface;
private final OCFileListFragmentInterface ocFileListFragmentInterface;
private OCFile currentDirectory;
@ -384,7 +384,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
}
case VIEWTYPE_IMAGE -> {
if (gridView) {
return new OCFileListGridImageViewHolder(
return new OCFileListViewHolder(
GridImageBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)
);
} else {
@ -425,7 +425,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
PreviewTextFragment.setText(headerViewHolder.getHeaderText(), text, null, activity, true, true, viewThemeUtils);
headerViewHolder.getHeaderView().setOnClickListener(v -> ocFileListFragmentInterface.onHeaderClicked());
} else {
ListGridImageViewHolder gridViewHolder = (ListGridImageViewHolder) holder;
ListViewHolder gridViewHolder = (ListViewHolder) holder;
OCFile file = getItem(position);
if (file == null) {
@ -451,7 +451,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
}
}
private void checkVisibilityOfFileFeaturesLayout(ListGridImageViewHolder holder) {
private void checkVisibilityOfFileFeaturesLayout(ListViewHolder holder) {
int fileFeaturesVisibility = View.GONE;
LinearLayout fileFeaturesLayout = holder.getFileFeaturesLayout();
@ -469,7 +469,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
fileFeaturesLayout.setVisibility(fileFeaturesVisibility);
}
private void checkVisibilityOfMoreButtons(ListGridImageViewHolder holder) {
private void checkVisibilityOfMoreButtons(ListViewHolder holder) {
ImageButton moreButton = holder.getMore();
if (moreButton == null) {
return;
@ -509,13 +509,13 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
filesToRemove.clear();
}
private void updateLivePhotoIndicators(ListGridImageViewHolder holder, OCFile file) {
private void updateLivePhotoIndicators(ListViewHolder holder, OCFile file) {
boolean isLivePhoto = file.getLinkedFileIdForLivePhoto() != null;
if (holder instanceof OCFileListItemViewHolder) {
holder.getLivePhotoIndicator().setVisibility(isLivePhoto ? (View.VISIBLE) : (View.GONE));
holder.getLivePhotoIndicatorSeparator().setVisibility(isLivePhoto ? (View.VISIBLE) : (View.GONE));
} else if (holder instanceof OCFileListGridImageViewHolder) {
} else if (holder instanceof OCFileListViewHolder) {
holder.getGridLivePhotoIndicator().setVisibility(isLivePhoto ? (View.VISIBLE) : (View.GONE));
}
}
@ -669,7 +669,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
setColorFilterForOfflineOperations(holder, file);
}
private void setColorFilterForOfflineOperations(ListGridImageViewHolder holder, OCFile file) {
private void setColorFilterForOfflineOperations(ListViewHolder holder, OCFile file) {
if (!file.isFolder()) {
return;
}
@ -684,8 +684,8 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
@Override
public void onViewAttachedToWindow(@NonNull RecyclerView.ViewHolder holder) {
if (holder instanceof ListGridImageViewHolder) {
LoaderImageView thumbnailShimmer = ((ListGridImageViewHolder) holder).getShimmerThumbnail();
if (holder instanceof ListViewHolder) {
LoaderImageView thumbnailShimmer = ((ListViewHolder) holder).getShimmerThumbnail();
if (thumbnailShimmer.getVisibility() == View.VISIBLE) {
thumbnailShimmer.setImageResource(R.drawable.background);
thumbnailShimmer.resetLoader();

View file

@ -195,7 +195,7 @@ class OCFileListDelegate(
}
fun bindGridViewHolder(
gridViewHolder: ListGridImageViewHolder,
gridViewHolder: ListViewHolder,
file: OCFile,
currentDirectory: OCFile?,
searchType: SearchType?
@ -253,7 +253,7 @@ class OCFileListDelegate(
}
}
private fun bindUnreadComments(file: OCFile, gridViewHolder: ListGridImageViewHolder) {
private fun bindUnreadComments(file: OCFile, gridViewHolder: ListViewHolder) {
if (file.unreadCommentsCount > 0) {
gridViewHolder.unreadComments.visibility = View.VISIBLE
gridViewHolder.unreadComments.setOnClickListener {
@ -265,7 +265,7 @@ class OCFileListDelegate(
}
}
private fun bindGridItemLayout(file: OCFile, gridViewHolder: ListGridImageViewHolder) {
private fun bindGridItemLayout(file: OCFile, gridViewHolder: ListViewHolder) {
setItemLayoutBackgroundColor(file, gridViewHolder)
setCheckBoxImage(file, gridViewHolder)
setItemLayoutOnClickListeners(file, gridViewHolder)
@ -275,7 +275,7 @@ class OCFileListDelegate(
}
}
private fun setItemLayoutOnClickListeners(file: OCFile, gridViewHolder: ListGridImageViewHolder) {
private fun setItemLayoutOnClickListeners(file: OCFile, gridViewHolder: ListViewHolder) {
gridViewHolder.itemLayout.setOnClickListener { ocFileListFragmentInterface.onItemClicked(file) }
if (!hideItemOptions) {
@ -290,7 +290,7 @@ class OCFileListDelegate(
}
}
private fun setItemLayoutBackgroundColor(file: OCFile, gridViewHolder: ListGridImageViewHolder) {
private fun setItemLayoutBackgroundColor(file: OCFile, gridViewHolder: ListViewHolder) {
val cornerRadius = context.resources.getDimension(R.dimen.selected_grid_container_radius)
val isDarkModeActive = (syncFolderProvider?.preferences?.isDarkModeEnabled == true)
@ -313,7 +313,7 @@ class OCFileListDelegate(
}
}
private fun setCheckBoxImage(file: OCFile, gridViewHolder: ListGridImageViewHolder) {
private fun setCheckBoxImage(file: OCFile, gridViewHolder: ListViewHolder) {
if (isCheckedFile(file)) {
gridViewHolder.checkbox.setImageDrawable(
viewThemeUtils.platform.tintDrawable(context, R.drawable.ic_checkbox_marked, ColorRole.PRIMARY)
@ -323,7 +323,7 @@ class OCFileListDelegate(
}
}
private fun bindGridMetadataViews(file: OCFile, gridViewHolder: ListGridImageViewHolder) {
private fun bindGridMetadataViews(file: OCFile, gridViewHolder: ListViewHolder) {
if (showMetadata) {
showLocalFileIndicator(file, gridViewHolder)
gridViewHolder.favorite.visibility = if (file.isFavorite) View.VISIBLE else View.GONE
@ -333,7 +333,7 @@ class OCFileListDelegate(
}
}
private fun showLocalFileIndicator(file: OCFile, gridViewHolder: ListGridImageViewHolder) {
private fun showLocalFileIndicator(file: OCFile, gridViewHolder: ListViewHolder) {
val operationsServiceBinder = transferServiceGetter.operationsServiceBinder
val icon: Int? = when {
@ -365,7 +365,7 @@ class OCFileListDelegate(
}
}
private fun showShareIcon(gridViewHolder: ListGridImageViewHolder, file: OCFile) {
private fun showShareIcon(gridViewHolder: ListViewHolder, file: OCFile) {
val sharedIconView = gridViewHolder.shared
if (gridViewHolder is OCFileListItemViewHolder || file.unreadCommentsCount == 0) {
sharedIconView.visibility = View.VISIBLE

View file

@ -16,11 +16,11 @@ import androidx.recyclerview.widget.RecyclerView
import com.elyeproj.loaderviewlibrary.LoaderImageView
import com.owncloud.android.databinding.GridImageBinding
internal class OCFileListGridImageViewHolder(var binding: GridImageBinding) :
internal class OCFileListViewHolder(var binding: GridImageBinding) :
RecyclerView.ViewHolder(
binding.root
),
ListGridImageViewHolder {
ListViewHolder {
override val thumbnail: ImageView
get() = binding.thumbnail