Android: Convert AdvancedMappingControlViewHolder to Kotlin

This commit is contained in:
Charles Lombardo 2023-06-10 05:17:10 -04:00
parent dac7035119
commit d049be0cad
2 changed files with 23 additions and 34 deletions

View File

@ -1,34 +0,0 @@
// SPDX-License-Identifier: GPL-2.0-or-later
package org.dolphinemu.dolphinemu.features.input.ui;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import org.dolphinemu.dolphinemu.databinding.ListItemAdvancedMappingControlBinding;
import java.util.function.Consumer;
public class AdvancedMappingControlViewHolder extends RecyclerView.ViewHolder
{
private final ListItemAdvancedMappingControlBinding mBinding;
private String mName;
public AdvancedMappingControlViewHolder(@NonNull ListItemAdvancedMappingControlBinding binding,
Consumer<String> onClickCallback)
{
super(binding.getRoot());
mBinding = binding;
binding.getRoot().setOnClickListener(view -> onClickCallback.accept(mName));
}
public void bind(String name)
{
mName = name;
mBinding.textName.setText(name);
}
}

View File

@ -0,0 +1,23 @@
// SPDX-License-Identifier: GPL-2.0-or-later
package org.dolphinemu.dolphinemu.features.input.ui
import androidx.recyclerview.widget.RecyclerView
import org.dolphinemu.dolphinemu.databinding.ListItemAdvancedMappingControlBinding
import java.util.function.Consumer
class AdvancedMappingControlViewHolder(
private val binding: ListItemAdvancedMappingControlBinding,
onClickCallback: Consumer<String>
) : RecyclerView.ViewHolder(binding.root) {
private lateinit var name: String
init {
binding.root.setOnClickListener { onClickCallback.accept(name) }
}
fun bind(name: String) {
this.name = name
binding.textName.text = name
}
}