From bc6d10e29a6fe2dadb51bfd130e7463db7a5506c Mon Sep 17 00:00:00 2001 From: Charles Lombardo Date: Wed, 15 Mar 2023 03:31:36 -0400 Subject: [PATCH] Android: Convert HeaderViewHolder to Kotlin --- .../ui/viewholder/HeaderViewHolder.java | 42 ------------------- .../ui/viewholder/HeaderViewHolder.kt | 27 ++++++++++++ 2 files changed, 27 insertions(+), 42 deletions(-) delete mode 100644 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/HeaderViewHolder.java create mode 100644 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/HeaderViewHolder.kt diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/HeaderViewHolder.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/HeaderViewHolder.java deleted file mode 100644 index 889b087396..0000000000 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/HeaderViewHolder.java +++ /dev/null @@ -1,42 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -package org.dolphinemu.dolphinemu.features.settings.ui.viewholder; - -import android.view.View; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import org.dolphinemu.dolphinemu.features.settings.model.view.SettingsItem; -import org.dolphinemu.dolphinemu.features.settings.ui.SettingsAdapter; -import org.dolphinemu.dolphinemu.databinding.ListItemHeaderBinding; - -public class HeaderViewHolder extends SettingViewHolder -{ - private final ListItemHeaderBinding mBinding; - - public HeaderViewHolder(@NonNull ListItemHeaderBinding binding, SettingsAdapter adapter) - { - super(binding.getRoot(), adapter); - itemView.setOnClickListener(null); - mBinding = binding; - } - - @Override - public void bind(@NonNull SettingsItem item) - { - mBinding.textHeaderName.setText(item.getName()); - } - - @Override - public void onClick(View clicked) - { - // no-op - } - - @Nullable @Override - protected SettingsItem getItem() - { - return 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 new file mode 100644 index 0000000000..0f28bf1ffe --- /dev/null +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/HeaderViewHolder.kt @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +package org.dolphinemu.dolphinemu.features.settings.ui.viewholder + +import android.view.View +import org.dolphinemu.dolphinemu.databinding.ListItemHeaderBinding +import org.dolphinemu.dolphinemu.features.settings.model.view.SettingsItem +import org.dolphinemu.dolphinemu.features.settings.ui.SettingsAdapter + +open class HeaderViewHolder( + private val binding: ListItemHeaderBinding, + adapter: SettingsAdapter? +) : SettingViewHolder(binding.root, adapter!!) { + override val item: SettingsItem? = null + + init { + itemView.setOnClickListener(null) + } + + override fun bind(item: SettingsItem) { + binding.textHeaderName.text = item.name + } + + override fun onClick(clicked: View) { + // no-op + } +}