Fix item layout warnings and reorganize its view hierarchy
This commit is contained in:
parent
8e6f1614bd
commit
14c7d641da
@ -9,7 +9,6 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@ -139,15 +138,15 @@ public class MainItemListAdapter extends PagedListAdapter<ItemWithFeed, MainItem
|
||||
|
||||
if (itemWithFeed.getBgColor() != 0) {
|
||||
viewHolder.feedName.setTextColor(itemWithFeed.getBgColor());
|
||||
Utils.setDrawableColor(viewHolder.dateLayout.getBackground(), itemWithFeed.getBgColor());
|
||||
Utils.setDrawableColor(viewHolder.date.getBackground(), itemWithFeed.getBgColor());
|
||||
|
||||
} else if (itemWithFeed.getColor() != 0) {
|
||||
viewHolder.feedName.setTextColor(itemWithFeed.getColor());
|
||||
Utils.setDrawableColor(viewHolder.dateLayout.getBackground(), itemWithFeed.getColor());
|
||||
Utils.setDrawableColor(viewHolder.date.getBackground(), itemWithFeed.getColor());
|
||||
|
||||
} else if (itemWithFeed.getBgColor() == 0 && itemWithFeed.getColor() == 0) {
|
||||
viewHolder.feedName.setTextColor(resources.getColor(android.R.color.tab_indicator_text));
|
||||
Utils.setDrawableColor(viewHolder.dateLayout.getBackground(),
|
||||
Utils.setDrawableColor(viewHolder.date.getBackground(),
|
||||
ContextCompat.getColor(viewHolder.itemView.getContext(), R.color.colorPrimary));
|
||||
}
|
||||
|
||||
@ -274,7 +273,6 @@ public class MainItemListAdapter extends PagedListAdapter<ItemWithFeed, MainItem
|
||||
private ImageView itemImage;
|
||||
private TextView itemReadTime;
|
||||
private TextView itemFolderName;
|
||||
private RelativeLayout dateLayout;
|
||||
|
||||
View[] alphaViews;
|
||||
|
||||
@ -305,10 +303,9 @@ public class MainItemListAdapter extends PagedListAdapter<ItemWithFeed, MainItem
|
||||
itemImage = itemView.findViewById(R.id.item_image);
|
||||
itemReadTime = itemView.findViewById(R.id.item_readtime);
|
||||
itemFolderName = itemView.findViewById(R.id.item_folder_name);
|
||||
dateLayout = itemView.findViewById(R.id.item_date_layout);
|
||||
|
||||
alphaViews = new View[]{
|
||||
dateLayout,
|
||||
date,
|
||||
itemFolderName,
|
||||
feedIcon,
|
||||
feedName,
|
||||
|
@ -13,21 +13,14 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_toStartOf="@id/item_image"
|
||||
android:layout_toLeftOf="@id/item_image"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:minLines="1"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
tools:text="This is an item title with sufficient length" />
|
||||
<ImageView
|
||||
android:id="@+id/item_image"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="92dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="6dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_description"
|
||||
@ -36,23 +29,25 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/item_title"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_toStartOf="@id/item_image"
|
||||
android:layout_toLeftOf="@id/item_image"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="3"
|
||||
android:minLines="1"
|
||||
tools:text="This is an item description" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/item_image"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="92dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="6dp"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
<TextView
|
||||
android:id="@+id/item_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_toStartOf="@id/item_image"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:minLines="1"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
tools:text="This is an item title with sufficient length" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@ -63,56 +58,6 @@
|
||||
android:layout_below="@id/layout_start"
|
||||
android:layout_marginTop="6dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/item_feed_title_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_toLeftOf="@id/item_date_layout">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/item_feed_icon"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:src="@drawable/ic_rss_feed" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_feed_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_toRightOf="@id/item_feed_icon"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
tools:text="Numerama" />
|
||||
|
||||
</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"
|
||||
@ -122,21 +67,38 @@
|
||||
android:layout_marginTop="6dp"
|
||||
android:src="@drawable/ic_folder_grey" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_folder_name"
|
||||
<RelativeLayout
|
||||
android:id="@+id/item_feed_title_layout"
|
||||
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" />
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_toStartOf="@id/item_date">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/item_feed_icon"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:src="@drawable/ic_rss_feed" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_feed_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_toEndOf="@id/item_feed_icon"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
tools:text="Feed Name" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/item_readtime_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/item_date_layout"
|
||||
android:layout_below="@id/item_date"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="6dp">
|
||||
|
||||
@ -151,12 +113,34 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_toRightOf="@id/item_readtime_icon"
|
||||
android:layout_toEndOf="@id/item_readtime_icon"
|
||||
tools:text="3 mins" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<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:background="@drawable/item_date_background"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingBottom="1dp"
|
||||
android:textColor="@color/colorBackground"
|
||||
tools:text="8 feb 2019" />
|
||||
|
||||
<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>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user