From 98061314a62706834bb34d6a8457549b8cbe690c Mon Sep 17 00:00:00 2001 From: Jakob Nixdorf Date: Sat, 14 Oct 2017 13:06:16 +0200 Subject: [PATCH] Use a custom style for all CardViews This fixes the crash in Lollipop when setting cardBackgroundColor manually Closes #47 --- app/src/main/res/layout/component_card.xml | 7 +-- app/src/main/res/layout/content_about.xml | 64 +++++++++++----------- app/src/main/res/values/styles.xml | 16 +++++- 3 files changed, 46 insertions(+), 41 deletions(-) diff --git a/app/src/main/res/layout/component_card.xml b/app/src/main/res/layout/component_card.xml index 04be7ca3..568b1611 100644 --- a/app/src/main/res/layout/component_card.xml +++ b/app/src/main/res/layout/component_card.xml @@ -1,15 +1,10 @@ + style="?attr/cardStyle" > + style="?attr/cardStyle" > + android:paddingBottom="@dimen/activity_margin_small" > + style="?attr/cardStyle" > + android:orientation="vertical" > @@ -123,7 +119,8 @@ android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="?android:attr/listPreferredItemHeight" - android:padding="@dimen/activity_margin_small" + android:paddingTop="@dimen/activity_margin_small" + android:paddingBottom="@dimen/activity_margin_small" android:background="?android:attr/selectableItemBackground" android:gravity="center_vertical" > @@ -163,7 +160,8 @@ android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="?android:attr/listPreferredItemHeight" - android:padding="@dimen/activity_margin_small" + android:paddingTop="@dimen/activity_margin_small" + android:paddingBottom="@dimen/activity_margin_small" android:background="?android:attr/selectableItemBackground" android:gravity="center_vertical" > @@ -190,7 +188,8 @@ android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="?android:attr/listPreferredItemHeight" - android:padding="@dimen/activity_margin_small" + android:paddingTop="@dimen/activity_margin_small" + android:paddingBottom="@dimen/activity_margin_small" android:background="?android:attr/selectableItemBackground" android:gravity="center_vertical" > @@ -217,7 +216,8 @@ android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="?android:attr/listPreferredItemHeight" - android:padding="@dimen/activity_margin_small" + android:paddingTop="@dimen/activity_margin_small" + android:paddingBottom="@dimen/activity_margin_small" android:background="?android:attr/selectableItemBackground" android:gravity="center_vertical" > @@ -244,20 +244,16 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="@dimen/activity_margin" - app:cardBackgroundColor="?cardBackgroundColor" - app:cardElevation="@dimen/card_elevation" > + style="?attr/cardStyle" > + android:orientation="vertical" > @@ -265,8 +261,9 @@ android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/activity_margin" - android:padding="@dimen/activity_margin_small" + android:layout_marginTop="@dimen/activity_margin_small" + android:paddingTop="@dimen/activity_margin_small" + android:paddingBottom="@dimen/activity_margin_small" android:background="?android:attr/selectableItemBackground" android:gravity="center_vertical" > @@ -339,7 +336,8 @@ android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" - android:padding="@dimen/activity_margin_small" + android:paddingTop="@dimen/activity_margin_small" + android:paddingBottom="@dimen/activity_margin_small" android:background="?android:attr/selectableItemBackground" android:gravity="center_vertical" > @@ -413,7 +411,8 @@ android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="?android:attr/listPreferredItemHeight" - android:padding="@dimen/activity_margin_small" + android:paddingTop="@dimen/activity_margin_small" + android:paddingBottom="@dimen/activity_margin_small" android:background="?android:attr/selectableItemBackground" android:gravity="center_vertical" > @@ -440,7 +439,8 @@ android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="?android:attr/listPreferredItemHeight" - android:padding="@dimen/activity_margin_small" + android:paddingTop="@dimen/activity_margin_small" + android:paddingBottom="@dimen/activity_margin_small" android:background="?android:attr/selectableItemBackground" android:gravity="center_vertical" > @@ -468,20 +468,16 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="@dimen/activity_margin" - app:cardBackgroundColor="?cardBackgroundColor" - app:cardElevation="@dimen/card_elevation" > + style="?attr/cardStyle" > + android:orientation="vertical" > @@ -491,7 +487,8 @@ android:layout_width="match_parent" android:layout_height="?android:attr/listPreferredItemHeight" android:layout_marginTop="@dimen/activity_margin" - android:padding="@dimen/activity_margin_small" + android:paddingTop="@dimen/activity_margin_small" + android:paddingBottom="@dimen/activity_margin_small" android:background="?android:attr/selectableItemBackground" android:gravity="center_vertical" > @@ -531,7 +528,8 @@ android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="?android:attr/listPreferredItemHeight" - android:padding="@dimen/activity_margin_small" + android:paddingTop="@dimen/activity_margin_small" + android:paddingBottom="@dimen/activity_margin_small" android:background="?android:attr/selectableItemBackground" android:gravity="center_vertical" > diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index f872e031..d0679b57 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -1,6 +1,7 @@ + @@ -19,7 +20,7 @@ @color/github_dark @color/paypal_dark - ?android:colorBackgroundFloating + @style/CardViewStyle + + + +