Skip to content

Commit 59d5f98

Browse files
authored
ensure that tab switcher grid items always scale images and uses square page previews in the old design (#6529)
Task/Issue URL: https://app.asana.com/1/137249556945/project/1208671518894266/task/1210976600737969?focus=true ### Description Fixes a regression from #6521 which unintentionally removed scaling from placeholder images in the tab switcher grid items. ### Steps to test this PR - [x] Open the tab switcher while on new tab page and verify that the Dax icon is the right scale. ### UI changes | Before | After | | ------ | ----- | <img width="960" height="2142" alt="Screenshot_20250805_163405" src="https://github.com/user-attachments/assets/abd14c30-5c85-452c-8647-71531c7685aa" />|<img width="960" height="2142" alt="Screenshot_20250805_163432" src="https://github.com/user-attachments/assets/88115fb5-a0f1-4c21-a6e6-32b52319d75c" />|
1 parent 51399d4 commit 59d5f98

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

app/src/main/java/com/duckduckgo/app/tabs/ui/TabSwitcherAdapter.kt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -403,10 +403,18 @@ class TabSwitcherAdapter(
403403
try {
404404
glide.load(cachedWebViewPreview)
405405
.transition(DrawableTransitionOptions.withCrossFade())
406-
.transform(
407-
fitAndClipBottom(),
408-
RoundedCorners(tabPreview.context.resources.getDimensionPixelSize(CommonR.dimen.smallShapeCornerRadius)),
409-
)
406+
.let {
407+
if (isVisualExperimentEnabled) {
408+
it.transform(
409+
fitAndClipBottom(),
410+
RoundedCorners(tabPreview.context.resources.getDimensionPixelSize(CommonR.dimen.smallShapeCornerRadius)),
411+
)
412+
} else {
413+
it.transform(
414+
fitAndClipBottom(),
415+
)
416+
}
417+
}
410418
.into(tabPreview)
411419
} catch (e: Exception) {
412420
logcat(ERROR) { "Error loading tab preview for ${tab.tabId}: ${e.message}" }

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@
100100
android:layout_height="@dimen/gridItemPreviewHeightNew"
101101
android:layout_marginTop="6dp"
102102
android:importantForAccessibility="no"
103+
android:scaleType="center"
103104
app:layout_constraintBottom_toBottomOf="parent"
104105
app:layout_constraintEnd_toEndOf="parent"
105106
app:layout_constraintStart_toStartOf="parent"

0 commit comments

Comments
 (0)