Merge "Fix alignment of subtitle" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
9178d7db09
@@ -102,7 +102,9 @@ class AppAdapter(
|
|||||||
fun bindData(data: ControlsServiceInfo) {
|
fun bindData(data: ControlsServiceInfo) {
|
||||||
icon.setImageDrawable(data.loadIcon())
|
icon.setImageDrawable(data.loadIcon())
|
||||||
title.text = data.loadLabel()
|
title.text = data.loadLabel()
|
||||||
favorites.text = favRenderer.renderFavoritesForComponent(data.componentName)
|
val text = favRenderer.renderFavoritesForComponent(data.componentName)
|
||||||
|
favorites.text = text
|
||||||
|
favorites.visibility = if (text == null) View.GONE else View.VISIBLE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -112,12 +114,12 @@ class FavoritesRenderer(
|
|||||||
private val favoriteFunction: (ComponentName) -> Int
|
private val favoriteFunction: (ComponentName) -> Int
|
||||||
) {
|
) {
|
||||||
|
|
||||||
fun renderFavoritesForComponent(component: ComponentName): String {
|
fun renderFavoritesForComponent(component: ComponentName): String? {
|
||||||
val qty = favoriteFunction(component)
|
val qty = favoriteFunction(component)
|
||||||
if (qty != 0) {
|
if (qty != 0) {
|
||||||
return resources.getQuantityString(R.plurals.controls_number_of_favorites, qty, qty)
|
return resources.getQuantityString(R.plurals.controls_number_of_favorites, qty, qty)
|
||||||
} else {
|
} else {
|
||||||
return ""
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user