Skip to content

Commit cf63b4d

Browse files
authored
NTP legacy view should respect orientation changes (#4838)
Task/Issue URL: https://app.asana.com/0/1114857721287938/1207910885306190 ### Description Fixes issue when navigating from landscape to portrait in the NTP legacy view ### Steps to test this PR _From develop _ - [x] Start app in landscape, open New Tab - [x] List shows 6 items per row - [x] Rotate to portrait - [x] List looks all over the place and icons can’t be read _From this branch_ - [x] Start app in landscape, open New Tab - [x] List shows 6 items per row - [x] Rotate to portrait - [x] List shows 4 items per row and looks right
1 parent d595bda commit cf63b4d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

app/src/main/java/com/duckduckgo/app/browser/newtab/NewTabLegacyPageView.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import android.app.PendingIntent
2121
import android.content.ActivityNotFoundException
2222
import android.content.Context
2323
import android.content.Intent
24+
import android.content.res.Configuration
2425
import android.text.Spanned
2526
import android.util.AttributeSet
2627
import android.view.View
@@ -128,6 +129,12 @@ class NewTabLegacyPageView @JvmOverloads constructor(
128129
ViewModelProvider(findViewTreeViewModelStoreOwner()!!, viewModelFactory)[NewTabLegacyPageViewModel::class.java]
129130
}
130131

132+
// BrowserTabFragment overrides onConfigurationChange, so we have to do this too
133+
override fun onConfigurationChanged(newConfig: Configuration?) {
134+
super.onConfigurationChanged(newConfig)
135+
configureQuickAccessGridLayout(binding.quickAccessRecyclerView)
136+
}
137+
131138
override fun onAttachedToWindow() {
132139
AndroidSupportInjection.inject(this)
133140
super.onAttachedToWindow()

0 commit comments

Comments
 (0)