mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-17 15:26:23 +00:00
[fenix] fixes https://github.com/mozilla-mobile/fenix/issues/20833: move home recycler bottom margin into standalone item
This commit is contained in:
parent
816677db45
commit
817760d64c
@ -0,0 +1,28 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.fenix.home
|
||||
|
||||
import android.view.View
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.ComposeView
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.mozilla.fenix.theme.FirefoxTheme
|
||||
|
||||
class BottomSpacerViewHolder(val composeView: ComposeView) : RecyclerView.ViewHolder(composeView) {
|
||||
init {
|
||||
composeView.setContent {
|
||||
FirefoxTheme {
|
||||
Spacer(modifier = Modifier.height(88.dp))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
val LAYOUT_ID = View.generateViewId()
|
||||
}
|
||||
}
|
@ -44,6 +44,7 @@ import org.mozilla.fenix.home.sessioncontrol.viewholders.onboarding.OnboardingTh
|
||||
import org.mozilla.fenix.home.sessioncontrol.viewholders.onboarding.OnboardingToolbarPositionPickerViewHolder
|
||||
import org.mozilla.fenix.home.sessioncontrol.viewholders.onboarding.OnboardingTrackingProtectionViewHolder
|
||||
import org.mozilla.fenix.home.tips.ButtonTipViewHolder
|
||||
import org.mozilla.fenix.home.BottomSpacerViewHolder
|
||||
import org.mozilla.fenix.home.topsites.TopSitePagerViewHolder
|
||||
import mozilla.components.feature.tab.collections.Tab as ComponentTab
|
||||
|
||||
@ -168,6 +169,8 @@ sealed class AdapterItem(@LayoutRes val viewType: Int) {
|
||||
object PocketStoriesItem :
|
||||
AdapterItem(PocketStoriesViewHolder.LAYOUT_ID)
|
||||
|
||||
object BottomSpacer : AdapterItem(BottomSpacerViewHolder.LAYOUT_ID)
|
||||
|
||||
/**
|
||||
* True if this item represents the same value as other. Used by [AdapterItemDiffCallback].
|
||||
*/
|
||||
@ -232,6 +235,9 @@ class SessionControlAdapter(
|
||||
interactor = interactor,
|
||||
metrics = components.analytics.metrics
|
||||
)
|
||||
BottomSpacerViewHolder.LAYOUT_ID -> return BottomSpacerViewHolder(
|
||||
composeView = ComposeView(parent.context)
|
||||
)
|
||||
}
|
||||
|
||||
val view = LayoutInflater.from(parent.context).inflate(viewType, parent, false)
|
||||
|
@ -93,6 +93,8 @@ internal fun normalModeAdapterItems(
|
||||
items.add(AdapterItem.CustomizeHomeButton)
|
||||
}
|
||||
|
||||
items.add(AdapterItem.BottomSpacer)
|
||||
|
||||
return items
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,6 @@
|
||||
android:layout_height="match_parent"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:layout_marginBottom="88dp"
|
||||
android:paddingVertical="16dp"
|
||||
android:scrollbars="none"
|
||||
android:transitionGroup="false"
|
||||
|
@ -265,7 +265,7 @@ class SessionControlViewTest {
|
||||
historyMetadata,
|
||||
pocketArticles
|
||||
)
|
||||
assertEquals(results.size, 1)
|
||||
assertEquals(results.size, 2)
|
||||
assertTrue(results[0] is AdapterItem.TopPlaceholderItem)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user