From 284ec7b58f3e2e494719d651ab0d2edf736c0a36 Mon Sep 17 00:00:00 2001 From: Sawyer Blatz Date: Fri, 10 Jul 2020 11:07:20 -0700 Subject: [PATCH] For #12461: Add tab count to tab tray --- .../org/mozilla/fenix/tabtray/TabTrayView.kt | 3 ++ .../main/res/layout/component_tabstray.xml | 25 +++++++------- .../main/res/layout/tabs_tray_tab_counter.xml | 34 +++++++++++++++++++ 3 files changed, 50 insertions(+), 12 deletions(-) create mode 100644 app/src/main/res/layout/tabs_tray_tab_counter.xml diff --git a/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayView.kt b/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayView.kt index b9acc4858..7177b2fad 100644 --- a/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayView.kt +++ b/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayView.kt @@ -18,6 +18,7 @@ import com.google.android.material.tabs.TabLayout import kotlinx.android.extensions.LayoutContainer import kotlinx.android.synthetic.main.component_tabstray.view.* import kotlinx.android.synthetic.main.component_tabstray_fab.view.* +import kotlinx.android.synthetic.main.tabs_tray_tab_counter.* import kotlinx.coroutines.Dispatchers.Main import kotlinx.coroutines.delay import kotlinx.coroutines.launch @@ -245,6 +246,8 @@ class TabTrayView( View.VISIBLE } view.tab_tray_overflow.isVisible = !hasNoTabs + + counter_text.text = "${state.normalTabs.size}" } } diff --git a/app/src/main/res/layout/component_tabstray.xml b/app/src/main/res/layout/component_tabstray.xml index 132d86363..51a1edc62 100644 --- a/app/src/main/res/layout/component_tabstray.xml +++ b/app/src/main/res/layout/component_tabstray.xml @@ -46,27 +46,28 @@ android:layout_width="0dp" android:layout_height="80dp" android:background="@color/foundation_normal_theme" - app:tabIndicatorColor="@color/accent_normal_theme" - app:tabIconTint="@color/tab_icon" - app:tabRippleColor="@android:color/transparent" - app:tabGravity="fill" - app:layout_constraintWidth_percent="0.5" + app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/handle" - app:layout_constraintStart_toStartOf="parent"> + app:layout_constraintWidth_percent="0.5" + app:tabGravity="fill" + app:tabIconTint="@color/tab_icon" + app:tabIndicatorColor="@color/accent_normal_theme" + app:tabRippleColor="@android:color/transparent"> + android:layout_height="match_parent" + android:contentDescription="@string/tab_header_label" + android:layout="@layout/tabs_tray_tab_counter" + app:tabIconTint="@color/tab_icon" /> + android:layout_height="match_parent" + android:contentDescription="@string/tabs_header_private_tabs_title" + android:icon="@drawable/ic_private_browsing" /> diff --git a/app/src/main/res/layout/tabs_tray_tab_counter.xml b/app/src/main/res/layout/tabs_tray_tab_counter.xml new file mode 100644 index 000000000..df8b697ac --- /dev/null +++ b/app/src/main/res/layout/tabs_tray_tab_counter.xml @@ -0,0 +1,34 @@ + + + + + + + + + \ No newline at end of file