Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

Commit

Permalink
Handle onBindViewHolder signature updates.
Browse files Browse the repository at this point in the history
Preference.onBindViewHolder method now expects a NonNull PreferenceViewHolder param.
  • Loading branch information
mcarare authored and mergify[bot] committed Nov 21, 2022
1 parent d3854b2 commit 1771069
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ class ManualAddSearchEnginePreference(context: Context, attrs: AttributeSet) :
private var savedSearchEngineName: String? = null
private var savedSearchQuery: String? = null

override fun onBindViewHolder(holder: PreferenceViewHolder?) {
override fun onBindViewHolder(holder: PreferenceViewHolder) {
super.onBindViewHolder(holder)

engineNameErrorLayout =
holder!!.findViewById(R.id.edit_engine_name_layout) as TextInputLayout
holder.findViewById(R.id.edit_engine_name_layout) as TextInputLayout
searchQueryErrorLayout =
holder.findViewById(R.id.edit_search_string_layout) as TextInputLayout

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class MultiselectSearchEngineListPreference(context: Context, attrs: AttributeSe
return engineIdSet
}

override fun onBindViewHolder(holder: PreferenceViewHolder?) {
override fun onBindViewHolder(holder: PreferenceViewHolder) {
super.onBindViewHolder(holder)
bindEngineCheckboxesToMenu()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class RadioSearchEngineListPreference : SearchEngineListPreference, RadioGroup.O
@Suppress("unused")
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr)

override fun onBindViewHolder(holder: PreferenceViewHolder?) {
override fun onBindViewHolder(holder: PreferenceViewHolder) {
super.onBindViewHolder(holder)
searchEngineGroup!!.setOnCheckedChangeListener(this)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ abstract class SearchEngineListPreference @JvmOverloads constructor(
layoutResource = R.layout.preference_search_engine_chooser
}

override fun onBindViewHolder(holder: PreferenceViewHolder?) {
override fun onBindViewHolder(holder: PreferenceViewHolder) {
super.onBindViewHolder(holder)
searchEngineGroup = holder!!.itemView.findViewById(R.id.search_engine_group)
searchEngineGroup = holder.itemView.findViewById(R.id.search_engine_group)
val context = searchEngineGroup!!.context

searchEngines = context.components.store.state.search.searchEngines
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ abstract class LearnMoreSwitchPreference(context: Context?, attrs: AttributeSet?
layoutResource = R.layout.preference_switch_learn_more
}

override fun onBindViewHolder(holder: PreferenceViewHolder?) {
override fun onBindViewHolder(holder: PreferenceViewHolder) {
super.onBindViewHolder(holder)

getDescription()?.let {
val summaryView = holder!!.findViewById(android.R.id.summary) as TextView
val summaryView = holder.findViewById(android.R.id.summary) as TextView
summaryView.text = it
summaryView.isVisible = true
}

val learnMoreLink = holder!!.findViewById(R.id.link) as TextView
val learnMoreLink = holder.findViewById(R.id.link) as TextView
learnMoreLink.setOnClickListener {
val tabId = context.components.tabsUseCases.addTab(
getLearnMoreUrl(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ import org.mozilla.focus.ext.settings
class StatePreference(context: Context?, attrs: AttributeSet?) : Preference(context, attrs) {
private var summaryView: TextView? = null

override fun onBindViewHolder(holder: PreferenceViewHolder?) {
override fun onBindViewHolder(holder: PreferenceViewHolder) {
super.onBindViewHolder(holder)

summaryView =
holder?.let { parentView -> parentView.findViewById(android.R.id.summary) as TextView }
summaryView = holder.findViewById(android.R.id.summary) as TextView
setValueByKey(key)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import org.mozilla.focus.ext.settings
*/
class CookiesPreference(context: Context?, attrs: AttributeSet?) : ListPreference(context, attrs) {

override fun onBindViewHolder(holder: PreferenceViewHolder?) {
override fun onBindViewHolder(holder: PreferenceViewHolder) {
super.onBindViewHolder(holder)
updateSummary()
showIcon(holder)
Expand Down

0 comments on commit 1771069

Please sign in to comment.