Add support for cardview

This commit is contained in:
David Luhmer 2017-11-07 21:21:24 +01:00
parent c211a3915d
commit 02ddf09f64
4 changed files with 164 additions and 0 deletions

View file

@ -106,6 +106,7 @@ dependencies {
compile "com.android.support:palette-v7:${SUPPORT_VERSION}"
compile "com.android.support:recyclerview-v7:${SUPPORT_VERSION}"
compile "com.android.support:customtabs:${SUPPORT_VERSION}"
compile "com.android.support:cardview-v7:${SUPPORT_VERSION}"
compile 'de.mrmaffen:holocircularprogressbar:1.0.1'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
compile 'com.google.code.gson:gson:2.8.0'

View file

@ -174,6 +174,9 @@ public class NewsListRecyclerAdapter extends RecyclerView.Adapter {
case 2:
layout = R.layout.subscription_detail_list_item_extended_webview;
break;
case 4:
layout = R.layout.subscription_detail_list_item_extended_cardview;
break;
}
View view = LayoutInflater.from(parent.getContext()).inflate(layout, parent, false);

View file

@ -0,0 +1,158 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_margin="10dp"
android:layout_width="match_parent"
card_view:cardCornerRadius="4dp"
android:id="@+id/scrap_trailer_container"
android:layout_height="wrap_content"
>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/container"
android:background="?attr/selectableItemBackground">
<View
android:id="@+id/color_line_feed"
android:layout_height="match_parent"
android:layout_width="4dp"
android:visibility="gone"
android:background="?attr/dividerLineColor"
/>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_marginStart="@dimen/listview_row_margin_left"
android:layout_marginLeft="@dimen/listview_row_margin_left"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"
android:layout_marginTop="@dimen/listview_row_margin_top"
android:layout_marginBottom="@dimen/listview_row_margin_bottom"
android:id="@+id/list_item_header">
<!--
android:background="@drawable/checkbox_background"
android:button="@drawable/checkbox"
-->
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:id="@+id/imgViewFavIcon"
tools:src="@drawable/default_feed_icon_light"
android:layout_alignStart="@+id/summary"
android:layout_alignLeft="@+id/summary"
android:layout_marginTop="3dp"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:contentDescription="@string/content_desc_none"/>
<TextView
android:id="@+id/tv_subscription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="center_vertical|start"
android:singleLine="true"
tools:text="Subscription"
android:textSize="15sp"
android:textAlignment="viewStart"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/imgViewFavIcon"
android:layout_toEndOf="@+id/imgViewFavIcon"
android:layout_toLeftOf="@+id/tv_item_date"
android:layout_toStartOf="@+id/tv_item_date" />
<TextView
android:id="@+id/tv_item_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:layout_gravity="end"
tools:text="21.09.2013"
android:singleLine="true"
android:textSize="15sp"
android:layout_marginEnd="@dimen/listview_row_margin_right"
android:layout_marginRight="@dimen/listview_row_margin_left"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"/>
<TextView
android:id="@+id/summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="center_vertical|start"
android:textAlignment="viewStart"
android:textSize="17sp"
tools:text="Summary"
android:textStyle="bold"
android:layout_below="@+id/imgViewFavIcon"
android:layout_toStartOf="@+id/podcast_wrapper"
android:maxLines="4"
android:layout_marginTop="5dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/podcast_wrapper"/>
<TextView
android:id="@+id/body"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="start"
android:textAlignment="viewStart"
android:ellipsize="end"
tools:text="Body"
android:textColor="?attr/extended_listview_item_body_text_color"
android:textSize="14sp"
android:autoLink="none"
android:layout_below="@+id/summary"
android:maxLines="4"
android:layout_marginTop="5dp"
android:paddingBottom="@dimen/listview_row_margin_bottom"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/podcast_wrapper"
android:layout_toStartOf="@+id/podcast_wrapper"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/star_imageview"
android:layout_marginTop="15dp"
android:paddingTop="20dp"
android:paddingBottom="20dp"
android:paddingLeft="8dp"
android:paddingStart="8dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_action_star_light"
android:tint="?attr/starredColor"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:paddingEnd="@dimen/listview_row_margin_left"
android:paddingRight="@dimen/listview_row_margin_left"
android:contentDescription="@string/content_desc_add_to_favorites"/>
<include
layout="@layout/subscription_detail_list_item_podcast_wrapper"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:layout_marginTop="22dp"
android:id="@+id/podcast_wrapper"
android:layout_toLeftOf="@id/star_imageview"
android:layout_toStartOf="@id/star_imageview" />
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.CardView>

View file

@ -185,12 +185,14 @@
<item>Extended</item>
<item>Extended (full text)</item>
<item>Extended with Webview</item>
<item>Extended with Cardview</item>
</string-array>
<string-array name="pref_display_feed_list_layout_values" translatable="false">
<item>0</item>
<item>1</item>
<item>3</item>
<item>2</item>
<item>4</item>
</string-array>
<string-array name="pref_title_lines_count">
<item>1</item>