diff options
author | Charles Lombardo <clombardo169@gmail.com> | 2023-03-08 02:04:17 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2023-06-03 09:05:37 +0200 |
commit | e02e33826b79b3fbb14ab3cacbb70bd83aa6d1cb (patch) | |
tree | 5a8ffb5c7f88acb18a5f5f3b69d4179b49bfaf7e | |
parent | android: Convert CheckBoxSettingViewHolder to Kotlin (diff) | |
download | yuzu-e02e33826b79b3fbb14ab3cacbb70bd83aa6d1cb.tar yuzu-e02e33826b79b3fbb14ab3cacbb70bd83aa6d1cb.tar.gz yuzu-e02e33826b79b3fbb14ab3cacbb70bd83aa6d1cb.tar.bz2 yuzu-e02e33826b79b3fbb14ab3cacbb70bd83aa6d1cb.tar.lz yuzu-e02e33826b79b3fbb14ab3cacbb70bd83aa6d1cb.tar.xz yuzu-e02e33826b79b3fbb14ab3cacbb70bd83aa6d1cb.tar.zst yuzu-e02e33826b79b3fbb14ab3cacbb70bd83aa6d1cb.zip |
2 files changed, 35 insertions, 47 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/DateTimeViewHolder.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/DateTimeViewHolder.java deleted file mode 100644 index 60a65b71a..000000000 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/DateTimeViewHolder.java +++ /dev/null @@ -1,47 +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.DateTimeSetting; -import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem; -import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter; -import org.yuzu.yuzu_emu.utils.Log; - -public final class DateTimeViewHolder extends SettingViewHolder { - private DateTimeSetting mItem; - - private TextView mTextSettingName; - private TextView mTextSettingDescription; - - public DateTimeViewHolder(View itemView, SettingsAdapter adapter) { - super(itemView, adapter); - } - - @Override - protected void findViews(View root) { - mTextSettingName = root.findViewById(R.id.text_setting_name); - Log.error("test " + mTextSettingName); - mTextSettingDescription = root.findViewById(R.id.text_setting_description); - Log.error("test " + mTextSettingDescription); - } - - @Override - public void bind(SettingsItem item) { - mItem = (DateTimeSetting) 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().onDateTimeClick(mItem, getAdapterPosition()); - } -} diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/DateTimeViewHolder.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/DateTimeViewHolder.kt new file mode 100644 index 000000000..1319ebfbd --- /dev/null +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/DateTimeViewHolder.kt @@ -0,0 +1,35 @@ +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.DateTimeSetting +import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem +import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter + +class DateTimeViewHolder(itemView: View, adapter: SettingsAdapter) : + SettingViewHolder(itemView, adapter) { + private lateinit var item: DateTimeSetting + 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 DateTimeSetting + 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.onDateTimeClick(item, bindingAdapterPosition) + } +} |