Skip to content

Commit 69d4863

Browse files
authored
Fix RMF promo_single_action layout when vertical space is constrained (#6044)
Task/Issue URL: https://app.asana.com/1/137249556945/project/1208671518894266/task/1210194248346098 ### Description The RMF `promo_single_action` was squished and misaligned in horizontal orientation because it lacked the vertical space to fit all of its elements in correct sizes. To resolve that issue, we primarily need to make the new tab content page scrollable, which coincidentally is already happening in #6035, so I'm basing this PR on top it. Additionally: 1. I'm making sure that the new tab page uses the correct behaviors to ensure that content is not clipped by the bottom navigation bar (when the UI experiment is enabled). 2. I'm updating the action button to `DaxButtonSecondary`.
1 parent ddcc279 commit 69d4863

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,24 @@ class BottomAppBarBehavior<V : View>(
4646
private var lastStartedType: Int = 0
4747
private var offsetAnimator: ValueAnimator? = null
4848

49+
/**
50+
* We don't want any offset when in full screen.
51+
*
52+
* The browser, new tab page, etc padding management, to avoid omnibar overlapping with the content, is handled in [BottomOmnibarBrowserContainerLayoutBehavior].
53+
*/
54+
private val viewIDsExemptedFromForceOffset = setOf(
55+
R.id.webViewFullScreenContainer,
56+
R.id.browserLayout,
57+
R.id.includeNewBrowserTab,
58+
)
59+
4960
@SuppressLint("RestrictedApi")
5061
override fun layoutDependsOn(parent: CoordinatorLayout, child: V, dependency: View): Boolean {
5162
if (dependency is Snackbar.SnackbarLayout) {
5263
updateSnackbar(child, dependency)
5364
}
5465

55-
/**
56-
* We don't want any offset when in full screen.
57-
*
58-
* The browser padding management, to avoid omnibar overlapping with the browser content, is handled in [BottomOmnibarBrowserContainerLayoutBehavior].
59-
*/
60-
if (dependency.id != R.id.webViewFullScreenContainer && dependency.id != R.id.browserLayout) {
66+
if (!viewIDsExemptedFromForceOffset.contains(dependency.id)) {
6167
offsetBottomByToolbar(dependency)
6268
}
6369

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,14 @@ class Omnibar(
207207
private fun adjustCoordinatorLayoutBehaviorForBottomOmnibar() {
208208
removeAppBarBehavior(binding.autoCompleteSuggestionsList)
209209
removeAppBarBehavior(binding.focusedView)
210-
removeAppBarBehavior(binding.includeNewBrowserTab.newTabLayout)
211210

212211
binding.browserLayout.updateLayoutParams<CoordinatorLayout.LayoutParams> {
213212
behavior = BottomOmnibarBrowserContainerLayoutBehavior()
214213
}
214+
215+
binding.includeNewBrowserTab.newTabLayout.updateLayoutParams<CoordinatorLayout.LayoutParams> {
216+
behavior = BottomOmnibarBrowserContainerLayoutBehavior()
217+
}
215218
}
216219

217220
private fun removeAppBarBehavior(view: View) {

app/src/main/res/layout/include_new_browser_tab.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
android:layout_height="match_parent"
2323
android:clipChildren="false"
2424
android:fillViewport="true"
25-
app:layout_behavior="@string/appbar_scrolling_view_behavior"
25+
app:layout_behavior="com.duckduckgo.app.browser.webview.TopOmnibarBrowserContainerLayoutBehavior"
2626
tools:context="com.duckduckgo.app.browser.BrowserActivity"
2727
tools:showIn="@layout/fragment_browser_tab">
2828

common/common-ui/src/main/res/layout/view_promo_message_cta.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,11 @@
7070
app:typography="body1"
7171
tools:text="Body text goes here. This component can be used with one or two buttons." />
7272

73-
<com.duckduckgo.common.ui.view.button.DaxButtonGhost
73+
<com.duckduckgo.common.ui.view.button.DaxButtonSecondary
7474
android:id="@+id/actionButton"
7575
android:layout_width="wrap_content"
7676
android:layout_height="wrap_content"
7777
android:layout_marginTop="@dimen/keyline_2"
78-
app:icon="@drawable/ic_share_android_16"
7978
app:layout_constraintBottom_toBottomOf="parent"
8079
app:layout_constraintEnd_toEndOf="parent"
8180
app:layout_constraintStart_toStartOf="parent"

0 commit comments

Comments
 (0)