Skip to content

Commit 6e92979

Browse files
authored
Custom Tab: Remove the legacy omnibar layout (#7165)
Task/Issue URL: https://app.asana.com/1/137249556945/project/1207418217763355/task/1211972481043747?focus=true ### Description This PR removes the `LegacyOmnibarLayout` and `SplitOmnibarLayout`, which are not used anymore, and all associated logic, including the `useUnifiedOmnibarLayout` feature flag. ### Steps to test this PR QA-optional or a simple smoke test, changing the omnibar position is enough.
1 parent 5f08423 commit 6e92979

26 files changed

+53
-1937
lines changed

app/src/main/java/com/duckduckgo/app/browser/BrowserTabFragment.kt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ import com.duckduckgo.app.browser.omnibar.Omnibar.LogoClickListener
149149
import com.duckduckgo.app.browser.omnibar.Omnibar.OmnibarTextState
150150
import com.duckduckgo.app.browser.omnibar.Omnibar.TextListener
151151
import com.duckduckgo.app.browser.omnibar.Omnibar.ViewMode
152-
import com.duckduckgo.app.browser.omnibar.OmnibarItemPressedListener
153152
import com.duckduckgo.app.browser.omnibar.OmnibarType
154153
import com.duckduckgo.app.browser.omnibar.QueryOrigin
155154
import com.duckduckgo.app.browser.print.PrintDocumentAdapterFactory
@@ -1041,7 +1040,6 @@ class BrowserTabFragment :
10411040
omnibar = Omnibar(
10421041
omnibarType = settingsDataStore.omnibarType,
10431042
binding = binding,
1044-
isUnifiedOmnibarEnabled = omnibarRepository.isUnifiedOmnibarLayoutEnabled,
10451043
)
10461044

10471045
webViewContainer = binding.webViewContainer
@@ -3094,13 +3092,6 @@ class BrowserTabFragment :
30943092
}
30953093
},
30963094
)
3097-
omnibar.configureOmnibarItemPressedListeners(
3098-
object : OmnibarItemPressedListener {
3099-
override fun onBackButtonPressed() {
3100-
hideKeyboard()
3101-
}
3102-
},
3103-
)
31043095
}
31053096

