aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/com')
-rw-r--r--app/src/main/java/com/example/wiimmterfaceandroid/WatchCodeAdapter.java9
-rw-r--r--app/src/main/java/com/example/wiimmterfaceandroid/WatchCodeFragment.java2
-rw-r--r--app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/RoomFragment.java2
3 files changed, 7 insertions, 6 deletions
diff --git a/app/src/main/java/com/example/wiimmterfaceandroid/WatchCodeAdapter.java b/app/src/main/java/com/example/wiimmterfaceandroid/WatchCodeAdapter.java
index aacd9ef..6e7e69e 100644
--- a/app/src/main/java/com/example/wiimmterfaceandroid/WatchCodeAdapter.java
+++ b/app/src/main/java/com/example/wiimmterfaceandroid/WatchCodeAdapter.java
@@ -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);
});
}
diff --git a/app/src/main/java/com/example/wiimmterfaceandroid/WatchCodeFragment.java b/app/src/main/java/com/example/wiimmterfaceandroid/WatchCodeFragment.java
index 67dfdcd..6de02dc 100644
--- a/app/src/main/java/com/example/wiimmterfaceandroid/WatchCodeFragment.java
+++ b/app/src/main/java/com/example/wiimmterfaceandroid/WatchCodeFragment.java
@@ -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) {
diff --git a/app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/RoomFragment.java b/app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/RoomFragment.java
index e72e38a..463c635 100644
--- a/app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/RoomFragment.java
+++ b/app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/RoomFragment.java
@@ -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);