Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,41 @@ class HomeParentItemAdapterPreview(
homePreviewDescription.text =
item.plot?.html() ?: ""

homePreviewDescription.text =
item.plot?.html() ?: ""

homePreviewScore.text = item.score?.let { score ->
homePreviewScore.context.getString(R.string.extension_rating, score.toString())
} ?: ""

item.score?.toString()?.toDoubleOrNull()?.let { rating ->
val color = when {
rating < 5.0 -> android.graphics.Color.parseColor("#eb2f2f") // Red
rating < 8.0 -> android.graphics.Color.parseColor("#eda009") // Yellow
else -> android.graphics.Color.parseColor("#3bb33b") // Green
}
homePreviewScore.backgroundTintList = android.content.res.ColorStateList.valueOf(color)
homePreviewScore.setTextColor(android.graphics.Color.WHITE)
}

homePreviewScore.isGone = item.score == null

homePreviewYear.text = item.year?.toString() ?: ""
homePreviewYear.isGone = item.year == null

homePreviewDuration.text = item.duration?.let { min ->
homePreviewDuration.context.getString(R.string.duration_format, min)
} ?: ""
homePreviewDuration.isGone = item.duration == null

val castText = item.actors?.take(3)?.mapNotNull { it.actor.name }?.joinToString(", ")
if (!castText.isNullOrBlank()) {
homePreviewCast.text = homePreviewCast.context.getString(R.string.cast_format, castText)
homePreviewCast.isVisible = true
} else {
homePreviewCast.isVisible = false
}

homePreviewText.text = item.name.html()
populateChips(
homePreviewTags,
Expand Down Expand Up @@ -646,6 +681,12 @@ class HomeParentItemAdapterPreview(
(binding as? FragmentHomeHeadTvBinding)?.apply {
homePreviewInfoBtt.isVisible = true
}
// Explicitly bind the current item to ensure instant loading
val currentPos = previewViewpager.currentItem
val item = preview.value.second.getOrNull(currentPos)
if (item != null) {
onSelect(item, currentPos)
}
}

else -> {
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/res/drawable/bg_imdb_badge.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#F5C518" />
<corners android:radius="4dp" />
<padding
android:bottom="2dp"
android:left="4dp"
android:right="4dp"
android:top="2dp" />
</shape>
8 changes: 4 additions & 4 deletions app/src/main/res/drawable/player_gradient_tv.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
<shape>
<gradient
android:angle="90"
android:startColor="#000000"
android:startColor="#FF000000"
android:centerColor="#00000000"
android:endColor="#00000000"
android:centerY="0.7"
android:centerY="0.3"
/>
</shape>
</item>
<item>
<shape>
<gradient
android:angle="270"
android:startColor="#000000"
android:startColor="#66000000"
android:centerColor="#00000000"
android:endColor="#00000000"
android:centerY="0.7"
android:centerY="0.5"
/>
</shape>
</item>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/rating_bg_color.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="?attr/colorPrimary"/>
<corners android:radius="@dimen/rounded_image_radius"/>
<corners android:radius="4dp"/>
<!-- <stroke android:color="@color/subColor" android:width="2dp"/>-->
</shape>
2 changes: 2 additions & 0 deletions app/src/main/res/layout/dialog_online_subtitles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
android:orientation="vertical">

<!-- android:id="@+id/subs_settings" android:foreground="?android:attr/selectableItemBackgroundBorderless"
-->
<!--
-->
<LinearLayout
android:layout_width="match_parent"
Expand Down
56 changes: 54 additions & 2 deletions app/src/main/res/layout/fragment_home_head_tv.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<androidx.cardview.widget.CardView
android:id="@+id/home_preview_info_btt"
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_height="400dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
Expand Down Expand Up @@ -61,11 +61,12 @@
android:id="@+id/home_preview_viewpager_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/player_gradient_tv"
android:layout_gravity="bottom"
android:layout_marginStart="@dimen/navbar_width"
android:gravity="bottom"
android:orientation="vertical"
android:padding="10dp">
android:padding="20dp">

<ImageView
android:id="@+id/home_background_poster_watermark_badge_holder"
Expand All @@ -81,12 +82,52 @@
android:id="@+id/home_preview_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:ellipsize="end"
android:maxLines="1"
android:textSize="25sp"
android:textStyle="bold"
tools:text="The Perfect Run" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="10dp"
android:layout_marginBottom="4dp"
android:gravity="center_vertical">

<TextView
android:id="@+id/home_preview_score"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/rating_bg_color"
android:textColor="@color/white"
android:textStyle="bold"
android:paddingStart="6dp"
android:paddingEnd="6dp"
android:paddingTop="2dp"
android:paddingBottom="2dp"
android:layout_marginEnd="12dp"
tools:text="IMDb : 8.5" />

<TextView
android:id="@+id/home_preview_year"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/gray_200"
android:layout_marginEnd="12dp"
tools:text="2021" />

<TextView
android:id="@+id/home_preview_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/gray_200"
tools:text="120m" />

</LinearLayout>

<TextView
android:id="@+id/home_preview_description"
android:layout_width="match_parent"
Expand All @@ -97,6 +138,17 @@
android:textSize="15sp"
tools:text="very nice tv series" />

<TextView
android:id="@+id/home_preview_cast"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textSize="13sp"
android:textColor="@color/gray_400"
android:paddingBottom="5dp"
tools:text="Cast: Actor One, Actor Two" />

<com.google.android.material.chip.ChipGroup
android:id="@+id/home_preview_tags"
style="@style/ChipParent"
Expand Down
10 changes: 6 additions & 4 deletions app/src/main/res/layout/home_scroll_view_tv.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
tools:src="@drawable/example_poster" />

<View
android:id="@+id/title_shadow"
android:id="@+id/home_preview_dimmer"
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_gravity="bottom"
android:background="@drawable/background_shadow" />
android:layout_height="match_parent"
android:background="#000000"
android:alpha="0.6" />


</FrameLayout>
3 changes: 3 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

<color name="white">#FFF</color>
<color name="black">#000</color>
<color name="gray_200">#EEEEEE</color>
<color name="gray_400">#BDBDBD</color>

<color name="whiteText">#FFF</color>
<color name="blackText">#000</color>
Expand All @@ -35,6 +37,7 @@
<color name="subColorBg">#F53B66</color>
<color name="typeColorText">#BEC8FF</color>
<color name="typeColorBg">#3700B3</color>

<!--
<color name="ratingColor">#4C3115</color>
<color name="ratingColorBg">#FFA662</color>
Expand Down