diff --git a/app/src/main/java/org/mozilla/focus/search/ManualAddSearchEnginePreference.kt b/app/src/main/java/org/mozilla/focus/search/ManualAddSearchEnginePreference.kt index 8d71573c912..0e81fd29e4a 100644 --- a/app/src/main/java/org/mozilla/focus/search/ManualAddSearchEnginePreference.kt +++ b/app/src/main/java/org/mozilla/focus/search/ManualAddSearchEnginePreference.kt @@ -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 diff --git a/app/src/main/java/org/mozilla/focus/search/MultiselectSearchEngineListPreference.kt b/app/src/main/java/org/mozilla/focus/search/MultiselectSearchEngineListPreference.kt index e157304088c..4d043ab5402 100644 --- a/app/src/main/java/org/mozilla/focus/search/MultiselectSearchEngineListPreference.kt +++ b/app/src/main/java/org/mozilla/focus/search/MultiselectSearchEngineListPreference.kt @@ -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() } diff --git a/app/src/main/java/org/mozilla/focus/search/RadioSearchEngineListPreference.kt b/app/src/main/java/org/mozilla/focus/search/RadioSearchEngineListPreference.kt index eda57017ff4..a6241991794 100644 --- a/app/src/main/java/org/mozilla/focus/search/RadioSearchEngineListPreference.kt +++ b/app/src/main/java/org/mozilla/focus/search/RadioSearchEngineListPreference.kt @@ -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) } diff --git a/app/src/main/java/org/mozilla/focus/search/SearchEngineListPreference.kt b/app/src/main/java/org/mozilla/focus/search/SearchEngineListPreference.kt index b3efe86462d..9831534b8e7 100644 --- a/app/src/main/java/org/mozilla/focus/search/SearchEngineListPreference.kt +++ b/app/src/main/java/org/mozilla/focus/search/SearchEngineListPreference.kt @@ -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 diff --git a/app/src/main/java/org/mozilla/focus/settings/LearnMoreSwitchPreference.kt b/app/src/main/java/org/mozilla/focus/settings/LearnMoreSwitchPreference.kt index 19ba81f6e7b..a48ecf16453 100644 --- a/app/src/main/java/org/mozilla/focus/settings/LearnMoreSwitchPreference.kt +++ b/app/src/main/java/org/mozilla/focus/settings/LearnMoreSwitchPreference.kt @@ -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(), diff --git a/app/src/main/java/org/mozilla/focus/settings/StatePreference.kt b/app/src/main/java/org/mozilla/focus/settings/StatePreference.kt index 8b44170f1fd..adeb0c95adf 100644 --- a/app/src/main/java/org/mozilla/focus/settings/StatePreference.kt +++ b/app/src/main/java/org/mozilla/focus/settings/StatePreference.kt @@ -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) } diff --git a/app/src/main/java/org/mozilla/focus/widget/CookiesPreference.kt b/app/src/main/java/org/mozilla/focus/widget/CookiesPreference.kt index 5e6b64eb69e..8c87d81a505 100644 --- a/app/src/main/java/org/mozilla/focus/widget/CookiesPreference.kt +++ b/app/src/main/java/org/mozilla/focus/widget/CookiesPreference.kt @@ -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)