Add folder name in item layout and add date blue background

This commit is contained in:
Shinokuni 2019-03-20 11:08:03 +01:00
parent 8decb98e4f
commit 00ac9211fd
4 changed files with 63 additions and 25 deletions

View File

@ -124,6 +124,9 @@ public class ItemActivity extends AppCompatActivity {
else
toolbarLayout.setTitle(itemWithFeed.getFeedName());
if (itemWithFeed.getFolder().getId() != 1)
toolbar.setSubtitle(itemWithFeed.getFolder().getName());
title.setText(item.getTitle());
if (itemWithFeed.getBgColor() != 0)

View File

@ -57,7 +57,9 @@ public class MainItemListAdapter extends ListAdapter<ItemWithFeed, MainItemListA
Item item = itemWithFeed.getItem();
Item item1 = t1.getItem();
return item.getTitle().equals(item1.getTitle());
return item.getTitle().equals(item1.getTitle()) &&
itemWithFeed.getFeedName().equals(t1.getFeedName()) &&
itemWithFeed.getFolder().getName().equals(t1.getFolder().getName());
}
};
@ -117,6 +119,11 @@ public class MainItemListAdapter extends ListAdapter<ItemWithFeed, MainItemListA
viewHolder.itemReadTime.setText(resources.getString(R.string.read_time, String.valueOf(minutes)));
else
viewHolder.itemReadTime.setText(resources.getString(R.string.read_time_one_minute));
if (itemWithFeed.getFolder().getId() != 1)
viewHolder.itemFolderName.setText(itemWithFeed.getFolder().getName());
else
viewHolder.itemFolderName.setText(resources.getString(R.string.no_folder));
}
@Override
@ -163,6 +170,7 @@ public class MainItemListAdapter extends ListAdapter<ItemWithFeed, MainItemListA
private ImageView feedIcon;
private ImageView itemImage;
private TextView itemReadTime;
private TextView itemFolderName;
ItemViewHolder(@NonNull View itemView) {
super(itemView);
@ -181,6 +189,7 @@ public class MainItemListAdapter extends ListAdapter<ItemWithFeed, MainItemListA
feedIcon = itemView.findViewById(R.id.item_feed_icon);
itemImage = itemView.findViewById(R.id.item_image);
itemReadTime = itemView.findViewById(R.id.item_readtime);
itemFolderName = itemView.findViewById(R.id.item_folder_name);
}
private void bind(ItemWithFeed itemWithFeed) {

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/colorPrimary" />
<corners android:radius="20dp" />
</shape>

View File

@ -56,7 +56,6 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/layout_end"
android:layout_width="match_parent"
@ -69,7 +68,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_toLeftOf="@id/item_readtime_layout">
android:layout_toLeftOf="@id/item_date">
<ImageView
android:id="@+id/item_feed_icon"
@ -93,13 +92,53 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/item_date_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginStart="4dp"
android:background="@drawable/item_date_background"
android:paddingStart="8dp"
android:paddingTop="1dp"
android:paddingEnd="8dp"
android:paddingBottom="1dp">
<TextView
android:id="@+id/item_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/colorBackground"
tools:text="8 feb 2019" />
</RelativeLayout>
<ImageView
android:id="@+id/item_folder_icon"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_below="@id/item_feed_title_layout"
android:layout_alignParentStart="true"
android:layout_marginTop="6dp"
android:src="@drawable/ic_folder_grey" />
<TextView
android:id="@+id/item_folder_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/item_feed_title_layout"
android:layout_marginStart="6dp"
android:layout_marginTop="6dp"
android:layout_toEndOf="@id/item_folder_icon"
tools:text="Folder 1" />
<RelativeLayout
android:id="@+id/item_readtime_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginLeft="6dp"
android:layout_toLeftOf="@id/item_interpoint">
android:layout_below="@id/item_date_layout"
android:layout_alignParentEnd="true"
android:layout_marginTop="6dp">
<ImageView
android:id="@+id/item_readtime_icon"
@ -119,25 +158,6 @@
</RelativeLayout>
<TextView
android:id="@+id/item_interpoint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginLeft="4dp"
android:layout_toStartOf="@id/item_date"
android:text="@string/interpoint"
android:textStyle="bold" />
<TextView
android:id="@+id/item_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginStart="4dp"
android:layout_marginLeft="4dp"
tools:text="8 february 2019" />
</RelativeLayout>