Skip to content
Closed
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 @@ -8,7 +8,6 @@ import androidx.core.view.isGone
import androidx.core.view.isVisible
import androidx.core.view.setPadding
import androidx.preference.PreferenceManager
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView
import coil3.dispose
import com.lagradost.cloudstream3.APIHolder.unixTimeMS
Expand Down Expand Up @@ -141,6 +140,7 @@ class EpisodeAdapter(
}
}

@SuppressLint("SetTextI18n")
override fun onBindContent(holder: ViewHolderState<Any>, item: ResultEpisode, position: Int) {
val itemView = holder.itemView
when (val binding = holder.view) {
Expand Down Expand Up @@ -199,8 +199,9 @@ class EpisodeAdapter(
}
}

val name =
if (item.name == null) "${episodeText.context.getString(R.string.episode)} ${item.episode}" else "${item.episode}. ${item.name}"
val name = item.name?.takeIf { it.isNotBlank() }
?: episodeText.context.getString(R.string.episode).let { "$it ${item.episode}" }

episodeFiller.isVisible = item.isFiller == true
episodeText.text =
name//if(card.isFiller == true) episodeText.context.getString(R.string.filler).format(name) else name
Expand Down Expand Up @@ -252,8 +253,17 @@ class EpisodeAdapter(
// Clear the image
episodePoster.dispose()
}

episodePoster.isVisible = posterVisible

episodeSeasonEp.text = if (item.season != null) {
"S${item.season}E${item.episode}"
} else {
"E${item.episode}"
}

episodeSeasonEp.isVisible = episodeSeasonEp.text.isNotBlank()

val rating10p = item.score?.toFloat(10)
if (rating10p != null && rating10p > 0.1) {
episodeRating.text = episodeRating.context?.getString(R.string.rated_format)
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/drawable/episode_badge_black.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#000000"/>
<corners android:radius="10dp"/>
</shape>
24 changes: 24 additions & 0 deletions app/src/main/res/drawable/ic_clock_16.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="?attr/grayTextColor"
android:pathData="
M12,2
A10,10 0 1,1 2,12
A10.01,10.01 0 0,1 12,2
Z
M12,4
A8,8 0 1,0 20,12
A8.01,8.01 0 0,0 12,4
Z
M11,6
H13
V12.25
L16.25,14.18
L15.5,15.41
L11,13
Z" />
</vector>
47 changes: 34 additions & 13 deletions app/src/main/res/layout/result_episode_large.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,36 @@
android:layout_height="72dp"
android:foreground="@drawable/outline_drawable">

<ImageView
android:id="@+id/episode_poster"

<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/episode_poster_img_des"
android:clipChildren="true"
android:clipToPadding="true">

<ImageView
android:id="@+id/episode_poster"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
tools:src="@drawable/example_poster" />

<TextView
android:id="@+id/episode_season_ep"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginEnd="3dp"
android:layout_marginBottom="3dp"
android:paddingHorizontal="4dp"
android:paddingVertical="2dp"
android:text="S01E01"
android:textSize="11sp"
android:letterSpacing="0.05"
android:textStyle="bold"
android:textColor="@android:color/white"
android:background="@drawable/episode_badge_black" />

android:foreground="?android:attr/selectableItemBackgroundBorderless"
android:nextFocusRight="@id/download_button"
android:scaleType="centerCrop"
tools:src="@drawable/example_poster"
tools:visibility="invisible" />
</FrameLayout>

<!-- <ImageView-->
<!-- android:id="@+id/episode_play_icon"-->
Expand All @@ -66,12 +84,14 @@

<FrameLayout
android:id="@+id/watch_progress_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_gravity="bottom|start"
tools:ignore="RtlSymmetry">

<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/episode_play_icon"
android:scaleType="centerInside"
style="@style/EpisodePlayUnderlayProgress"
/>
<com.google.android.material.progressindicator.CircularProgressIndicator
Expand Down Expand Up @@ -108,7 +128,7 @@
android:layout_gravity="center_vertical"
android:textColor="?attr/textColor"
android:textStyle="bold"
tools:text="1. Jobless" />
tools:text="Jobless" />
</LinearLayout>

<LinearLayout
Expand All @@ -129,6 +149,7 @@
android:id="@+id/episode_runtime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableStart="@drawable/ic_clock_16"
android:layout_marginEnd="10dp"
android:textColor="?attr/grayTextColor"
tools:text="80min" />
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<dimen name="dialog_buttons_inset">5dp</dimen>

<dimen name="home_poster_progress_size">50dp</dimen>
<dimen name="episode_progress_size">40dp</dimen>
<dimen name="episode_progress_size">25dp</dimen>
<dimen name="continue_watching_progress_size">25dp</dimen>
<dimen name="circular_progress_thickness">2dp</dimen>
<dimen name="download_header_progress_size">35dp</dimen>
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1090,8 +1090,8 @@

<style name="EpisodePlayUnderlayProgress" parent="PlayUnderlayProgress">
<item name="tint">@color/white</item>
<item name="android:layout_width">40dp</item>
<item name="android:layout_height">40dp</item>
<item name="android:layout_width">20dp</item>
<item name="android:layout_height">20dp</item>
<item name="android:background">@color/playIconBackground</item>
</style>

Expand Down