31063097
private fun configureOmnibarTextInput() {

app/src/main/java/com/duckduckgo/app/browser/omnibar/LegacyOmnibarLayout.kt

Lines changed: 0 additions & 1013 deletions
This file was deleted.

app/src/main/java/com/duckduckgo/app/browser/omnibar/Omnibar.kt

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ import logcat.logcat
6060
class Omnibar(
6161
val omnibarType: OmnibarType,
6262
private val binding: FragmentBrowserTabBinding,
63-
isUnifiedOmnibarEnabled: Boolean,
6463
) {
6564
interface ItemPressedListener {
6665
fun onTabsButtonPressed()
@@ -154,37 +153,7 @@ class Omnibar(
154153
}
155154

156155
val omnibarView: OmnibarView by lazy {
157-
if (isUnifiedOmnibarEnabled) {
158-
setupUnifiedOmnibar()
159-
} else {
160-
setupSingleOmnibar()
161-
}
162-
}
163-
164-
private fun setupSingleOmnibar(): OmnibarView {
165-
binding.rootView.removeView(binding.omnibarLayoutTop)
166-
binding.rootView.removeView(binding.omnibarLayoutBottom)
167-
168-
return when (omnibarType) {
169-
OmnibarType.SINGLE_TOP -> {
170-
binding.rootView.removeView(binding.singleOmnibarLayoutBottom)
171-
binding.singleOmnibarLayoutTop
172-
}
173-
174-
OmnibarType.SINGLE_BOTTOM -> {
175-
binding.rootView.removeView(binding.singleOmnibarLayoutTop)
176-
adjustCoordinatorLayoutBehaviorForBottomOmnibar()
177-
binding.singleOmnibarLayoutBottom
178-
}
179-
else -> throw IllegalStateException("Invalid omnibar type for single omnibar setup: $omnibarType")
180-
}
181-
}
182-
183-
private fun setupUnifiedOmnibar(): OmnibarView {
184-
binding.rootView.removeView(binding.singleOmnibarLayoutTop)
185-
binding.rootView.removeView(binding.singleOmnibarLayoutBottom)
186-
187-
return when (omnibarType) {
156+
when (omnibarType) {
188157
OmnibarType.SINGLE_TOP -> {
189158
binding.rootView.removeView(binding.omnibarLayoutBottom)
190159
binding.omnibarLayoutTop
@@ -235,10 +204,6 @@ class Omnibar(
235204
omnibarView.omnibarTextInput
236205
}
237206

238-
val omniBarContainer: View by lazy {
239-
omnibarView.omniBarContainer
240-
}
241-
242207
val toolbar: Toolbar by lazy {
243208
omnibarView.toolbar
244209
}
@@ -305,13 +270,6 @@ class Omnibar(
305270
omnibarView.setLogoClickListener(logoClickListener)
306271
}
307272

308-
fun configureOmnibarItemPressedListeners(listener: OmnibarItemPressedListener) {
309-
val omnibar = omnibarView
310-
if (omnibar is SingleOmnibarLayout) {
311-
omnibar.setSingleOmnibarItemPressedListener(listener)
312-
}
313-
}
314-
315273
fun configureInputScreenLaunchListener(listener: InputScreenLaunchListener) {
316274
omnibarView.setInputScreenLaunchListener(listener)
317275
}

app/src/main/java/com/duckduckgo/app/browser/omnibar/OmnibarFeatureRepository.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,15 @@ open class OmnibarFeatureRepository @Inject constructor(
4444
@AppCoroutineScope private val coroutineScope: CoroutineScope,
4545
) : OmnibarRepository, MainProcessLifecycleObserver {
4646
private var isSplitOmnibarFlagEnabled: Boolean = false
47-
private var isUnifiedOmnibarFlagEnabled: Boolean = false
4847

4948
override val omnibarType: OmnibarType
5049
get() = settingsDataStore.omnibarType
5150

5251
override val isSplitOmnibarAvailable: Boolean
53-
get() = isSplitOmnibarFlagEnabled && isUnifiedOmnibarFlagEnabled
54-
55-
override val isUnifiedOmnibarLayoutEnabled: Boolean
56-
get() = isUnifiedOmnibarFlagEnabled
52+
get() = isSplitOmnibarFlagEnabled
5753

5854
override fun onStart(owner: LifecycleOwner) {
5955
coroutineScope.launch(dispatcherProvider.io()) {
60-
isUnifiedOmnibarFlagEnabled = browserFeatures.useUnifiedOmnibarLayout().isEnabled()
6156
isSplitOmnibarFlagEnabled = browserFeatures.splitOmnibar().isEnabled()
6257

6358
resetOmnibarTypeIfNecessary()

app/src/main/java/com/duckduckgo/app/browser/omnibar/OmnibarLayout.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,11 @@ class OmnibarLayout @JvmOverloads constructor(
233233
}
234234
}
235235

236-
private val experimentalOmnibarCardMarginTop by lazy {
236+
private val omnibarCardMarginTop by lazy {
237237
resources.getDimensionPixelSize(CommonR.dimen.omnibarCardMarginTop)
238238
}
239239

240-
private val experimentalOmnibarCardMarginBottom by lazy {
240+
private val omnibarCardMarginBottom by lazy {
241241
resources.getDimensionPixelSize(CommonR.dimen.omnibarCardMarginBottom)
242242
}
243243

@@ -626,22 +626,22 @@ class OmnibarLayout @JvmOverloads constructor(
626626
// When omnibar is at the bottom, we're adding an additional space at the top
627627
omnibarCardShadow.updateLayoutParams {
628628
(this as MarginLayoutParams).apply {
629-
topMargin = experimentalOmnibarCardMarginBottom
630-
bottomMargin = experimentalOmnibarCardMarginTop
629+
topMargin = omnibarCardMarginBottom
630+
bottomMargin = omnibarCardMarginTop
631631
}
632632
}
633633

634634
iconsContainer.updateLayoutParams {
635635
(this as MarginLayoutParams).apply {
636-
topMargin = experimentalOmnibarCardMarginBottom
637-
bottomMargin = experimentalOmnibarCardMarginTop
636+
topMargin = omnibarCardMarginBottom
637+
bottomMargin = omnibarCardMarginTop
638638
}
639639
}
640640

641641
shieldIconPulseAnimationContainer.updateLayoutParams {
642642
(this as MarginLayoutParams).apply {
643-
topMargin = experimentalOmnibarCardMarginBottom
644-
bottomMargin = experimentalOmnibarCardMarginTop
643+
topMargin = omnibarCardMarginBottom
644+
bottomMargin = omnibarCardMarginTop
645645
if (addressBarTrackersAnimationFeatureToggle.feature().isEnabled()) {
646646
// TODO when the animation is made permanent we should add this adjustment to the actual layout
647647
marginStart = 1.toPx()

0 commit comments

Comments
 (0)