From b202760cdc2b443fd07dcee593ed7f3e09d6b77b Mon Sep 17 00:00:00 2001 From: Bryson Steck Date: Tue, 4 May 2021 23:31:34 -0600 Subject: watched friend codes work --- .../wiimmterfaceandroid/RecentCodesAdapter.java | 59 ---------------------- 1 file changed, 59 deletions(-) delete mode 100644 app/src/main/java/com/example/wiimmterfaceandroid/RecentCodesAdapter.java (limited to 'app/src/main/java/com/example/wiimmterfaceandroid/RecentCodesAdapter.java') diff --git a/app/src/main/java/com/example/wiimmterfaceandroid/RecentCodesAdapter.java b/app/src/main/java/com/example/wiimmterfaceandroid/RecentCodesAdapter.java deleted file mode 100644 index 7d278de..0000000 --- a/app/src/main/java/com/example/wiimmterfaceandroid/RecentCodesAdapter.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.example.wiimmterfaceandroid; - -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.Button; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.databinding.ObservableArrayList; -import androidx.recyclerview.widget.RecyclerView; - -import com.example.wiimmterfaceandroid.model.FriendCode; -import com.google.android.material.card.MaterialCardView; -import com.google.android.material.textview.MaterialTextView; - -import java.util.List; - -public class RecentCodesAdapter extends RecyclerView.Adapter{ - ObservableArrayList entries; - OnFriendCodeClicked listener; - public interface OnFriendCodeClicked { - public void onClick(FriendCode entry); - } - - public RecentCodesAdapter (ObservableArrayList entries, OnFriendCodeClicked listener) { - this.entries = entries; - this.listener = listener; - } - - @NonNull - @Override - public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.recent_friend_codes_item, parent, false); - return new ViewHolder(view); - } - - @Override - public void onBindViewHolder(@NonNull ViewHolder holder, int position) { - Button fcButton = holder.itemView.findViewById(R.id.recent_friend_code_button); - FriendCode currentFC = entries.get(position); - fcButton.setText(currentFC.friendCode); - fcButton.setOnClickListener(view -> { - if (listener == null) return; - listener.onClick(currentFC); - }); - } - - @Override - public int getItemCount() { - return entries.size(); - } - - class ViewHolder extends RecyclerView.ViewHolder { - public ViewHolder(@NonNull View itemView) { - super(itemView); - } - } -} -- cgit v1.2.3