Skip to content
Permalink
Browse files

Show number of shows in Followed/Watched headers

  • Loading branch information...
chrisbanes committed May 11, 2019
1 parent f264de3 commit b553cc4cbfeb96e4655abb300636973ee782199c
@@ -40,4 +40,8 @@ class HomeTextCreator @Inject constructor(
}
}
}

fun showHeaderCount(count: Int): CharSequence {
return context.resources.getQuantityString(R.plurals.header_show_count, count, count)
}
}
@@ -21,7 +21,6 @@ import android.os.Looper
import android.view.View
import app.tivi.HeaderBindingModel_
import app.tivi.LibraryFollowedItemBindingModel_
import app.tivi.R
import app.tivi.data.resultentities.FollowedShowEntryWithShow
import app.tivi.emptyState
import app.tivi.header
@@ -53,7 +52,7 @@ class FollowedEpoxyController @Inject constructor(
} else {
header {
id("header")
title(R.string.library_followed_shows)
titleString(textCreator.showHeaderCount(models.size))
}
super.addModels(models)
}
@@ -21,7 +21,6 @@ import android.os.Looper
import android.view.View
import app.tivi.HeaderBindingModel_
import app.tivi.LibraryWatchedItemBindingModel_
import app.tivi.R
import app.tivi.data.resultentities.WatchedShowEntryWithShow
import app.tivi.emptyState
import app.tivi.header
@@ -56,7 +55,7 @@ class WatchedEpoxyController @Inject constructor(
} else {
header {
id("header")
title(R.string.library_watched)
titleString(textCreator.showHeaderCount(models.size))
}
super.addModels(models)
}
@@ -21,13 +21,16 @@
xmlns:app="http://schemas.android.com/apk/res-auto">

<data>

<import type="android.content.Context" />

<variable
name="title"
type="int" />

<variable
name="titleString"
type="CharSequence" />

<variable
name="buttonTitle"
type="int" />
@@ -50,7 +53,7 @@
android:layout_marginEnd="@dimen/header_margin"
android:layout_marginStart="@dimen/header_margin"
android:gravity="center_vertical"
android:text="@{title}"
android:text="@{titleString ?? context.getString(title)}"
android:textAppearance="?attr/textAppearanceSubtitle1"
tools:text="Popular" />

@@ -88,4 +88,9 @@

<string name="library_last_watched">Last watched:</string>

<plurals name="header_show_count">
<item quantity="one">%d show</item>
<item quantity="other">%d shows</item>
</plurals>

</resources>

0 comments on commit b553cc4

Please sign in to comment.
You can’t perform that action at this time.