diff --git a/MediaServiceCore b/MediaServiceCore index 7fcf89640..d7c12bbf4 160000 --- a/MediaServiceCore +++ b/MediaServiceCore @@ -1 +1 @@ -Subproject commit 7fcf89640b4333f69bdb4161e728fe966f9ec376 +Subproject commit d7c12bbf4d820f5840d3ca82851aef74569fa278 diff --git a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/models/data/Video.java b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/models/data/Video.java index 907e8bddc..27b5f0d92 100644 --- a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/models/data/Video.java +++ b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/models/data/Video.java @@ -76,7 +76,7 @@ public final class Video implements Parcelable { video.cardImageUrl = item.getCardImageUrl(); video.studio = item.getAuthor(); video.percentWatched = item.getPercentWatched(); - video.badge = item.getDurationLabel(); + video.badge = item.getBadgeText(); video.mediaItem = item; return video; diff --git a/smartyoutubetv2/src/main/java/com/liskovsoft/smartyoutubetv2/tv/presenter/CardPresenter.java b/smartyoutubetv2/src/main/java/com/liskovsoft/smartyoutubetv2/tv/presenter/CardPresenter.java index d12744588..96f42ff82 100644 --- a/smartyoutubetv2/src/main/java/com/liskovsoft/smartyoutubetv2/tv/presenter/CardPresenter.java +++ b/smartyoutubetv2/src/main/java/com/liskovsoft/smartyoutubetv2/tv/presenter/CardPresenter.java @@ -18,7 +18,7 @@ import com.bumptech.glide.request.target.Target; import com.liskovsoft.sharedutils.mylogger.Log; import com.liskovsoft.smartyoutubetv2.tv.R; import com.liskovsoft.smartyoutubetv2.common.app.models.data.Video; -import com.liskovsoft.smartyoutubetv2.tv.ui.widgets.TextBadgeImageCardView; +import com.liskovsoft.smartyoutubetv2.tv.ui.widgets.textbadgecard.TextBadgeImageCardView; /* * A CardPresenter is used to generate Views and bind Objects to them on demand. diff --git a/smartyoutubetv2/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/widgets/TextBadgeImageCardView.java b/smartyoutubetv2/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/widgets/textbadgecard/TextBadgeImageCardView.java similarity index 68% rename from smartyoutubetv2/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/widgets/TextBadgeImageCardView.java rename to smartyoutubetv2/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/widgets/textbadgecard/TextBadgeImageCardView.java index 7594309eb..59f127fcd 100644 --- a/smartyoutubetv2/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/widgets/TextBadgeImageCardView.java +++ b/smartyoutubetv2/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/widgets/textbadgecard/TextBadgeImageCardView.java @@ -1,11 +1,10 @@ -package com.liskovsoft.smartyoutubetv2.tv.ui.widgets; +package com.liskovsoft.smartyoutubetv2.tv.ui.widgets.textbadgecard; import android.content.Context; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.ImageView; import android.widget.TextView; import androidx.leanback.widget.ImageCardView; import com.liskovsoft.smartyoutubetv2.tv.R; @@ -32,15 +31,15 @@ public class TextBadgeImageCardView extends ImageCardView { } private void createTextBadge() { - //ViewGroup wrapper = findViewById(R.id.main_image_wrapper); - // - //if (wrapper != null) { - // LayoutInflater inflater = LayoutInflater.from(getContext()); - // - // int layoutId = R.layout.text_badge_image_card_view_badge; - // mBadgeText = (TextView) inflater.inflate(layoutId, wrapper, false); - // wrapper.addView(mBadgeText); - //} + ViewGroup wrapper = findViewById(R.id.main_image_wrapper); + + if (wrapper != null) { + LayoutInflater inflater = LayoutInflater.from(getContext()); + + int layoutId = R.layout.image_card_view_badge; + mBadgeText = (TextView) inflater.inflate(layoutId, wrapper, false); + wrapper.addView(mBadgeText); + } } /** diff --git a/smartyoutubetv2/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/widgets/textbadgecard/TextBadgeImageLayout.java b/smartyoutubetv2/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/widgets/textbadgecard/TextBadgeImageLayout.java new file mode 100644 index 000000000..b890e89bf --- /dev/null +++ b/smartyoutubetv2/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/widgets/textbadgecard/TextBadgeImageLayout.java @@ -0,0 +1,43 @@ +package com.liskovsoft.smartyoutubetv2.tv.ui.widgets.textbadgecard; + +import android.content.Context; +import android.util.AttributeSet; +import android.widget.ImageView; +import android.widget.RelativeLayout; +import com.liskovsoft.smartyoutubetv2.tv.R; + +public class TextBadgeImageLayout extends RelativeLayout { + private ImageView mMainImage; + + public TextBadgeImageLayout(Context context) { + super(context); + init(); + } + + public TextBadgeImageLayout(Context context, AttributeSet attrs) { + super(context, attrs); + init(); + } + + public TextBadgeImageLayout(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + init(); + } + + private void init() { + inflate(getContext(), R.layout.image_card_view, this); + mMainImage = findViewById(R.id.main_image); + } + + /** + * Main trick is to apply visibility to child image views
+ * See: androidx.leanback.widget.BaseCardView#findChildrenViews() + */ + @Override + public void setVisibility(int visibility) { + super.setVisibility(visibility); + if (mMainImage != null) { + mMainImage.setVisibility(visibility); + } + } +} diff --git a/smartyoutubetv2/src/main/res/layout/image_card_view.xml b/smartyoutubetv2/src/main/res/layout/image_card_view.xml new file mode 100644 index 000000000..5c86675b7 --- /dev/null +++ b/smartyoutubetv2/src/main/res/layout/image_card_view.xml @@ -0,0 +1,5 @@ + + \ No newline at end of file diff --git a/smartyoutubetv2/src/main/res/layout/text_badge_image_card_view_badge.xml b/smartyoutubetv2/src/main/res/layout/image_card_view_badge.xml similarity index 63% rename from smartyoutubetv2/src/main/res/layout/text_badge_image_card_view_badge.xml rename to smartyoutubetv2/src/main/res/layout/image_card_view_badge.xml index 8b7f8bfd4..337684e2b 100644 --- a/smartyoutubetv2/src/main/res/layout/text_badge_image_card_view_badge.xml +++ b/smartyoutubetv2/src/main/res/layout/image_card_view_badge.xml @@ -5,9 +5,13 @@ android:layout_alignBottom="@+id/main_image" android:layout_alignEnd="@+id/main_image" android:layout_marginEnd="@dimen/lb_basic_card_info_badge_margin" - android:background="@color/fastlane_dark" + android:layout_marginBottom="@dimen/lb_basic_card_info_badge_margin" + android:background="@color/black" android:layout_width="wrap_content" android:layout_height="wrap_content" android:maxLines="1" android:ellipsize="end" + android:includeFontPadding="false" + android:paddingStart="@dimen/lb_details_description_title_padding_adjust_bottom" + android:paddingEnd="@dimen/lb_details_description_title_padding_adjust_bottom" style="@style/TextAppearance.Leanback.ImageCardView.Content" /> \ No newline at end of file diff --git a/smartyoutubetv2/src/main/res/layout/lb_image_card_view.xml b/smartyoutubetv2/src/main/res/layout/lb_image_card_view.xml index d3ef004ff..1d0e82b3b 100644 --- a/smartyoutubetv2/src/main/res/layout/lb_image_card_view.xml +++ b/smartyoutubetv2/src/main/res/layout/lb_image_card_view.xml @@ -1,37 +1,14 @@ - - - - - - - - - - - - + +