diff options
author | Charles Lombardo <clombardo169@gmail.com> | 2023-03-08 02:05:14 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2023-06-03 09:05:37 +0200 |
commit | 6044d924f7f4f53c941611703fe53bbe6715fdd9 (patch) | |
tree | efed69503eba0a0e7767c3e9f1fa15fd99c35256 /src | |
parent | android: Convert SingleChoiceViewHolder to Kotlin (diff) | |
download | yuzu-6044d924f7f4f53c941611703fe53bbe6715fdd9.tar yuzu-6044d924f7f4f53c941611703fe53bbe6715fdd9.tar.gz yuzu-6044d924f7f4f53c941611703fe53bbe6715fdd9.tar.bz2 yuzu-6044d924f7f4f53c941611703fe53bbe6715fdd9.tar.lz yuzu-6044d924f7f4f53c941611703fe53bbe6715fdd9.tar.xz yuzu-6044d924f7f4f53c941611703fe53bbe6715fdd9.tar.zst yuzu-6044d924f7f4f53c941611703fe53bbe6715fdd9.zip |
Diffstat (limited to 'src')
2 files changed, 34 insertions, 45 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SliderViewHolder.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SliderViewHolder.java deleted file mode 100644 index 1f60a37ce..000000000 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SliderViewHolder.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.yuzu.yuzu_emu.features.settings.ui.viewholder; - -import android.view.View; -import android.widget.TextView; - -import org.yuzu.yuzu_emu.R; -import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem; -import org.yuzu.yuzu_emu.features.settings.model.view.SliderSetting; -import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter; - -public final class SliderViewHolder extends SettingViewHolder { - private SliderSetting mItem; - - private TextView mTextSettingName; - private TextView mTextSettingDescription; - - public SliderViewHolder(View itemView, SettingsAdapter adapter) { - super(itemView, adapter); - } - - @Override - protected void findViews(View root) { - mTextSettingName = root.findViewById(R.id.text_setting_name); - mTextSettingDescription = root.findViewById(R.id.text_setting_description); - } - - @Override - public void bind(SettingsItem item) { - mItem = (SliderSetting) item; - - mTextSettingName.setText(item.getNameId()); - - if (item.getDescriptionId() > 0) { - mTextSettingDescription.setText(item.getDescriptionId()); - mTextSettingDescription.setVisibility(View.VISIBLE); - } else { - mTextSettingDescription.setVisibility(View.GONE); - } - } - - @Override - public void onClick(View clicked) { - getAdapter().onSliderClick(mItem, getAdapterPosition()); - } -} diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SliderViewHolder.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SliderViewHolder.kt new file mode 100644 index 000000000..4d1cff0f2 --- /dev/null +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SliderViewHolder.kt @@ -0,0 +1,34 @@ +package org.yuzu.yuzu_emu.features.settings.ui.viewholder + +import android.view.View +import android.widget.TextView +import org.yuzu.yuzu_emu.R +import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem +import org.yuzu.yuzu_emu.features.settings.model.view.SliderSetting +import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter + +class SliderViewHolder(itemView: View, adapter: SettingsAdapter) : SettingViewHolder(itemView, adapter) { + private lateinit var item: SliderSetting + private lateinit var textSettingName: TextView + private lateinit var textSettingDescription: TextView + + override fun findViews(root: View) { + textSettingName = root.findViewById(R.id.text_setting_name) + textSettingDescription = root.findViewById(R.id.text_setting_description) + } + + override fun bind(item: SettingsItem) { + this.item = item as SliderSetting + textSettingName.setText(item.nameId) + if (item.descriptionId!! > 0) { + textSettingDescription.setText(item.descriptionId) + textSettingDescription.visibility = View.VISIBLE + } else { + textSettingDescription.visibility = View.GONE + } + } + + override fun onClick(clicked: View) { + adapter.onSliderClick(item, bindingAdapterPosition) + } +} |