finished final project
This commit is contained in:
parent
b202760cdc
commit
8a2c211fa2
3 changed files with 7 additions and 6 deletions
|
@ -1,5 +1,6 @@
|
|||
package com.example.wiimmterfaceandroid;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -17,12 +18,13 @@ import com.google.android.material.button.MaterialButton;
|
|||
public class WatchCodeAdapter extends RecyclerView.Adapter<WatchCodeAdapter.ViewHolder>{
|
||||
ObservableArrayList<FriendCode> entries;
|
||||
OnFriendCodeClicked listener;
|
||||
Context context;
|
||||
public interface OnFriendCodeClicked {
|
||||
public void onClick(FriendCode entry);
|
||||
}
|
||||
|
||||
public WatchCodeAdapter(ObservableArrayList<FriendCode> entries) {
|
||||
|
||||
public WatchCodeAdapter(Context context, ObservableArrayList<FriendCode> entries) {
|
||||
this.context = context;
|
||||
this.entries = entries;
|
||||
}
|
||||
|
||||
|
@ -41,8 +43,7 @@ public class WatchCodeAdapter extends RecyclerView.Adapter<WatchCodeAdapter.View
|
|||
fcButton.setOnClickListener(view -> {
|
||||
Intent intent = new Intent(view.getContext(), WiimmfiActivity.class);
|
||||
intent.putExtra("friendCode", currentFC.friendCode);
|
||||
view.getContext();
|
||||
|
||||
context.startActivity(intent);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public class WatchCodeFragment extends Fragment {
|
|||
super.onViewCreated(view, savedInstanceState);
|
||||
FriendCodeViewModel viewModel = new ViewModelProvider(getActivity()).get(FriendCodeViewModel.class);
|
||||
|
||||
WatchCodeAdapter adapter = new WatchCodeAdapter(viewModel.getEntries());
|
||||
WatchCodeAdapter adapter = new WatchCodeAdapter(getContext(), viewModel.getEntries());
|
||||
viewModel.getEntries().addOnListChangedCallback(new ObservableList.OnListChangedCallback<ObservableList<FriendCode>>() {
|
||||
@Override
|
||||
public void onChanged(ObservableList<FriendCode> sender) {
|
||||
|
|
|
@ -36,7 +36,7 @@ public class RoomFragment extends Fragment {
|
|||
super.onViewCreated(view, savedInstanceState);
|
||||
FloatingActionButton refreshButton = view.findViewById(R.id.refresh_button);
|
||||
TextView headerTextView = view.findViewById(R.id.room_header_text);
|
||||
if (players == null) {
|
||||
if (header == null) {
|
||||
header = "This player is not online, not inside a room or does not exist. Click the refresh button to try again, or click on the back button to enter a different friend code.";
|
||||
}
|
||||
headerTextView.setText(header);
|
||||
|
|
Reference in a new issue