parent
35fa445165
commit
063cf457ba
|
@ -25,6 +25,7 @@ import mozilla.components.browser.state.state.TabSessionState
|
||||||
import mozilla.components.browser.tabstray.BrowserTabsTray
|
import mozilla.components.browser.tabstray.BrowserTabsTray
|
||||||
import org.mozilla.fenix.R
|
import org.mozilla.fenix.R
|
||||||
import org.mozilla.fenix.ext.components
|
import org.mozilla.fenix.ext.components
|
||||||
|
import org.mozilla.fenix.ext.settings
|
||||||
|
|
||||||
interface TabTrayInteractor {
|
interface TabTrayInteractor {
|
||||||
fun onNewTabTapped(private: Boolean)
|
fun onNewTabTapped(private: Boolean)
|
||||||
|
@ -61,14 +62,18 @@ class TabTrayView(
|
||||||
get() = container
|
get() = container
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
val hasAccessibilityEnabled = view.context.settings().accessibilityServicesEnabled
|
||||||
|
|
||||||
toggleFabText(isPrivate)
|
toggleFabText(isPrivate)
|
||||||
|
|
||||||
behavior.addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() {
|
behavior.addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() {
|
||||||
override fun onSlide(bottomSheet: View, slideOffset: Float) {
|
override fun onSlide(bottomSheet: View, slideOffset: Float) {
|
||||||
if (slideOffset >= SLIDE_OFFSET) {
|
if (!hasAccessibilityEnabled) {
|
||||||
fabView.new_tab_button.show()
|
if (slideOffset >= SLIDE_OFFSET) {
|
||||||
} else {
|
fabView.new_tab_button.show()
|
||||||
fabView.new_tab_button.hide()
|
} else {
|
||||||
|
fabView.new_tab_button.hide()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,8 +147,18 @@ class TabTrayView(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fabView.new_tab_button.setOnClickListener {
|
view.tab_tray_new_tab.apply {
|
||||||
interactor.onNewTabTapped(isPrivateModeSelected)
|
isVisible = hasAccessibilityEnabled
|
||||||
|
setOnClickListener {
|
||||||
|
interactor.onNewTabTapped(isPrivateModeSelected)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fabView.new_tab_button.apply {
|
||||||
|
isVisible = !hasAccessibilityEnabled
|
||||||
|
setOnClickListener {
|
||||||
|
interactor.onNewTabTapped(isPrivateModeSelected)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,18 @@
|
||||||
|
|
||||||
</com.google.android.material.tabs.TabLayout>
|
</com.google.android.material.tabs.TabLayout>
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/tab_tray_new_tab"
|
||||||
|
android:layout_width="48dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||||
|
android:contentDescription="@string/add_tab"
|
||||||
|
app:srcCompat="@drawable/ic_new"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/tab_layout"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/tab_tray_overflow"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/tab_layout" />
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/tab_tray_overflow"
|
android:id="@+id/tab_tray_overflow"
|
||||||
android:layout_width="48dp"
|
android:layout_width="48dp"
|
||||||
|
|
Loading…
Reference in New Issue