Replace hardcoded Strings in the CreateSudokuActivity and the CreateSudokuSpecialButtonLayout with string attributes.

This commit is contained in:
uykek 2020-06-30 11:24:04 +02:00
parent e420b1b558
commit bf4f839cae
4 changed files with 18 additions and 6 deletions

View file

@ -113,7 +113,7 @@ public class CreateSudokuActivity extends BaseActivity implements IFinalizeDialo
} }
public void onFinalizeDialogPositiveClick() { public void onFinalizeDialogPositiveClick() {
Toast.makeText(CreateSudokuActivity.this, "Verifying...", Toast.LENGTH_SHORT).show(); Toast.makeText(CreateSudokuActivity.this, R.string.verify_custom_sudoku_process_toast, Toast.LENGTH_SHORT).show();
GameType gameType = gameController.getGameType(); GameType gameType = gameController.getGameType();
int boardSize = gameType.getSize() * gameType.getSize(); int boardSize = gameType.getSize() * gameType.getSize();
QQWing verifier = new QQWing(gameType, GameDifficulty.Unspecified); QQWing verifier = new QQWing(gameType, GameDifficulty.Unspecified);
@ -127,9 +127,9 @@ public class CreateSudokuActivity extends BaseActivity implements IFinalizeDialo
boolean solvable = verifier.solve(); boolean solvable = verifier.solve();
if(solvable) { if(solvable) {
Toast.makeText(CreateSudokuActivity.this, "Done verifying!", Toast.LENGTH_SHORT).show(); Toast.makeText(CreateSudokuActivity.this, R.string.finished_verifying_custom_sudoku_toast, Toast.LENGTH_SHORT).show();
} else { } else {
Toast.makeText(CreateSudokuActivity.this, "Your sudoku cannot be solved!", Toast.LENGTH_LONG).show(); Toast.makeText(CreateSudokuActivity.this, R.string.failed_to_verify_custom_sudoku_toast, Toast.LENGTH_LONG).show();
} }
} }

View file

@ -211,8 +211,8 @@ public class CreateSudokuSpecialButtonLayout extends LinearLayout implements IHi
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the Builder class for convenient dialog construction // Use the Builder class for convenient dialog construction
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.AppTheme_Dialog); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.AppTheme_Dialog);
builder.setMessage("Do you wish to finalize this sudoku?") builder.setMessage(R.string.finalize_custom_sudoku_dialog)
.setPositiveButton(R.string.hint_confirmation_confirm, new DialogInterface.OnClickListener() { .setPositiveButton(R.string.okay, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) { public void onClick(DialogInterface dialog, int id) {
for(IFinalizeDialogFragmentListener l : listeners) { for(IFinalizeDialogFragmentListener l : listeners) {
l.onFinalizeDialogPositiveClick(); l.onFinalizeDialogPositiveClick();

View file

@ -107,6 +107,12 @@
<!-- ### DailySudokuActivity ###--> <!-- ### DailySudokuActivity ###-->
<string name="finished_daily_sudoku">Du hast das Sudoku des Tages bereits gelöst.</string> <string name="finished_daily_sudoku">Du hast das Sudoku des Tages bereits gelöst.</string>
<string name="daily_number_of_hints">Benutze Hinweise</string> <string name="daily_number_of_hints">Benutzte Hinweise</string>
<!-- ### Create custome sudoku ###-->
<string name="finalize_custom_sudoku_dialog">Möchtest du dieses Sudoku fertigstellen?</string>
<string name="verify_custom_sudoku_process_toast">Verifiziere Level&#8230;</string>
<string name="finished_verifying_custom_sudoku_toast">Verifizierung abgeschlossen!</string>
<string name="failed_to_verify_custom_sudoku_toast">Verifizierung fehlgeschlagen: Dein Sudoku kann nicht gelöst werden.</string>
</resources> </resources>

View file

@ -166,4 +166,10 @@
<string name="daily_number_of_hints">Used hints</string> <string name="daily_number_of_hints">Used hints</string>
<string name="number_of_completed_games">Completed games</string> <string name="number_of_completed_games">Completed games</string>
<!-- ### Create custome sudoku ###-->
<string name="finalize_custom_sudoku_dialog">Do you wish to finalize this sudoku?</string>
<string name="verify_custom_sudoku_process_toast">Verifying&#8230;</string>
<string name="finished_verifying_custom_sudoku_toast">Done verifying!</string>
<string name="failed_to_verify_custom_sudoku_toast">Verification failed: Your sudoku cannot be solved.</string>
</resources> </resources>