From d876fae0b4a968f66777be7342ed9af7f6676ebc Mon Sep 17 00:00:00 2001 From: Bryson Steck Date: Sun, 23 May 2021 18:03:25 -0600 Subject: added german --- .../brysonsteck/wiimmfiwatcher/AboutFragment.java | 4 ++-- .../wiimmfiwatcher/WatchCodeFragment.java | 6 ++---- .../wiimmfiwatcher/wiimmfi/RoomFragment.java | 23 ++++++++++------------ .../wiimmfiwatcher/wiimmfi/WiimmfiActivity.java | 3 +-- 4 files changed, 15 insertions(+), 21 deletions(-) (limited to 'app/src/main/java/me/brysonsteck/wiimmfiwatcher') diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/AboutFragment.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/AboutFragment.java index 4624864..d327ca9 100644 --- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/AboutFragment.java +++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/AboutFragment.java @@ -50,7 +50,7 @@ public class AboutFragment extends Fragment { aboutButton = getActivity().findViewById(R.id.about_button); toolbar = getActivity().findViewById(R.id.toolbar); - toolbar.setTitle("About Wiimmfi Watcher"); + toolbar.setTitle(R.string.about_fragment_title); TextView aboutWatcher = view.findViewById(R.id.about_watcher_text); TextView aboutMe = view.findViewById(R.id.about_me_text); @@ -94,7 +94,7 @@ public class AboutFragment extends Fragment { public void onResume() { super.onResume(); aboutButton.setVisibility(View.INVISIBLE); - toolbar.setTitle("About Wiimmfi Watcher"); + toolbar.setTitle(R.string.about_fragment_title); } } diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeFragment.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeFragment.java index 94006a0..93165df 100644 --- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeFragment.java +++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeFragment.java @@ -114,7 +114,7 @@ public class WatchCodeFragment extends Fragment { watchButton, viewModel ); - watchButton.setText("Watch"); + watchButton.setText(R.string.watch); }); friendCode.setOnKeyListener(new View.OnKeyListener() { @@ -133,7 +133,6 @@ public class WatchCodeFragment extends Fragment { watchButton, viewModel ); - watchButton.setText("Watch"); return true; default: break; @@ -147,10 +146,9 @@ public class WatchCodeFragment extends Fragment { public void startWiimmfiActivity(View view, EditText friendCode, MaterialTextView errorText, Button watchButton, FriendCodeViewModel viewModel) { Intent intent = new Intent(view.getContext(), WiimmfiActivity.class); if (!isValidFriendCode(friendCode.getText().toString())) { - errorText.setText("ERROR: Insert a friend code in the format XXXX-XXXX-XXXX"); + errorText.setText(R.string.error_fc_syntax); } else { errorText.setText(""); - watchButton.setText("Loading..."); viewModel.saveFriendCode("", friendCode.getText().toString()); intent.putExtra("friendCode", friendCode.getText().toString()); startActivity(intent); 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 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() -- cgit v1.2.3