1
0
Fork 0

For #12992 - Correctly notifies concat adapters about mode changes

master
ekager 2020-07-29 11:08:14 -04:00 committed by Emily Kager
parent 2c0511c92f
commit 87a7b6f9ec
2 changed files with 8 additions and 3 deletions

View File

@ -7,6 +7,7 @@ package org.mozilla.fenix.tabtray
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.core.view.isVisible
import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
@ -31,7 +32,10 @@ class SaveToCollectionsButtonAdapter(
return ViewHolder(itemView, interactor) return ViewHolder(itemView, interactor)
} }
override fun onBindViewHolder(holder: ViewHolder, position: Int) = Unit override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.itemView.isVisible =
interactor.onModeRequested() is TabTrayDialogFragmentState.Mode.Normal
}
override fun getItemViewType(position: Int): Int { override fun getItemViewType(position: Int): Int {
return ViewHolder.LAYOUT_ID return ViewHolder.LAYOUT_ID

View File

@ -413,7 +413,8 @@ class TabTrayView(
isPrivateModeSelected isPrivateModeSelected
) )
this.adapter?.notifyItemRangeChanged(0, tabs.size, true) collectionsButtonAdapter.notifyItemChanged(0)
tabsAdapter.notifyItemRangeChanged(0, tabs.size, true)
} }
} }
@ -425,7 +426,7 @@ class TabTrayView(
val selectedBrowserTabIndex = tabs.indexOfFirst { it.id == itemId } val selectedBrowserTabIndex = tabs.indexOfFirst { it.id == itemId }
this.adapter?.notifyItemChanged( tabsAdapter.notifyItemChanged(
selectedBrowserTabIndex, true selectedBrowserTabIndex, true
) )
} }