From 98ef196f8b90e97905686e92de6b9bc7699511a4 Mon Sep 17 00:00:00 2001 From: Fabian Kozynski Date: Fri, 24 Apr 2020 16:04:14 -0400 Subject: Fix alignment of subtitle Make the subtitle invisible if there's no text Test: visual Fixes: 154672823 Change-Id: I8be3fb2a1193612ef39f564fc1d4c29c7f730877 --- .../src/com/android/systemui/controls/management/AppAdapter.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/controls/management/AppAdapter.kt b/packages/SystemUI/src/com/android/systemui/controls/management/AppAdapter.kt index 8b3454a2bc7c..0bc6579739db 100644 --- a/packages/SystemUI/src/com/android/systemui/controls/management/AppAdapter.kt +++ b/packages/SystemUI/src/com/android/systemui/controls/management/AppAdapter.kt @@ -102,7 +102,9 @@ class AppAdapter( fun bindData(data: ControlsServiceInfo) { icon.setImageDrawable(data.loadIcon()) 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 ) { - fun renderFavoritesForComponent(component: ComponentName): String { + fun renderFavoritesForComponent(component: ComponentName): String? { val qty = favoriteFunction(component) if (qty != 0) { return resources.getQuantityString(R.plurals.controls_number_of_favorites, qty, qty) } else { - return "" + return null } } } -- cgit v1.2.3-59-g8ed1b