mirror of
https://github.com/yuliskov/SmartTube.git
synced 2026-05-08 05:49:59 -05:00
video item badge
This commit is contained in:
+1
-1
Submodule MediaServiceCore updated: 7fcf89640b...d7c12bbf4d
+1
-1
@@ -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;
|
||||
|
||||
+1
-1
@@ -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.
|
||||
|
||||
+10
-11
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
+43
@@ -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<br/>
|
||||
* See: androidx.leanback.widget.BaseCardView#findChildrenViews()
|
||||
*/
|
||||
@Override
|
||||
public void setVisibility(int visibility) {
|
||||
super.setVisibility(visibility);
|
||||
if (mMainImage != null) {
|
||||
mMainImage.setVisibility(visibility);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ImageView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/main_image"
|
||||
style="?attr/imageCardViewImageStyle"/>
|
||||
+5
-1
@@ -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" />
|
||||
@@ -1,37 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2014 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!-- MOD: add image wrapper -->
|
||||
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:lb="http://schemas.android.com/apk/res-auto" >
|
||||
|
||||
<!--<RelativeLayout-->
|
||||
<!-- android:id="@+id/main_image_wrapper"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent">-->
|
||||
<!-- <ImageView-->
|
||||
<!-- android:id="@+id/main_image"-->
|
||||
<!-- style="?attr/imageCardViewImageStyle" />-->
|
||||
<!--</RelativeLayout>-->
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/main_image"
|
||||
style="?attr/imageCardViewImageStyle" />
|
||||
<com.liskovsoft.smartyoutubetv2.tv.ui.widgets.textbadgecard.TextBadgeImageLayout
|
||||
android:id="@+id/main_image_wrapper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
</com.liskovsoft.smartyoutubetv2.tv.ui.widgets.textbadgecard.TextBadgeImageLayout>
|
||||
|
||||
<androidx.leanback.widget.NonOverlappingRelativeLayout
|
||||
android:id="@+id/info_field"
|
||||
|
||||
Reference in New Issue
Block a user