From c378365324d73880ab99895cdd2b0fa39dafe8ea Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sat, 2 Sep 2023 11:37:27 +0200 Subject: [PATCH] Android: Get rid of unnecessary nullability in features.settings --- .../input/model/view/InputDeviceSetting.kt | 2 +- .../features/settings/model/NativeConfig.kt | 2 +- .../features/settings/model/StringSetting.kt | 2 +- .../settings/model/view/FloatSliderSetting.kt | 10 +++---- .../settings/model/view/HeaderSetting.kt | 2 +- .../settings/model/view/IntSliderSetting.kt | 6 ++-- .../model/view/InvertedSwitchSetting.kt | 4 +-- .../settings/model/view/LogSwitchSetting.kt | 4 +-- .../model/view/PercentSliderSetting.kt | 6 ++-- .../settings/model/view/SettingsItem.kt | 4 +-- .../model/view/SingleChoiceSetting.kt | 4 +-- .../settings/model/view/SliderSetting.kt | 8 ++--- .../model/view/StringSingleChoiceSetting.kt | 30 ++++++++----------- .../settings/model/view/SwitchSetting.kt | 10 +++---- .../features/settings/ui/SettingsAdapter.kt | 20 ++++++------- .../features/settings/ui/SettingsFragment.kt | 4 +-- .../ui/viewholder/FilePickerViewHolder.kt | 4 +-- .../viewholder/HeaderHyperLinkViewHolder.kt | 2 +- .../ui/viewholder/HeaderViewHolder.kt | 4 +-- .../ui/viewholder/RunRunnableViewHolder.kt | 5 ++-- .../ui/viewholder/SingleChoiceViewHolder.kt | 2 +- .../ui/viewholder/SliderViewHolder.kt | 5 ++-- 22 files changed, 69 insertions(+), 71 deletions(-) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/view/InputDeviceSetting.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/view/InputDeviceSetting.kt index c98af542c7..4ca29d9f33 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/view/InputDeviceSetting.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/view/InputDeviceSetting.kt @@ -13,7 +13,7 @@ class InputDeviceSetting( titleId: Int, descriptionId: Int, private val controller: EmulatedController -) : StringSingleChoiceSetting(context, null, titleId, descriptionId, null, null, null) { +) : StringSingleChoiceSetting(context, null, titleId, descriptionId, arrayOf(), arrayOf(), null) { init { refreshChoicesAndValues() } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/NativeConfig.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/NativeConfig.kt index c49667574e..5a2b31ce49 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/NativeConfig.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/NativeConfig.kt @@ -75,7 +75,7 @@ object NativeConfig { file: String, section: String, key: String, - value: String? + value: String ) @JvmStatic diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/StringSetting.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/StringSetting.kt index 7833e83542..bea6521229 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/StringSetting.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/StringSetting.kt @@ -94,7 +94,7 @@ enum class StringSetting( NativeConfig.setString(settings.writeLayer, file, section, key, newValue) } - fun setString(layer: Int, newValue: String?) { + fun setString(layer: Int, newValue: String) { NativeConfig.setString(layer, file, section, key, newValue) } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/FloatSliderSetting.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/FloatSliderSetting.kt index ee07c64056..34d0b0eb00 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/FloatSliderSetting.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/FloatSliderSetting.kt @@ -26,7 +26,7 @@ open class FloatSliderSetting : SliderSetting { descriptionId: Int, min: Float, max: Float, - units: String?, + units: String, stepSize: Float, showDecimal: Boolean ) : super(context, titleId, descriptionId, units, showDecimal) { @@ -39,10 +39,10 @@ open class FloatSliderSetting : SliderSetting { constructor( setting: AbstractFloatSetting, name: CharSequence, - description: CharSequence?, + description: CharSequence, min: Float, max: Float, - units: String?, + units: String, stepSize: Float, showDecimal: Boolean ) : super(name, description, units, showDecimal) { @@ -55,9 +55,9 @@ open class FloatSliderSetting : SliderSetting { open val selectedValue: Float get() = floatSetting.float - open fun setSelectedValue(settings: Settings?, selection: Float) { + open fun setSelectedValue(settings: Settings, selection: Float) { floatSetting.setFloat( - settings!!, + settings, BigDecimal((selection).toDouble()).round(MathContext(3)).toFloat() ) } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/HeaderSetting.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/HeaderSetting.kt index 3a166ddddf..57c2aeb49f 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/HeaderSetting.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/HeaderSetting.kt @@ -14,7 +14,7 @@ open class HeaderSetting : SettingsItem { descriptionId: Int ) : super(context, titleId, descriptionId) - constructor(title: CharSequence, description: CharSequence?) : super(title, description) + constructor(title: CharSequence, description: CharSequence) : super(title, description) override val type: Int = TYPE_HEADER } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/IntSliderSetting.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/IntSliderSetting.kt index 45f2a71e69..a03af5dd6a 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/IntSliderSetting.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/IntSliderSetting.kt @@ -14,7 +14,7 @@ class IntSliderSetting( descriptionId: Int, val min: Int, val max: Int, - units: String?, + units: String, val stepSize: Int ) : SliderSetting(context, titleId, descriptionId, units, false) { @@ -24,7 +24,7 @@ class IntSliderSetting( val selectedValue: Int get() = intSetting.int - fun setSelectedValue(settings: Settings?, selection: Int) { - intSetting.setInt(settings!!, selection) + fun setSelectedValue(settings: Settings, selection: Int) { + intSetting.setInt(settings, selection) } } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/InvertedSwitchSetting.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/InvertedSwitchSetting.kt index 1a423c62f5..903ee39597 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/InvertedSwitchSetting.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/InvertedSwitchSetting.kt @@ -19,7 +19,7 @@ class InvertedSwitchSetting( override val isChecked: Boolean get() = !booleanSetting.boolean - override fun setChecked(settings: Settings?, checked: Boolean) { - booleanSetting.setBoolean(settings!!, !checked) + override fun setChecked(settings: Settings, checked: Boolean) { + booleanSetting.setBoolean(settings, !checked) } } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/LogSwitchSetting.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/LogSwitchSetting.kt index 1bad7bff9f..830adb5353 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/LogSwitchSetting.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/LogSwitchSetting.kt @@ -7,8 +7,8 @@ import org.dolphinemu.dolphinemu.features.settings.model.Settings class LogSwitchSetting( var key: String, - title: CharSequence?, - description: CharSequence? + title: CharSequence, + description: CharSequence ) : SwitchSetting( AdHocBooleanSetting( Settings.FILE_LOGGER, diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/PercentSliderSetting.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/PercentSliderSetting.kt index 165bdebdc8..88b3667e4c 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/PercentSliderSetting.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/PercentSliderSetting.kt @@ -15,7 +15,7 @@ class PercentSliderSetting( descriptionId: Int, min: Float, max: Float, - units: String?, + units: String, stepSize: Float, showDecimal: Boolean ) : FloatSliderSetting( @@ -32,9 +32,9 @@ class PercentSliderSetting( override val selectedValue: Float get() = (floatSetting.float * 100) - override fun setSelectedValue(settings: Settings?, selection: Float) { + override fun setSelectedValue(settings: Settings, selection: Float) { floatSetting.setFloat( - settings!!, + settings, BigDecimal((selection / 100).toDouble()).round(MathContext(3)).toFloat() ) } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SettingsItem.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SettingsItem.kt index 2180cbe029..3209400ff6 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SettingsItem.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SettingsItem.kt @@ -14,7 +14,7 @@ import org.dolphinemu.dolphinemu.features.settings.model.Settings */ abstract class SettingsItem { val name: CharSequence - val description: CharSequence? + val description: CharSequence /** * Base constructor. @@ -22,7 +22,7 @@ abstract class SettingsItem { * @param name A text string to be displayed as this Setting's name. * @param description A text string to be displayed as this Setting's description. */ - constructor(name: CharSequence, description: CharSequence?) { + constructor(name: CharSequence, description: CharSequence) { this.name = name this.description = description } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SingleChoiceSetting.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SingleChoiceSetting.kt index cd9f3ddb64..4744e9f351 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SingleChoiceSetting.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SingleChoiceSetting.kt @@ -24,7 +24,7 @@ class SingleChoiceSetting( val selectedValue: Int get() = intSetting.int - fun setSelectedValue(settings: Settings?, selection: Int) { - intSetting.setInt(settings!!, selection) + fun setSelectedValue(settings: Settings, selection: Int) { + intSetting.setInt(settings, selection) } } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SliderSetting.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SliderSetting.kt index 83b047f7a5..97703b269c 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SliderSetting.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SliderSetting.kt @@ -7,14 +7,14 @@ import android.content.Context sealed class SliderSetting : SettingsItem { override val type: Int = TYPE_SLIDER - val units: String? + val units: String val showDecimal: Boolean constructor( context: Context, nameId: Int, descriptionId: Int, - units: String?, + units: String, showDecimal: Boolean ) : super(context, nameId, descriptionId) { this.units = units @@ -23,8 +23,8 @@ sealed class SliderSetting : SettingsItem { constructor( name: CharSequence, - description: CharSequence?, - units: String?, + description: CharSequence, + units: String, showDecimal: Boolean ) : super(name, description) { this.units = units diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/StringSingleChoiceSetting.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/StringSingleChoiceSetting.kt index a67992ce2b..003dc22a08 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/StringSingleChoiceSetting.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/StringSingleChoiceSetting.kt @@ -17,15 +17,15 @@ open class StringSingleChoiceSetting : SettingsItem { override val setting: AbstractSetting? get() = stringSetting - var choices: Array? + var choices: Array protected set - var values: Array? + var values: Array protected set val menuTag: MenuTag? var noChoicesAvailableString = 0 private set - open val selectedChoice: String? + open val selectedChoice: String get() = getChoiceAt(selectedValueIndex) open val selectedValue: String @@ -37,8 +37,8 @@ open class StringSingleChoiceSetting : SettingsItem { setting: AbstractStringSetting?, titleId: Int, descriptionId: Int, - choices: Array?, - values: Array?, + choices: Array, + values: Array, menuTag: MenuTag? = null ) : super(context, titleId, descriptionId) { stringSetting = setting @@ -75,27 +75,23 @@ open class StringSingleChoiceSetting : SettingsItem { this.menuTag = menuTag } - fun getChoiceAt(index: Int): String? { - if (choices == null) return null - - return if (index >= 0 && index < choices!!.size) { - choices!![index] + fun getChoiceAt(index: Int): String { + return if (index >= 0 && index < choices.size) { + choices[index] } else "" } - fun getValueAt(index: Int): String? { - if (values == null) return null - - return if (index >= 0 && index < values!!.size) { - values!![index] + fun getValueAt(index: Int): String { + return if (index >= 0 && index < values.size) { + values[index] } else "" } val selectedValueIndex: Int get() { val selectedValue = selectedValue - for (i in values!!.indices) { - if (values!![i] == selectedValue) { + for (i in values.indices) { + if (values[i] == selectedValue) { return i } } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SwitchSetting.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SwitchSetting.kt index 5f9d0cb218..6df17c201b 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SwitchSetting.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SwitchSetting.kt @@ -26,16 +26,16 @@ open class SwitchSetting : SettingsItem { constructor( setting: AbstractBooleanSetting, - title: CharSequence?, - description: CharSequence? - ) : super(title!!, description) { + title: CharSequence, + description: CharSequence + ) : super(title, description) { booleanSetting = setting } open val isChecked: Boolean get() = booleanSetting.boolean - open fun setChecked(settings: Settings?, checked: Boolean) { - booleanSetting.setBoolean(settings!!, checked) + open fun setChecked(settings: Settings, checked: Boolean) { + booleanSetting.setBoolean(settings, checked) } } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsAdapter.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsAdapter.kt index b76d152d60..0d2b8786b0 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsAdapter.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsAdapter.kt @@ -138,7 +138,7 @@ class SettingsAdapter( return getItem(position).type } - fun setSettings(settings: ArrayList?) { + fun setSettings(settings: ArrayList) { settingsList = settings notifyDataSetChanged() } @@ -154,7 +154,7 @@ class SettingsAdapter( } fun onBooleanClick(item: SwitchSetting, checked: Boolean) { - item.setChecked(settings, checked) + item.setChecked(settings!!, checked) fragmentView.onSettingChanged() } @@ -194,7 +194,7 @@ class SettingsAdapter( item.refreshChoicesAndValues() val choices = item.choices val noChoicesAvailableString = item.noChoicesAvailableString - dialog = if (noChoicesAvailableString != 0 && choices!!.isEmpty()) { + dialog = if (noChoicesAvailableString != 0 && choices.isEmpty()) { MaterialAlertDialogBuilder(fragmentView.fragmentActivity) .setTitle(item.name) .setMessage(noChoicesAvailableString) @@ -355,7 +355,7 @@ class SettingsAdapter( dialog.show() } - fun onFilePickerDirectoryClick(item: SettingsItem?, position: Int) { + fun onFilePickerDirectoryClick(item: SettingsItem, position: Int) { clickedItem = item clickedPosition = position @@ -442,9 +442,9 @@ class SettingsAdapter( } fun onFilePickerConfirmation(selectedFile: String) { - val filePicker = clickedItem as FilePicker? + val filePicker = clickedItem as FilePicker - if (filePicker!!.getSelectedValue() != selectedFile) { + if (filePicker.getSelectedValue() != selectedFile) { notifyItemChanged(clickedPosition) fragmentView.onSettingChanged() } @@ -470,7 +470,7 @@ class SettingsAdapter( val value = getValueForSingleChoiceSelection(scSetting, which) if (scSetting.selectedValue != value) fragmentView.onSettingChanged() - scSetting.setSelectedValue(settings, value) + scSetting.setSelectedValue(settings!!, value) closeDialog() } @@ -490,7 +490,7 @@ class SettingsAdapter( val value = scSetting.getValueAt(which) if (scSetting.selectedValue != value) fragmentView.onSettingChanged() - scSetting.setSelectedValue(settings!!, value!!) + scSetting.setSelectedValue(settings!!, value) closeDialog() } @@ -499,7 +499,7 @@ class SettingsAdapter( if (sliderSetting.selectedValue != seekbarProgress.toInt()) { fragmentView.onSettingChanged() } - sliderSetting.setSelectedValue(settings, seekbarProgress.toInt()) + sliderSetting.setSelectedValue(settings!!, seekbarProgress.toInt()) closeDialog() } is FloatSliderSetting -> { @@ -507,7 +507,7 @@ class SettingsAdapter( if (sliderSetting.selectedValue != seekbarProgress) fragmentView.onSettingChanged() - sliderSetting.setSelectedValue(settings, seekbarProgress) + sliderSetting.setSelectedValue(settings!!, seekbarProgress) closeDialog() } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragment.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragment.kt index 8101d9efbf..651a86db51 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragment.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragment.kt @@ -90,8 +90,8 @@ class SettingsFragment : Fragment(), SettingsFragmentView { setInsets() - val activity = activity as SettingsActivityView? - presenter.onViewCreated(menuTag, activity!!.settings) + val activity = requireActivity() as SettingsActivityView + presenter.onViewCreated(menuTag, activity.settings) } override fun onDestroyView() { diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/FilePickerViewHolder.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/FilePickerViewHolder.kt index 215615828e..ff6246d292 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/FilePickerViewHolder.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/FilePickerViewHolder.kt @@ -15,8 +15,8 @@ import org.dolphinemu.dolphinemu.utils.FileBrowserHelper class FilePickerViewHolder( private val binding: ListItemSettingBinding, - adapter: SettingsAdapter? -) : SettingViewHolder(binding.getRoot(), adapter!!) { + adapter: SettingsAdapter +) : SettingViewHolder(binding.getRoot(), adapter) { lateinit var setting: FilePicker override val item: SettingsItem diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/HeaderHyperLinkViewHolder.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/HeaderHyperLinkViewHolder.kt index 5bb58cf489..ab1caafebb 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/HeaderHyperLinkViewHolder.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/HeaderHyperLinkViewHolder.kt @@ -11,7 +11,7 @@ import org.dolphinemu.dolphinemu.features.settings.ui.SettingsAdapter class HeaderHyperLinkViewHolder( private val binding: ListItemHeaderBinding, - adapter: SettingsAdapter? + adapter: SettingsAdapter ) : HeaderViewHolder(binding, adapter) { init { itemView.setOnClickListener(null) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/HeaderViewHolder.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/HeaderViewHolder.kt index 0f28bf1ffe..b1ca115711 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/HeaderViewHolder.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/HeaderViewHolder.kt @@ -9,8 +9,8 @@ import org.dolphinemu.dolphinemu.features.settings.ui.SettingsAdapter open class HeaderViewHolder( private val binding: ListItemHeaderBinding, - adapter: SettingsAdapter? -) : SettingViewHolder(binding.root, adapter!!) { + adapter: SettingsAdapter +) : SettingViewHolder(binding.root, adapter) { override val item: SettingsItem? = null init { diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/RunRunnableViewHolder.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/RunRunnableViewHolder.kt index 2ff39d51d5..a3b6e6dcc1 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/RunRunnableViewHolder.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/RunRunnableViewHolder.kt @@ -14,9 +14,10 @@ import org.dolphinemu.dolphinemu.features.settings.model.view.SettingsItem import org.dolphinemu.dolphinemu.features.settings.ui.SettingsAdapter class RunRunnableViewHolder( - private val mBinding: ListItemSettingBinding, adapter: SettingsAdapter?, + private val mBinding: ListItemSettingBinding, + adapter: SettingsAdapter, private val mContext: Context -) : SettingViewHolder(mBinding.getRoot(), adapter!!) { +) : SettingViewHolder(mBinding.getRoot(), adapter) { private lateinit var setting: RunRunnable override val item: SettingsItem diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SingleChoiceViewHolder.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SingleChoiceViewHolder.kt index dabc51a986..4e66555f95 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SingleChoiceViewHolder.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SingleChoiceViewHolder.kt @@ -73,7 +73,7 @@ class SingleChoiceViewHolder( } override fun onClick(clicked: View) { - if (!item?.isEditable!!) { + if (!item!!.isEditable) { showNotRuntimeEditableError() return } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SliderViewHolder.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SliderViewHolder.kt index 0ec51430c7..27665f667a 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SliderViewHolder.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SliderViewHolder.kt @@ -14,9 +14,10 @@ import org.dolphinemu.dolphinemu.features.settings.model.view.SliderSetting import org.dolphinemu.dolphinemu.features.settings.ui.SettingsAdapter class SliderViewHolder( - private val binding: ListItemSettingBinding, adapter: SettingsAdapter?, + private val binding: ListItemSettingBinding, + adapter: SettingsAdapter, private val context: Context -) : SettingViewHolder(binding.root, adapter!!) { +) : SettingViewHolder(binding.root, adapter) { private lateinit var setting: SliderSetting override val item: SettingsItem