Android: Convert AdvancedMappingControlViewHolder to Kotlin
This commit is contained in:
parent
dac7035119
commit
d049be0cad
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue