From 57eb2b9549154db9d58707fcf89593030eddf5ac Mon Sep 17 00:00:00 2001 From: Jonathan Almeida Date: Thu, 7 May 2020 11:13:43 -0400 Subject: [PATCH] For #10453: Do not set item decoration when creating ViewHolder --- .../java/org/mozilla/fenix/HomeActivity.kt | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/HomeActivity.kt b/app/src/main/java/org/mozilla/fenix/HomeActivity.kt index f5c390efe..04a02f436 100644 --- a/app/src/main/java/org/mozilla/fenix/HomeActivity.kt +++ b/app/src/main/java/org/mozilla/fenix/HomeActivity.kt @@ -223,15 +223,6 @@ open class HomeActivity : LocaleAwareAppCompatActivity() { TabsTray::class.java.name -> { val layout = LinearLayoutManager(context) val adapter = TabsAdapter { parentView, tabsTray -> - val decoration = DividerItemDecoration( - context, - DividerItemDecoration.VERTICAL - ) - val drawable = AppCompatResources.getDrawable(context, R.drawable.tab_tray_divider) - drawable?.let { - decoration.setDrawable(it) - tabsTray.addItemDecoration(decoration) - } DefaultTabViewHolder( LayoutInflater.from(parentView.context).inflate( @@ -241,7 +232,17 @@ open class HomeActivity : LocaleAwareAppCompatActivity() { tabsTray ) } - BrowserTabsTray(context, attrs, tabsAdapter = adapter, layout = layout) + val tray = BrowserTabsTray(context, attrs, tabsAdapter = adapter, layout = layout) + val decoration = DividerItemDecoration( + context, + DividerItemDecoration.VERTICAL + ) + val drawable = AppCompatResources.getDrawable(context, R.drawable.tab_tray_divider) + drawable?.let { + decoration.setDrawable(it) + tray.addItemDecoration(decoration) + } + tray } else -> super.onCreateView(parent, name, context, attrs) }