mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-03 23:15:31 +00:00
[fenix] Closes https://github.com/mozilla-mobile/fenix/issues/18514: Re-add tab counter in tabs tray (https://github.com/mozilla-mobile/fenix/pull/18659)
This commit is contained in:
parent
b26d782c2f
commit
56fcf0e457
@ -16,6 +16,10 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||
import kotlinx.android.synthetic.main.component_tabstray2.*
|
||||
import kotlinx.android.synthetic.main.component_tabstray2.view.*
|
||||
import org.mozilla.fenix.HomeActivity
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import mozilla.components.browser.state.selector.normalTabs
|
||||
import mozilla.components.lib.state.ext.consumeFrom
|
||||
import mozilla.components.ui.tabcounter.TabCounter
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.ext.requireComponents
|
||||
import org.mozilla.fenix.tabstray.browser.BrowserTrayInteractor
|
||||
@ -63,6 +67,7 @@ class TabsTrayFragment : AppCompatDialogFragment(), TabsTrayInteractor {
|
||||
return containerView
|
||||
}
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
@ -85,6 +90,12 @@ class TabsTrayFragment : AppCompatDialogFragment(), TabsTrayInteractor {
|
||||
interactor = this,
|
||||
store = requireComponents.core.store
|
||||
).attach()
|
||||
|
||||
consumeFrom(requireComponents.core.store) {
|
||||
view.findViewById<TabCounter>(R.id.tab_counter)?.apply {
|
||||
setCount(requireComponents.core.store.state.normalTabs.size)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun setCurrentTrayPosition(position: Int) {
|
||||
|
@ -109,8 +109,7 @@
|
||||
android:layout_width="0dp"
|
||||
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="@layout/tabs_tray_tab_counter2" />
|
||||
|
||||
<com.google.android.material.tabs.TabItem
|
||||
android:id="@+id/private_tab_item"
|
||||
|
19
app/src/main/res/layout/tabs_tray_tab_counter2.xml
Normal file
19
app/src/main/res/layout/tabs_tray_tab_counter2.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:mozac="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/counter_root"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true">
|
||||
|
||||
<mozilla.components.ui.tabcounter.TabCounter
|
||||
android:id="@+id/tab_counter"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
mozac:tabCounterTintColor="@color/tab_icon" />
|
||||
|
||||
</FrameLayout>
|
Loading…
Reference in New Issue
Block a user