aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi')
-rw-r--r--app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomFragment.java23
-rw-r--r--app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/WiimmfiActivity.java3
2 files changed, 11 insertions, 15 deletions
diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomFragment.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomFragment.java
index ec2531a..4f5b1bc 100644
--- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomFragment.java
+++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomFragment.java
@@ -44,16 +44,15 @@ public class RoomFragment extends Fragment {
FloatingActionButton refreshButton = view.findViewById(R.id.refresh_button);
TextView headerTextView = view.findViewById(R.id.room_header_text);
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(R.string.header_null_error);
}
if (roomData.error != null) {
- header = "Whoops! Wiimmfi Watcher was unable to connect to the Wiimmfi servers. This could be that you are not connected to the internet, but it could be something else. Here was the error:\n\n" +
- roomData.error.getMessage() + "\n\n" +
- "If the error is along the lines of \"Unable to resolve host\" or \"Timeout\", you are probably having internet issues. Make sure you are connected to the internet then click the refresh button or press back to watch a new friend code.\n\n" +
- "If the error is something other than that or if the error persists, make sure that Wiimmfi's website is currently running. Otherwise, please screenshot this screen and submit a bug report by clicking the About icon on the main page.";
+ headerTextView.setText(getResources().getString(R.string.jsoup_error, roomData.error));
}
- headerTextView.setText(header);
+ if (roomData.error == null && header != null) {
+ headerTextView.setText(header);
+ }
RecyclerView recyclerView = view.findViewById(R.id.player_data_recycler_view);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.setAdapter(new RoomAdapter(display, playerLink, header, players, getContext()));
@@ -66,18 +65,16 @@ public class RoomFragment extends Fragment {
this.players = roomData.getPlayers();
header = newRoomData.getRoomHeader();
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(R.string.header_null_error);
}
if (newRoomData.error instanceof java.net.SocketTimeoutException || newRoomData.error instanceof java.net.UnknownHostException) {
- header = "Whoops! Wiimmfi Watcher was unable to connect to the Wiimmfi servers. This could be that you are not connected to the internet, but it could be something else. Here was the error:\n\n" +
- roomData.error.getMessage() + "\n\n" +
- "If the error is along the lines of \"Unable to resolve host\" or \"Timeout\", you are probably having internet issues. Make sure you are connected to the internet then click the refresh button or press back to watch a new friend code.\n\n" +
- "If the error is something other than that or if the error persists, make sure that Wiimmfi's website is currently running. Otherwise, please screenshot this screen and submit a bug report by clicking the About icon on the main page.";
+ headerTextView.setText(R.string.jsoup_error);
+ }
+ if (roomData.error == null && header != null) {
+ headerTextView.setText(header);
}
-
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.setAdapter(new RoomAdapter(display, playerLink, header, players, getContext()));
- headerTextView.setText(header);
});
}
diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/WiimmfiActivity.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/WiimmfiActivity.java
index 1a9576a..bb20969 100644
--- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/WiimmfiActivity.java
+++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/WiimmfiActivity.java
@@ -22,7 +22,6 @@ public class WiimmfiActivity extends AppCompatActivity {
ArrayList<Player> players = new ArrayList<>();
final String[] playerLink = new String[1];
String friendCode;
- String roomHeader;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -47,7 +46,7 @@ public class WiimmfiActivity extends AppCompatActivity {
drawer.setBackgroundColor(Color.parseColor("#313131"));
}
- toolbar.setTitle("Watching " + friendCode);
+ toolbar.setTitle(getResources().getString(R.string.watching, friendCode));
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()