diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/ui/AdvancedMappingControlAdapter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/ui/AdvancedMappingControlAdapter.java deleted file mode 100644 index 0ad589fe40..0000000000 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/ui/AdvancedMappingControlAdapter.java +++ /dev/null @@ -1,55 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -package org.dolphinemu.dolphinemu.features.input.ui; - -import android.view.LayoutInflater; -import android.view.ViewGroup; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.RecyclerView; - -import org.dolphinemu.dolphinemu.databinding.ListItemAdvancedMappingControlBinding; - -import java.util.function.Consumer; - -public final class AdvancedMappingControlAdapter - extends RecyclerView.Adapter -{ - private final Consumer mOnClickCallback; - - private String[] mControls = new String[0]; - - public AdvancedMappingControlAdapter(Consumer onClickCallback) - { - mOnClickCallback = onClickCallback; - } - - @NonNull @Override - public AdvancedMappingControlViewHolder onCreateViewHolder(@NonNull ViewGroup parent, - int viewType) - { - LayoutInflater inflater = LayoutInflater.from(parent.getContext()); - - ListItemAdvancedMappingControlBinding binding = - ListItemAdvancedMappingControlBinding.inflate(inflater); - return new AdvancedMappingControlViewHolder(binding, mOnClickCallback); - } - - @Override - public void onBindViewHolder(@NonNull AdvancedMappingControlViewHolder holder, int position) - { - holder.bind(mControls[position]); - } - - @Override - public int getItemCount() - { - return mControls.length; - } - - public void setControls(String[] controls) - { - mControls = controls; - notifyDataSetChanged(); - } -} diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/ui/AdvancedMappingControlAdapter.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/ui/AdvancedMappingControlAdapter.kt new file mode 100644 index 0000000000..1c82616726 --- /dev/null +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/ui/AdvancedMappingControlAdapter.kt @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +package org.dolphinemu.dolphinemu.features.input.ui + +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.recyclerview.widget.RecyclerView +import org.dolphinemu.dolphinemu.databinding.ListItemAdvancedMappingControlBinding +import java.util.function.Consumer + +class AdvancedMappingControlAdapter(private val onClickCallback: Consumer) : + RecyclerView.Adapter() { + private var controls = emptyArray() + + override fun onCreateViewHolder( + parent: ViewGroup, + viewType: Int + ): AdvancedMappingControlViewHolder { + val inflater = LayoutInflater.from(parent.context) + val binding = ListItemAdvancedMappingControlBinding.inflate(inflater) + return AdvancedMappingControlViewHolder(binding, onClickCallback) + } + + override fun onBindViewHolder(holder: AdvancedMappingControlViewHolder, position: Int) = + holder.bind(controls[position]) + + override fun getItemCount(): Int = controls.size + + fun setControls(controls: Array) { + this.controls = controls + notifyDataSetChanged() + } +}