Android: Convert SubmenuViewHolder to Kotlin
This commit is contained in:
parent
760417b08f
commit
49e480ee53
|
@ -1,46 +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.databinding.ListItemSubmenuBinding;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.view.SettingsItem;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.view.SubmenuSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.SettingsAdapter;
|
||||
|
||||
public final class SubmenuViewHolder extends SettingViewHolder
|
||||
{
|
||||
private SubmenuSetting mItem;
|
||||
|
||||
private final ListItemSubmenuBinding mBinding;
|
||||
|
||||
public SubmenuViewHolder(@NonNull ListItemSubmenuBinding binding, SettingsAdapter adapter)
|
||||
{
|
||||
super(binding.getRoot(), adapter);
|
||||
mBinding = binding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bind(SettingsItem item)
|
||||
{
|
||||
mItem = (SubmenuSetting) item;
|
||||
|
||||
mBinding.textSettingName.setText(item.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View clicked)
|
||||
{
|
||||
getAdapter().onSubmenuClick(mItem);
|
||||
}
|
||||
|
||||
@Nullable @Override
|
||||
protected SettingsItem getItem()
|
||||
{
|
||||
return mItem;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
// 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.ListItemSubmenuBinding
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.view.SettingsItem
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.view.SubmenuSetting
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.SettingsAdapter
|
||||
|
||||
class SubmenuViewHolder(
|
||||
private val mBinding: ListItemSubmenuBinding,
|
||||
adapter: SettingsAdapter
|
||||
) : SettingViewHolder(mBinding.root, adapter) {
|
||||
private lateinit var setting: SubmenuSetting
|
||||
|
||||
override val item: SettingsItem
|
||||
get() = setting
|
||||
|
||||
override fun bind(item: SettingsItem) {
|
||||
setting = item as SubmenuSetting
|
||||
mBinding.textSettingName.text = item.name
|
||||
}
|
||||
|
||||
override fun onClick(clicked: View) {
|
||||
adapter.onSubmenuClick(setting)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue