SupportLeanbackShowcase: get rid of card view background overdraw
Change-Id: I3a46d34df265eda2cf38bfca80d3786aa5a8a23b
This commit is contained in:
@@ -30,7 +30,7 @@ import android.widget.TextView;
|
|||||||
public class CharacterCardView extends BaseCardView {
|
public class CharacterCardView extends BaseCardView {
|
||||||
|
|
||||||
public CharacterCardView(Context context) {
|
public CharacterCardView(Context context) {
|
||||||
super(context);
|
super(context, null, R.style.CharacterCardStyle);
|
||||||
LayoutInflater.from(getContext()).inflate(R.layout.character_card, this);
|
LayoutInflater.from(getContext()).inflate(R.layout.character_card, this);
|
||||||
setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -47,7 +47,6 @@ public class CharacterCardView extends BaseCardView {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
setFocusable(true);
|
setFocusable(true);
|
||||||
setBackground(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateUi(Card card) {
|
public void updateUi(Card card) {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import android.widget.TextView;
|
|||||||
public class TextCardView extends BaseCardView {
|
public class TextCardView extends BaseCardView {
|
||||||
|
|
||||||
public TextCardView(Context context) {
|
public TextCardView(Context context) {
|
||||||
super(context);
|
super(context, null, R.style.TextCardStyle);
|
||||||
LayoutInflater.from(getContext()).inflate(R.layout.text_icon_card, this);
|
LayoutInflater.from(getContext()).inflate(R.layout.text_icon_card, this);
|
||||||
setFocusable(true);
|
setFocusable(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ public class SideInfoCardPresenter extends AbstractCardPresenter<BaseCardView> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BaseCardView onCreateView() {
|
protected BaseCardView onCreateView() {
|
||||||
final BaseCardView cardView = new BaseCardView(getContext());
|
final BaseCardView cardView = new BaseCardView(getContext(), null,
|
||||||
|
R.style.SideInfoCardStyle);
|
||||||
cardView.setFocusable(true);
|
cardView.setFocusable(true);
|
||||||
cardView.setCardType(BaseCardView.CARD_TYPE_MAIN_ONLY);
|
|
||||||
cardView.addView(LayoutInflater.from(getContext()).inflate(R.layout.side_info_card, null));
|
cardView.addView(LayoutInflater.from(getContext()).inflate(R.layout.side_info_card, null));
|
||||||
return cardView;
|
return cardView;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,55 +14,51 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout
|
||||||
xmlns:lb="http://schemas.android.com/apk/res-auto"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="wrap_content"
|
xmlns:lb="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_height="wrap_content"
|
android:id="@+id/container"
|
||||||
android:background="@color/default_card_footer_background_color">
|
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"
|
||||||
|
/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/container"
|
android:id="@+id/info"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="144dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:orientation="horizontal">
|
android:orientation="vertical"
|
||||||
|
android:paddingLeft="11dp"
|
||||||
|
android:paddingRight="11dp"
|
||||||
|
android:paddingTop="7dp"
|
||||||
|
android:background="@color/default_card_footer_background_color">
|
||||||
|
|
||||||
<ImageView
|
<TextView
|
||||||
android:id="@+id/main_image"
|
android:id="@+id/primary_text"
|
||||||
android:layout_width="144dp"
|
style="@style/Widget.Leanback.ImageCardView.TitleStyle"
|
||||||
android:layout_height="144dp"
|
android:fontFamily="sans-serif-condensed"
|
||||||
lb:layout_viewType="main"
|
android:maxLines="2"
|
||||||
/>
|
android:textSize="16sp"/>
|
||||||
|
|
||||||
<LinearLayout
|
<TextView
|
||||||
android:id="@+id/info"
|
android:id="@+id/secondary_text"
|
||||||
android:layout_width="144dp"
|
style="@style/Widget.Leanback.ImageCardView.ContentStyle"
|
||||||
android:layout_height="wrap_content"
|
android:layout_marginTop="4dp"
|
||||||
android:orientation="vertical"
|
android:fontFamily="sans-serif-condensed"
|
||||||
android:paddingLeft="11dp"
|
android:maxLines="1"
|
||||||
android:paddingRight="11dp"
|
android:textColor="#EEEEEE"/>
|
||||||
android:paddingTop="7dp">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/primary_text"
|
android:id="@+id/extra_text"
|
||||||
style="@style/Widget.Leanback.ImageCardView.TitleStyle"
|
style="@style/Widget.Leanback.ImageCardView.ContentStyle"
|
||||||
android:fontFamily="sans-serif-condensed"
|
android:layout_marginTop="6dp"
|
||||||
android:maxLines="2"
|
android:fontFamily="sans-serif-condensed"
|
||||||
android:textSize="16sp"/>
|
android:maxLines="5"/>
|
||||||
|
|
||||||
<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>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</FrameLayout>
|
</LinearLayout>
|
||||||
@@ -54,6 +54,7 @@
|
|||||||
<style name="MovieCardSimpleStyle" parent="Widget.Leanback.ImageCardViewStyle">
|
<style name="MovieCardSimpleStyle" parent="Widget.Leanback.ImageCardViewStyle">
|
||||||
<item name="lbImageCardViewType">Title</item>
|
<item name="lbImageCardViewType">Title</item>
|
||||||
<item name="lbImageCardViewImageStyle">@style/MovieCardImageStyle</item>
|
<item name="lbImageCardViewImageStyle">@style/MovieCardImageStyle</item>
|
||||||
|
<item name="cardBackground">@null</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="MovieCardCompleteStyle" parent="MovieCardSimpleStyle">
|
<style name="MovieCardCompleteStyle" parent="MovieCardSimpleStyle">
|
||||||
@@ -75,6 +76,23 @@
|
|||||||
|
|
||||||
<style name="SquareBigCard" parent="Widget.Leanback.ImageCardViewStyle">
|
<style name="SquareBigCard" parent="Widget.Leanback.ImageCardViewStyle">
|
||||||
<item name="lbImageCardViewImageStyle">@style/SquareBigCardImageStyle</item>
|
<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>
|
</style>
|
||||||
|
|
||||||
<!-- Grid card style. Used by Grid example. -->
|
<!-- Grid card style. Used by Grid example. -->
|
||||||
@@ -85,6 +103,7 @@
|
|||||||
|
|
||||||
<style name="GridCardStyle" parent="Widget.Leanback.ImageCardViewStyle">
|
<style name="GridCardStyle" parent="Widget.Leanback.ImageCardViewStyle">
|
||||||
<item name="lbImageCardViewImageStyle">@style/GridCardImageStyle</item>
|
<item name="lbImageCardViewImageStyle">@style/GridCardImageStyle</item>
|
||||||
|
<item name="cardBackground">@null</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!-- A default card style. Used in cards example. -->
|
<!-- A default card style. Used in cards example. -->
|
||||||
@@ -94,6 +113,7 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="DefaultCardStyle" parent="Widget.Leanback.ImageCardViewStyle">
|
<style name="DefaultCardStyle" parent="Widget.Leanback.ImageCardViewStyle">
|
||||||
|
<item name="cardBackground">@null</item>
|
||||||
<item name="lbImageCardViewImageStyle">@style/DefaultCardImageStyle</item>
|
<item name="lbImageCardViewImageStyle">@style/DefaultCardImageStyle</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@@ -155,7 +175,6 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="IconCardStyle" parent="DefaultCardStyle">
|
<style name="IconCardStyle" parent="DefaultCardStyle">
|
||||||
<item name="cardBackground">@null</item>
|
|
||||||
<item name="android:layout_width">96dp</item>
|
<item name="android:layout_width">96dp</item>
|
||||||
<item name="android:layout_height">wrap_content</item>
|
<item name="android:layout_height">wrap_content</item>
|
||||||
<item name="lbImageCardViewTitleStyle">@style/IconCardTitleStyle</item>
|
<item name="lbImageCardViewTitleStyle">@style/IconCardTitleStyle</item>
|
||||||
|
|||||||
Reference in New Issue
Block a user