diff options
author | stefan-niedermann <info@niedermann.it> | 2020-02-05 23:48:21 +0300 |
---|---|---|
committer | stefan-niedermann <info@niedermann.it> | 2020-02-05 23:48:21 +0300 |
commit | f2570e3eb0644c62f86002da2349b948d3864f0b (patch) | |
tree | 4eb33643a6dcaa8c69b73127cb1d732dee1f5396 | |
parent | a1f30434a409de17b381da6dc25bf579bd6e5cfb (diff) |
#211 Attachments 📎
Display sync status via icon
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/ui/card/AttachmentAdapter.java | 4 | ||||
-rw-r--r-- | app/src/main/res/layout/item_attachment.xml | 32 |
2 files changed, 27 insertions, 9 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/AttachmentAdapter.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/AttachmentAdapter.java index 0d6ee390b..f58eea80a 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/AttachmentAdapter.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/AttachmentAdapter.java @@ -22,6 +22,7 @@ import butterknife.ButterKnife; import it.niedermann.nextcloud.deck.R; import it.niedermann.nextcloud.deck.model.Account; import it.niedermann.nextcloud.deck.model.Attachment; +import it.niedermann.nextcloud.deck.model.enums.DBStatus; import it.niedermann.nextcloud.deck.util.DeleteDialogBuilder; public class AttachmentAdapter extends RecyclerView.Adapter<AttachmentAdapter.AttachmentViewHolder> { @@ -53,6 +54,7 @@ public class AttachmentAdapter extends RecyclerView.Adapter<AttachmentAdapter.At @Override public void onBindViewHolder(@NonNull AttachmentViewHolder holder, int position) { Attachment attachment = attachments.get(position); + holder.notSyncedYet.setVisibility(attachment.getStatusEnum() == DBStatus.UP_TO_DATE ? View.GONE: View.VISIBLE); if (attachment.getMimetype().startsWith("image")) { // TODO Glide is currently not yet able to use SSO and fails on authentication // String uri = account.getUrl() + "/index.php/apps/deck/cards/" + cardRemoteId + "/attachment/" + attachment.getId(); @@ -93,6 +95,8 @@ public class AttachmentAdapter extends RecyclerView.Adapter<AttachmentAdapter.At } static class AttachmentViewHolder extends RecyclerView.ViewHolder { + @BindView(R.id.not_synced_yet) + AppCompatImageView notSyncedYet; @BindView(R.id.filetype) AppCompatImageView filetype; @BindView(R.id.filename) diff --git a/app/src/main/res/layout/item_attachment.xml b/app/src/main/res/layout/item_attachment.xml index e41786554..5fe90e029 100644 --- a/app/src/main/res/layout/item_attachment.xml +++ b/app/src/main/res/layout/item_attachment.xml @@ -8,16 +8,30 @@ android:orientation="horizontal" android:padding="@dimen/standard_half_padding"> - <androidx.appcompat.widget.AppCompatImageView - android:id="@+id/filetype" + <FrameLayout android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:layout_marginStart="@dimen/standard_half_margin" - android:layout_marginLeft="@dimen/standard_half_margin" - android:layout_marginEnd="@dimen/standard_margin" - android:layout_marginRight="@dimen/standard_margin" - app:srcCompat="@drawable/ic_attach_file_grey600_24dp" /> + android:layout_height="match_parent" + android:layout_marginEnd="@dimen/standard_half_margin" + android:layout_marginRight="@dimen/standard_half_margin"> + + <androidx.appcompat.widget.AppCompatImageView + android:id="@+id/filetype" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:layout_margin="@dimen/standard_half_margin" + app:srcCompat="@drawable/ic_attach_file_grey600_24dp" /> + + <androidx.appcompat.widget.AppCompatImageView + android:id="@+id/not_synced_yet" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="bottom|end" + android:translationY="-8dp" + android:visibility="gone" + app:srcCompat="@drawable/ic_sync_blue_24dp" + tools:visibility="visible" /> + </FrameLayout> <TextView android:id="@+id/filename" |