Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/stefan-niedermann/nextcloud-deck.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/it/niedermann/nextcloud/deck/ui/card/attachments/AttachmentViewHolder.java')
-rw-r--r--app/src/main/java/it/niedermann/nextcloud/deck/ui/card/attachments/AttachmentViewHolder.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/attachments/AttachmentViewHolder.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/attachments/AttachmentViewHolder.java
index 977035940..85c84dc00 100644
--- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/attachments/AttachmentViewHolder.java
+++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/attachments/AttachmentViewHolder.java
@@ -4,6 +4,7 @@ import android.view.MenuInflater;
import android.view.View;
import android.widget.ImageView;
+import androidx.annotation.CallSuper;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -31,7 +32,8 @@ public abstract class AttachmentViewHolder extends RecyclerView.ViewHolder {
? attachment.getLocalPath()
: AttachmentUtil.getCopyDownloadUrl(account, cardRemoteId, attachment);
- setNotSyncedYetStatus(!DBStatus.LOCAL_EDITED.equals(attachment.getStatusEnum()), color);
+ final var synced = !DBStatus.LOCAL_EDITED.equals(attachment.getStatusEnum());
+ getNotSyncedYetStatusIcon().setVisibility(synced ? View.GONE : View.VISIBLE);
itemView.setOnCreateContextMenuListener((menu, v, menuInfo) -> {
menuInflater.inflate(R.menu.attachment_menu, menu);
if (EAttachmentType.DECK_FILE.equals(attachment.getType())) {
@@ -50,17 +52,18 @@ public abstract class AttachmentViewHolder extends RecyclerView.ViewHolder {
menu.findItem(android.R.id.copyUrl).setOnMenuItemClickListener(item -> ClipboardUtil.copyToClipboard(itemView.getContext(), attachment.getFilename(), attachmentUri));
}
});
- }
- abstract protected ImageView getPreview();
+ applyTheme(color);
+ }
- protected void setNotSyncedYetStatus(boolean synced, @ColorInt int color) {
- final var notSyncedYet = getNotSyncedYetStatusIcon();
- final var utils = ThemeUtils.of(color, notSyncedYet.getContext());
+ @CallSuper
+ protected void applyTheme(@ColorInt int color) {
+ final var utils = ThemeUtils.of(color, getPreview().getContext());
- utils.platform.colorImageView(notSyncedYet, ColorRole.PRIMARY);
- notSyncedYet.setVisibility(synced ? View.GONE : View.VISIBLE);
+ utils.platform.colorImageView(getNotSyncedYetStatusIcon(), ColorRole.PRIMARY);
}
+ abstract protected ImageView getPreview();
+
abstract protected ImageView getNotSyncedYetStatusIcon();
} \ No newline at end of file