summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDake Gu <dake@google.com>2015-10-08 11:42:49 -0700
committerDake Gu <dake@google.com>2015-10-08 11:59:50 -0700
commit2157e7f4ece543b3aca6a9befece9a21bbfcac09 (patch)
tree99f8e450fe49c195cd6ce22620ce8297df915425
parent052b1d4aeb2221a4efc0d260c7d5054d8141957b (diff)
downloadandroid_development-2157e7f4ece543b3aca6a9befece9a21bbfcac09.tar.gz
android_development-2157e7f4ece543b3aca6a9befece9a21bbfcac09.tar.bz2
android_development-2157e7f4ece543b3aca6a9befece9a21bbfcac09.zip
SupportLeanbackShowcase: get rid of card view background overdraw
Change-Id: I3a46d34df265eda2cf38bfca80d3786aa5a8a23b
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/CharacterCardView.java3
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/TextCardView.java2
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/SideInfoCardPresenter.java4
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/layout/side_info_card.xml88
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/values/styles.xml21
5 files changed, 66 insertions, 52 deletions
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/CharacterCardView.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/CharacterCardView.java
index 0486a4259..962adb007 100644
--- a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/CharacterCardView.java
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/CharacterCardView.java
@@ -30,7 +30,7 @@ import android.widget.TextView;
public class CharacterCardView extends BaseCardView {
public CharacterCardView(Context context) {
- super(context);
+ super(context, null, R.style.CharacterCardStyle);
LayoutInflater.from(getContext()).inflate(R.layout.character_card, this);
setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
@@ -47,7 +47,6 @@ public class CharacterCardView extends BaseCardView {
}
});
setFocusable(true);
- setBackground(null);
}
public void updateUi(Card card) {
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/TextCardView.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/TextCardView.java
index ed1dd4a80..830b47441 100644
--- a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/TextCardView.java
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/TextCardView.java
@@ -29,7 +29,7 @@ import android.widget.TextView;
public class TextCardView extends BaseCardView {
public TextCardView(Context context) {
- super(context);
+ super(context, null, R.style.TextCardStyle);
LayoutInflater.from(getContext()).inflate(R.layout.text_icon_card, this);
setFocusable(true);
}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/SideInfoCardPresenter.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/SideInfoCardPresenter.java
index 914adb0f7..b9f44fc43 100644
--- a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/SideInfoCardPresenter.java
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/SideInfoCardPresenter.java
@@ -39,9 +39,9 @@ public class SideInfoCardPresenter extends AbstractCardPresenter<BaseCardView> {
@Override
protected BaseCardView onCreateView() {
- final BaseCardView cardView = new BaseCardView(getContext());
+ final BaseCardView cardView = new BaseCardView(getContext(), null,
+ R.style.SideInfoCardStyle);
cardView.setFocusable(true);
- cardView.setCardType(BaseCardView.CARD_TYPE_MAIN_ONLY);
cardView.addView(LayoutInflater.from(getContext()).inflate(R.layout.side_info_card, null));
return cardView;
}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/layout/side_info_card.xml b/samples/SupportLeanbackShowcase/app/src/main/res/layout/side_info_card.xml
index c9ec7cab1..725af09fb 100644
--- a/samples/SupportLeanbackShowcase/app/src/main/res/layout/side_info_card.xml
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/layout/side_info_card.xml
@@ -14,55 +14,51 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:lb="http://schemas.android.com/apk/res-auto"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:background="@color/default_card_footer_background_color">
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:lb="http://schemas.android.com/apk/res-auto"
+ android:id="@+id/container"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
- <LinearLayout
- android:id="@+id/container"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal">
-
- <ImageView
- android:id="@+id/main_image"
- android:layout_width="144dp"
- android:layout_height="144dp"
- lb:layout_viewType="main"
- />
+ <ImageView
+ android:id="@+id/main_image"
+ android:layout_width="144dp"
+ android:layout_height="144dp"
+ lb:layout_viewType="main"
+ />
- <LinearLayout
- android:id="@+id/info"
- android:layout_width="144dp"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:paddingLeft="11dp"
- android:paddingRight="11dp"
- android:paddingTop="7dp">
+ <LinearLayout
+ android:id="@+id/info"
+ android:layout_width="144dp"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:paddingLeft="11dp"
+ android:paddingRight="11dp"
+ android:paddingTop="7dp"
+ android:background="@color/default_card_footer_background_color">
- <TextView
- android:id="@+id/primary_text"
- style="@style/Widget.Leanback.ImageCardView.TitleStyle"
- android:fontFamily="sans-serif-condensed"
- android:maxLines="2"
- android:textSize="16sp"/>
+ <TextView
+ android:id="@+id/primary_text"
+ style="@style/Widget.Leanback.ImageCardView.TitleStyle"
+ android:fontFamily="sans-serif-condensed"
+ android:maxLines="2"
+ android:textSize="16sp"/>
- <TextView
- android:id="@+id/secondary_text"
- style="@style/Widget.Leanback.ImageCardView.ContentStyle"
- android:layout_marginTop="4dp"
- android:fontFamily="sans-serif-condensed"
- android:maxLines="1"
- android:textColor="#EEEEEE"/>
+ <TextView
+ android:id="@+id/secondary_text"
+ style="@style/Widget.Leanback.ImageCardView.ContentStyle"
+ android:layout_marginTop="4dp"
+ android:fontFamily="sans-serif-condensed"
+ android:maxLines="1"
+ android:textColor="#EEEEEE"/>
- <TextView
- android:id="@+id/extra_text"
- style="@style/Widget.Leanback.ImageCardView.ContentStyle"
- android:layout_marginTop="6dp"
- android:fontFamily="sans-serif-condensed"
- android:maxLines="5"/>
- </LinearLayout>
+ <TextView
+ android:id="@+id/extra_text"
+ style="@style/Widget.Leanback.ImageCardView.ContentStyle"
+ android:layout_marginTop="6dp"
+ android:fontFamily="sans-serif-condensed"
+ android:maxLines="5"/>
</LinearLayout>
-</FrameLayout> \ No newline at end of file
+</LinearLayout> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/values/styles.xml b/samples/SupportLeanbackShowcase/app/src/main/res/values/styles.xml
index 752439db7..c9b047676 100644
--- a/samples/SupportLeanbackShowcase/app/src/main/res/values/styles.xml
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/values/styles.xml
@@ -54,6 +54,7 @@
<style name="MovieCardSimpleStyle" parent="Widget.Leanback.ImageCardViewStyle">
<item name="lbImageCardViewType">Title</item>
<item name="lbImageCardViewImageStyle">@style/MovieCardImageStyle</item>
+ <item name="cardBackground">@null</item>
</style>
<style name="MovieCardCompleteStyle" parent="MovieCardSimpleStyle">
@@ -75,6 +76,23 @@
<style name="SquareBigCard" parent="Widget.Leanback.ImageCardViewStyle">
<item name="lbImageCardViewImageStyle">@style/SquareBigCardImageStyle</item>
+ <item name="cardBackground">@null</item>
+ </style>
+
+ <!-- SideInfo. used in cards example -->
+ <style name="SideInfoCardStyle" parent="Widget.Leanback.BaseCardViewStyle">
+ <item name="cardType">mainOnly</item>
+ <item name="cardBackground">@null</item>
+ </style>
+
+ <!-- TextCardView. used in cards example -->
+ <style name="TextCardStyle" parent="Widget.Leanback.BaseCardViewStyle">
+ <item name="cardBackground">@null</item>
+ </style>
+
+ <!-- CharacterCardView. used in details example -->
+ <style name="CharacterCardStyle" parent="Widget.Leanback.BaseCardViewStyle">
+ <item name="cardBackground">@null</item>
</style>
<!-- Grid card style. Used by Grid example. -->
@@ -85,6 +103,7 @@
<style name="GridCardStyle" parent="Widget.Leanback.ImageCardViewStyle">
<item name="lbImageCardViewImageStyle">@style/GridCardImageStyle</item>
+ <item name="cardBackground">@null</item>
</style>
<!-- A default card style. Used in cards example. -->
@@ -94,6 +113,7 @@
</style>
<style name="DefaultCardStyle" parent="Widget.Leanback.ImageCardViewStyle">
+ <item name="cardBackground">@null</item>
<item name="lbImageCardViewImageStyle">@style/DefaultCardImageStyle</item>
</style>
@@ -155,7 +175,6 @@
</style>
<style name="IconCardStyle" parent="DefaultCardStyle">
- <item name="cardBackground">@null</item>
<item name="android:layout_width">96dp</item>
<item name="android:layout_height">wrap_content</item>
<item name="lbImageCardViewTitleStyle">@style/IconCardTitleStyle</item>