aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorBryson Steck <steck.bryson@gmail.com>2021-05-30 16:58:39 -0600
committerBryson Steck <steck.bryson@gmail.com>2021-05-30 16:58:39 -0600
commite771101c6c390d13d8657a449ddf164db3c1aa30 (patch)
tree44d77d0da2fbeb66099132e7caa3d3fd4a32c34b /app/src/main/java
parent1ed362fdcac42fd2c18d1b580c8e20196564ba47 (diff)
downloadwiimmfi-watcher-e771101c6c390d13d8657a449ddf164db3c1aa30.tar
wiimmfi-watcher-e771101c6c390d13d8657a449ddf164db3c1aa30.tar.gz
wiimmfi-watcher-e771101c6c390d13d8657a449ddf164db3c1aa30.tar.bz2
recent friend codes now clears errortext if any
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeAdapter.java6
-rw-r--r--app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeFragment.java4
2 files changed, 7 insertions, 3 deletions
diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeAdapter.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeAdapter.java
index ded5e65..53828f9 100644
--- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeAdapter.java
+++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeAdapter.java
@@ -13,6 +13,7 @@ import androidx.databinding.ObservableArrayList;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.button.MaterialButton;
+import com.google.android.material.textview.MaterialTextView;
import java.util.ArrayList;
@@ -22,11 +23,13 @@ import me.brysonsteck.wiimmfiwatcher.wiimmfi.WiimmfiActivity;
public class WatchCodeAdapter extends RecyclerView.Adapter<WatchCodeAdapter.ViewHolder>{
ObservableArrayList<FriendCode> entries;
Context context;
+ MaterialTextView errorText;
ArrayList<String> recentCodes;
- public WatchCodeAdapter(Context context, ObservableArrayList<FriendCode> entries) {
+ public WatchCodeAdapter(Context context, ObservableArrayList<FriendCode> entries, MaterialTextView errorText) {
this.context = context;
this.entries = entries;
+ this.errorText = errorText;
this.recentCodes = new ArrayList<>();
}
@@ -50,6 +53,7 @@ public class WatchCodeAdapter extends RecyclerView.Adapter<WatchCodeAdapter.View
}
fcButton.setText(currentFC);
fcButton.setOnClickListener(view -> {
+ errorText.setText("");
Intent intent = new Intent(view.getContext(), WiimmfiActivity.class);
intent.putExtra("friendCode", currentFC);
context.startActivity(intent);
diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeFragment.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeFragment.java
index a14e6f7..e263bb6 100644
--- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeFragment.java
+++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeFragment.java
@@ -61,7 +61,8 @@ public class WatchCodeFragment extends Fragment {
super.onViewCreated(view, savedInstanceState);
FriendCodeViewModel viewModel = new ViewModelProvider(getActivity()).get(FriendCodeViewModel.class);
- WatchCodeAdapter adapter = new WatchCodeAdapter(getContext(), viewModel.getEntries());
+ MaterialTextView errorText = view.findViewById(R.id.error_text);
+ WatchCodeAdapter adapter = new WatchCodeAdapter(getContext(), viewModel.getEntries(), errorText);
viewModel.getEntries().addOnListChangedCallback(new ObservableList.OnListChangedCallback<ObservableList<FriendCode>>() {
@Override
public void onChanged(ObservableList<FriendCode> sender) {
@@ -106,7 +107,6 @@ public class WatchCodeFragment extends Fragment {
recyclerView.setAdapter(adapter);
EditText friendCode = view.findViewById(R.id.friend_code_edit_text);
- MaterialTextView errorText = view.findViewById(R.id.error_text);
Button watchButton = view.findViewById(R.id.watch_button);
watchButton.setOnClickListener(buttonClick -> {
startWiimmfiActivity(