diff options
author | Andy Scherzinger <info@andy-scherzinger.de> | 2019-03-12 19:39:25 +0300 |
---|---|---|
committer | Andy Scherzinger <info@andy-scherzinger.de> | 2019-03-12 19:39:25 +0300 |
commit | 7247b6e7d4496ef53044bec8da25c147ce4010cd (patch) | |
tree | a65397cc7a77f915714e3b549f91677e9e4b2292 | |
parent | b3f1ef5f5d703ca0eaeb62d07acb6048dae08d78 (diff) |
Add further details to cards
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/ui/card/CardAdapter.java | 18 | ||||
-rw-r--r-- | app/src/main/res/layout/fragment_card.xml | 67 | ||||
-rw-r--r-- | app/src/main/res/values/strings.xml | 3 |
3 files changed, 71 insertions, 17 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/CardAdapter.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/CardAdapter.java index cd59e9d6b..c37398ea6 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/CardAdapter.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/CardAdapter.java @@ -17,6 +17,7 @@ import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.ImageView; import android.widget.TextView; import java.util.ArrayList; @@ -85,8 +86,10 @@ public class CardAdapter extends RecyclerView.Adapter<CardAdapter.CardViewHolder if (card.getCard().getDescription() != null && !card.getCard().getDescription().isEmpty()) { viewHolder.cardDescription.setText(card.getCard().getDescription()); viewHolder.cardDescription.setVisibility(View.VISIBLE); + viewHolder.cardDescriptionIcon.setVisibility(View.VISIBLE); } else { viewHolder.cardDescription.setVisibility(View.GONE); + viewHolder.cardDescriptionIcon.setVisibility(View.GONE); } if (card.getCard().getDueDate() != null) { @@ -101,6 +104,17 @@ public class CardAdapter extends RecyclerView.Adapter<CardAdapter.CardViewHolder viewHolder.cardDueDate.setVisibility(View.GONE); } + if (card.getCard().getAttachmentCount() > 0) { + if (card.getCard().getAttachmentCount() > 99) { + viewHolder.cardCountAttachments.setText(context.getString(R.string.attachment_count_max_value)); + } else { + viewHolder.cardCountAttachments.setText(String.valueOf(card.getCard().getAttachmentCount())); + } + viewHolder.cardCountAttachments.setVisibility(View.VISIBLE); + } else { + viewHolder.cardCountAttachments.setVisibility(View.GONE); + } + Chip chip; viewHolder.labels.removeAllViews(); if (card.getLabels()!= null && card.getLabels().size() > 0) { @@ -210,8 +224,12 @@ public class CardAdapter extends RecyclerView.Adapter<CardAdapter.CardViewHolder TextView cardDescription; @BindView(R.id.labels) ChipGroup labels; + @BindView(R.id.card_description_icon) + ImageView cardDescriptionIcon; @BindView(R.id.card_due_date) TextView cardDueDate; + @BindView(R.id.card_count_attachments) + TextView cardCountAttachments; private CardViewHolder(View view) { super(view); diff --git a/app/src/main/res/layout/fragment_card.xml b/app/src/main/res/layout/fragment_card.xml index 0d43f437a..0f2e5d59c 100644 --- a/app/src/main/res/layout/fragment_card.xml +++ b/app/src/main/res/layout/fragment_card.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" android:id="@+id/card" android:layout_width="match_parent" android:layout_height="wrap_content" @@ -20,9 +20,9 @@ android:id="@+id/card_title" android:layout_width="match_parent" android:layout_height="wrap_content" - android:textSize="18sp" android:textColor="@color/black" - tools:text="Card Title"/> + android:textSize="18sp" + tools:text="Card Title" /> <TextView android:id="@+id/card_description" @@ -30,7 +30,7 @@ android:layout_height="wrap_content" android:ellipsize="end" android:maxLines="3" - tools:text="Card detailed description\nmultiline\n3 lines tops."/> + tools:text="Card detailed description\nmultiline\n3 lines tops." /> <com.google.android.material.chip.ChipGroup android:id="@+id/labels" @@ -38,20 +38,53 @@ android:layout_height="wrap_content" android:layout_marginTop="8dp" /> - <androidx.appcompat.widget.AppCompatTextView - android:id="@+id/card_due_date" - android:layout_width="wrap_content" + <LinearLayout + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="8dp" - android:gravity="center_vertical" - android:minLines="0" - android:maxLines="1" - android:drawablePadding="4dp" - android:padding="4dp" - app:drawableLeftCompat="@drawable/calendar_blank_grey600_24dp" - app:drawableStartCompat="@drawable/calendar_blank_grey600_24dp" - tools:text="in 16 days" - android:background="@drawable/due_tomorrow_background"/> + android:orientation="horizontal" + android:paddingTop="8dp"> + + <ImageView + android:id="@+id/card_description_icon" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:layout_marginEnd="16dp" + android:layout_marginRight="16dp" + android:contentDescription="@string/label_card_description" + app:srcCompat="@drawable/ic_format_align_left_black_24dp" /> + + <androidx.appcompat.widget.AppCompatTextView + android:id="@+id/card_due_date" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginEnd="12dp" + android:layout_marginRight="12dp" + android:background="@drawable/due_tomorrow_background" + android:drawablePadding="4dp" + android:gravity="center_vertical" + android:maxLines="1" + android:minLines="0" + android:padding="4dp" + app:drawableLeftCompat="@drawable/calendar_blank_grey600_24dp" + app:drawableStartCompat="@drawable/calendar_blank_grey600_24dp" + tools:text="in 16 days" /> + + <androidx.appcompat.widget.AppCompatTextView + android:id="@+id/card_count_attachments" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginEnd="12dp" + android:layout_marginRight="12dp" + android:drawablePadding="4dp" + android:gravity="center_vertical" + android:maxLines="1" + android:minLines="0" + android:padding="4dp" + app:drawableLeftCompat="@drawable/ic_folder_grey600_24dp" + app:drawableStartCompat="@drawable/ic_folder_grey600_24dp" + tools:text="1" /> + </LinearLayout> </LinearLayout> </com.google.android.material.card.MaterialCardView>
\ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6482435f6..1c6caa807 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -61,4 +61,7 @@ <string name="create_card">Create card</string> <string name="create_stack">Create stack</string> <string name="create_board">Create board</string> + + <string name="label_card_description">has a description</string> + <string name="attachment_count_max_value" translatable="false">+99</string> </resources> |