Fixed a lot of stuff.. and added ... stuff....... yay.
This commit is contained in:
parent
29028c39f5
commit
92c035f860
21 changed files with 408 additions and 176 deletions
|
@ -166,6 +166,9 @@ public class GameController implements IModelChangedListener {
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
public void hint(){
|
public void hint(){
|
||||||
|
if(!isValidCellSelected()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int[] solved = solve();
|
int[] solved = solve();
|
||||||
// TODO test every placed value so far
|
// TODO test every placed value so far
|
||||||
|
@ -302,6 +305,7 @@ public class GameController implements IModelChangedListener {
|
||||||
public void resetLevel() {
|
public void resetLevel() {
|
||||||
gameBoard.reset();
|
gameBoard.reset();
|
||||||
//notifyListeners();
|
//notifyListeners();
|
||||||
|
notifyHighlightChangedListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean deleteValue(int row, int col) {
|
public boolean deleteValue(int row, int col) {
|
||||||
|
@ -620,6 +624,8 @@ public class GameController implements IModelChangedListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
notifyHighlightChangedListeners();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,6 @@ public class NewLevelManager {
|
||||||
return resultPuzzle;
|
return resultPuzzle;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: make the UI wait. Or just generate a level now.
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,6 +146,67 @@ public class NewLevelManager {
|
||||||
new AsyncGenerationTask().execute();
|
new AsyncGenerationTask().execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void loadFirstStartLevels() {
|
||||||
|
// Default_9x9
|
||||||
|
// Default_12x12
|
||||||
|
// Default_6x6
|
||||||
|
|
||||||
|
// Easy
|
||||||
|
// Moderate
|
||||||
|
// Hard
|
||||||
|
|
||||||
|
// 0
|
||||||
|
// 1
|
||||||
|
|
||||||
|
saveToFile(GameType.Default_9x9, GameDifficulty.Easy, 0, "000208090027000000000400000090100706408090201000030080200001000100300469000000007");
|
||||||
|
saveToFile(GameType.Default_9x9, GameDifficulty.Easy, 1, "000000052000003007500206830002040700070000046640508003000400000000005000050301008");
|
||||||
|
saveToFile(GameType.Default_9x9, GameDifficulty.Moderate, 0, "000800400008004093009003060000700000000400000060002900091000670200000100403006802");
|
||||||
|
saveToFile(GameType.Default_9x9, GameDifficulty.Moderate, 1, "000006040000050000600040080043000200500810000100300605209080460004500000001030000");
|
||||||
|
saveToFile(GameType.Default_9x9, GameDifficulty.Hard, 0, "086000000000000070090000304968027030000100060200900000072006100000000296000000740");
|
||||||
|
saveToFile(GameType.Default_9x9, GameDifficulty.Hard, 1, "450900001001400000600010004006700000500000000100024060002000030000062400040005700");
|
||||||
|
|
||||||
|
saveToFile(GameType.Default_12x12, GameDifficulty.Easy, 0, "B30050A100701600070030800002894000007008000000B550100004020300B0000090000060000A010000000032050C0407008006A000000000400001000C290000000008005000");
|
||||||
|
saveToFile(GameType.Default_12x12, GameDifficulty.Easy, 1, "00B4008A09C002A030C00008007850003000030C000408AB000B00052000000000000070069500030C00B00010467000008000000A100000000800000C0020700001700000095400");
|
||||||
|
saveToFile(GameType.Default_12x12, GameDifficulty.Moderate, 0, "00600500000004000000002050004C00800A28049000050000A900C000000000B00000A00B0560000C900C708A00000B0002000000769000008000B002B0C6000017C00107400908");
|
||||||
|
saveToFile(GameType.Default_12x12, GameDifficulty.Moderate, 1, "020000B000A608070530000B9050200A03800030980010B001000B6C30900000032000CAB0000000000000067000B000000500000A000C09000081302B0100070950836000100000");
|
||||||
|
saveToFile(GameType.Default_12x12, GameDifficulty.Hard, 0, "2000000000000B070C00000000AC100000000020050CA00BB60002097800079001000C60400000B0070A0000A7000298005048000010004000070009A10600C00B000C00B0000020");
|
||||||
|
saveToFile(GameType.Default_12x12, GameDifficulty.Hard, 1, "01000002000C00640A800070000A0000082020000008100B0C081090000050A0060C079009BC000A04010500097000000000000000000000904000866070B100020000000C00B009");
|
||||||
|
|
||||||
|
saveToFile(GameType.Default_6x6, GameDifficulty.Easy, 0, "000000050004013000004003006050040010");
|
||||||
|
saveToFile(GameType.Default_6x6, GameDifficulty.Easy, 1, "000450000600104306630000060005010000");
|
||||||
|
saveToFile(GameType.Default_6x6, GameDifficulty.Moderate, 0, "630010002000001000040020400006003040");
|
||||||
|
saveToFile(GameType.Default_6x6, GameDifficulty.Moderate, 1, "000000060130006000050603030005000041");
|
||||||
|
saveToFile(GameType.Default_6x6, GameDifficulty.Hard, 0, "004200200000003002600050300400046000");
|
||||||
|
saveToFile(GameType.Default_6x6, GameDifficulty.Hard, 1, "003050200003502000000000640002000045");
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Don't use this if you don't know what you are doing! **/
|
||||||
|
private void saveToFile(GameType gameType, GameDifficulty gameDifficulty, int saveNumber, String puzzle) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append(LEVEL_PREFIX);
|
||||||
|
sb.append(gameType.name());
|
||||||
|
sb.append("_");
|
||||||
|
sb.append(gameDifficulty.name());
|
||||||
|
sb.append("_");
|
||||||
|
sb.append(saveNumber);
|
||||||
|
sb.append(FILE_EXTENSION);
|
||||||
|
// create the file
|
||||||
|
File file = new File(DIR, sb.toString());
|
||||||
|
|
||||||
|
// save the file
|
||||||
|
try {
|
||||||
|
FileOutputStream stream = new FileOutputStream(file);
|
||||||
|
|
||||||
|
try {
|
||||||
|
stream.write(puzzle.getBytes());
|
||||||
|
} finally {
|
||||||
|
stream.close();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
Log.e("File Manager", "Could not save game. IOException occured.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class AsyncGenerationTask extends AsyncTask<int[][], Integer, String> {
|
private class AsyncGenerationTask extends AsyncTask<int[][], Integer, String> {
|
||||||
@Override
|
@Override
|
||||||
protected void onPreExecute() {
|
protected void onPreExecute() {
|
||||||
|
@ -235,6 +295,7 @@ public class NewLevelManager {
|
||||||
String filename = sb.toString();
|
String filename = sb.toString();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// create the file
|
// create the file
|
||||||
File file = new File(DIR, filename);
|
File file = new File(DIR, filename);
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,9 @@ public class GameBoard implements Cloneable {
|
||||||
|
|
||||||
public void initCells(int[] level) {
|
public void initCells(int[] level) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
if(level == null) {
|
||||||
|
throw new IllegalArgumentException("Level array is null.");
|
||||||
|
}
|
||||||
if(level.length != size*size) {
|
if(level.length != size*size) {
|
||||||
throw new IllegalArgumentException("Levelarray must have length of "+size*size+".");
|
throw new IllegalArgumentException("Levelarray must have length of "+size*size+".");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
package tu_darmstadt.sudoku.ui;
|
package tu_darmstadt.sudoku.ui;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.app.DialogFragment;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Point;
|
import android.graphics.Point;
|
||||||
|
@ -17,6 +23,7 @@ import android.widget.RatingBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import tu_darmstadt.sudoku.controller.GameStateManager;
|
import tu_darmstadt.sudoku.controller.GameStateManager;
|
||||||
|
@ -28,13 +35,15 @@ import tu_darmstadt.sudoku.game.GameDifficulty;
|
||||||
import tu_darmstadt.sudoku.game.GameType;
|
import tu_darmstadt.sudoku.game.GameType;
|
||||||
import tu_darmstadt.sudoku.game.listener.IGameSolvedListener;
|
import tu_darmstadt.sudoku.game.listener.IGameSolvedListener;
|
||||||
import tu_darmstadt.sudoku.game.listener.ITimerListener;
|
import tu_darmstadt.sudoku.game.listener.ITimerListener;
|
||||||
|
import tu_darmstadt.sudoku.ui.listener.IHintDialogFragmentListener;
|
||||||
|
import tu_darmstadt.sudoku.ui.listener.IResetDialogFragmentListener;
|
||||||
import tu_darmstadt.sudoku.ui.view.DialogWinScreen;
|
import tu_darmstadt.sudoku.ui.view.DialogWinScreen;
|
||||||
import tu_darmstadt.sudoku.ui.view.R;
|
import tu_darmstadt.sudoku.ui.view.R;
|
||||||
import tu_darmstadt.sudoku.ui.view.SudokuFieldLayout;
|
import tu_darmstadt.sudoku.ui.view.SudokuFieldLayout;
|
||||||
import tu_darmstadt.sudoku.ui.view.SudokuKeyboardLayout;
|
import tu_darmstadt.sudoku.ui.view.SudokuKeyboardLayout;
|
||||||
import tu_darmstadt.sudoku.ui.view.SudokuSpecialButtonLayout;
|
import tu_darmstadt.sudoku.ui.view.SudokuSpecialButtonLayout;
|
||||||
|
|
||||||
public class GameActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener, IGameSolvedListener ,ITimerListener {
|
public class GameActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener, IGameSolvedListener ,ITimerListener, IHintDialogFragmentListener, IResetDialogFragmentListener {
|
||||||
|
|
||||||
GameController gameController;
|
GameController gameController;
|
||||||
SudokuFieldLayout layout;
|
SudokuFieldLayout layout;
|
||||||
|
@ -61,7 +70,7 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
||||||
gameType = (GameType)extras.get("gameType");
|
gameType = (GameType)extras.get("gameType");
|
||||||
}
|
}
|
||||||
gameDifficulty = (GameDifficulty)(extras.get("gameDifficulty"));
|
gameDifficulty = (GameDifficulty)(extras.get("gameDifficulty"));
|
||||||
loadLevel = extras.getBoolean("loadLevel");
|
loadLevel = extras.getBoolean("loadLevel", false);
|
||||||
if(loadLevel) {
|
if(loadLevel) {
|
||||||
loadLevelID = extras.getInt("loadLevelID");
|
loadLevelID = extras.getInt("loadLevelID");
|
||||||
}
|
}
|
||||||
|
@ -107,7 +116,7 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
||||||
|
|
||||||
//set Special keys
|
//set Special keys
|
||||||
specialButtonLayout = (SudokuSpecialButtonLayout) findViewById(R.id.sudokuSpecialLayout);
|
specialButtonLayout = (SudokuSpecialButtonLayout) findViewById(R.id.sudokuSpecialLayout);
|
||||||
specialButtonLayout.setButtons(p.x, gameController, keyboard);
|
specialButtonLayout.setButtons(p.x, gameController, keyboard, getFragmentManager());
|
||||||
|
|
||||||
//set TimerView
|
//set TimerView
|
||||||
timerView = (TextView)findViewById(R.id.timerView);
|
timerView = (TextView)findViewById(R.id.timerView);
|
||||||
|
@ -190,6 +199,11 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
||||||
Intent intent;
|
Intent intent;
|
||||||
|
|
||||||
switch(id) {
|
switch(id) {
|
||||||
|
case R.id.menu_reset:
|
||||||
|
ResetConfirmationDialog hintDialog = new ResetConfirmationDialog();
|
||||||
|
hintDialog.show(getFragmentManager(), "ResetDialogFragment");
|
||||||
|
break;
|
||||||
|
|
||||||
case R.id.nav_newgame:
|
case R.id.nav_newgame:
|
||||||
//create new game
|
//create new game
|
||||||
intent = new Intent(this, MainActivity.class);
|
intent = new Intent(this, MainActivity.class);
|
||||||
|
@ -197,13 +211,6 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.nav_continue:
|
|
||||||
//create new game
|
|
||||||
intent = new Intent(this, LoadGameActivity.class);
|
|
||||||
finish();
|
|
||||||
startActivity(intent);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case R.id.menu_settings:
|
case R.id.menu_settings:
|
||||||
//open settings
|
//open settings
|
||||||
intent = new Intent(this,SettingsActivity.class);
|
intent = new Intent(this,SettingsActivity.class);
|
||||||
|
@ -275,4 +282,53 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
||||||
// save time
|
// save time
|
||||||
gameController.saveGame(this);
|
gameController.saveGame(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onHintDialogPositiveClick() {
|
||||||
|
gameController.hint();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResetDialogPositiveClick() {
|
||||||
|
gameController.resetLevel();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDialogNegativeClick() {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
@SuppressLint("ValidFragment")
|
||||||
|
public class ResetConfirmationDialog extends DialogFragment {
|
||||||
|
|
||||||
|
LinkedList<IResetDialogFragmentListener> listeners = new LinkedList<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(Activity activity) {
|
||||||
|
super.onAttach(activity);
|
||||||
|
// Verify that the host activity implements the callback interface
|
||||||
|
if(activity instanceof IHintDialogFragmentListener) {
|
||||||
|
listeners.add((IResetDialogFragmentListener) activity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
|
// Use the Builder class for convenient dialog construction
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
|
builder.setMessage(R.string.reset_confirmation)
|
||||||
|
.setPositiveButton(R.string.reset_confirmation_confirm, new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
for(IResetDialogFragmentListener l : listeners) {
|
||||||
|
l.onResetDialogPositiveClick();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
// User cancelled the dialog
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return builder.create();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,7 @@ public class LoadGameActivity extends AppCompatActivity implements IDeleteDialog
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton(R.string.loadgame_delete_cancel, new DialogInterface.OnClickListener() {
|
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
// User cancelled the dialog
|
// User cancelled the dialog
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.design.widget.NavigationView;
|
import android.support.design.widget.NavigationView;
|
||||||
|
import android.support.v4.content.SharedPreferencesCompat;
|
||||||
import android.support.v4.view.GravityCompat;
|
import android.support.v4.view.GravityCompat;
|
||||||
import android.support.v4.widget.DrawerLayout;
|
import android.support.v4.widget.DrawerLayout;
|
||||||
import android.support.v7.app.ActionBarDrawerToggle;
|
import android.support.v7.app.ActionBarDrawerToggle;
|
||||||
|
@ -54,9 +55,21 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||||
|
|
||||||
settings = PreferenceManager.getDefaultSharedPreferences(this);
|
settings = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
|
||||||
// check if we need to pre generate levels.
|
|
||||||
NewLevelManager.init(getApplicationContext(), settings);
|
NewLevelManager.init(getApplicationContext(), settings);
|
||||||
NewLevelManager newLevelManager = NewLevelManager.getInstance();
|
NewLevelManager newLevelManager = NewLevelManager.getInstance();
|
||||||
|
|
||||||
|
// Is this the very first time we start this app?
|
||||||
|
boolean firstStart = settings.getBoolean("firstStart", true);
|
||||||
|
if(firstStart) {
|
||||||
|
// preload some levels so we don't have to generate as many and we can start playing right away.
|
||||||
|
newLevelManager.loadFirstStartLevels();
|
||||||
|
|
||||||
|
SharedPreferences.Editor editor = settings.edit();
|
||||||
|
editor.putBoolean("firstStart", false);
|
||||||
|
editor.commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if we need to pre generate levels.
|
||||||
newLevelManager.checkAndRestock();
|
newLevelManager.checkAndRestock();
|
||||||
|
|
||||||
setContentView(R.layout.activity_main_menu);
|
setContentView(R.layout.activity_main_menu);
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package tu_darmstadt.sudoku.ui;
|
package tu_darmstadt.sudoku.ui;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.support.design.widget.TabLayout;
|
import android.support.design.widget.TabLayout;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
|
@ -51,6 +53,12 @@ public class StatsActivity extends AppCompatActivity {
|
||||||
|
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
|
android.support.v7.app.ActionBar actionBar = getSupportActionBar();
|
||||||
|
actionBar.setTitle(R.string.menu_highscore);
|
||||||
|
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||||
|
actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#024265")));
|
||||||
|
|
||||||
// Create the adapter that will return a fragment for each of the three
|
// Create the adapter that will return a fragment for each of the three
|
||||||
// primary sections of the activity.
|
// primary sections of the activity.
|
||||||
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
|
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
|
||||||
|
@ -79,19 +87,23 @@ public class StatsActivity extends AppCompatActivity {
|
||||||
// Handle action bar item clicks here. The action bar will
|
// Handle action bar item clicks here. The action bar will
|
||||||
// automatically handle clicks on the Home/Up button, so long
|
// automatically handle clicks on the Home/Up button, so long
|
||||||
// as you specify a parent activity in AndroidManifest.xml.
|
// as you specify a parent activity in AndroidManifest.xml.
|
||||||
int id = item.getItemId();
|
|
||||||
|
|
||||||
//noinspection SimplifiableIfStatement
|
//noinspection SimplifiableIfStatement
|
||||||
if (id == R.id.action_reset) {
|
switch(item.getItemId()) {
|
||||||
SaveLoadStatistics.resetStats(this);
|
case R.id.action_reset:
|
||||||
mSectionsPagerAdapter.refresh(this);
|
SaveLoadStatistics.resetStats(this);
|
||||||
return true;
|
mSectionsPagerAdapter.refresh(this);
|
||||||
|
return true;
|
||||||
|
case R.id.home:
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link FragmentPagerAdapter} that returns a fragment corresponding to
|
* A {@link FragmentPagerAdapter} that returns a fragment corresponding to
|
||||||
* one of the sections/tabs/pages.
|
* one of the sections/tabs/pages.
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
package tu_darmstadt.sudoku.ui.listener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Chris on 17.01.2016.
|
||||||
|
*/
|
||||||
|
public interface IHintDialogFragmentListener {
|
||||||
|
public void onHintDialogPositiveClick();
|
||||||
|
public void onDialogNegativeClick();
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package tu_darmstadt.sudoku.ui.listener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Chris on 19.01.2016.
|
||||||
|
*/
|
||||||
|
public interface IResetDialogFragmentListener {
|
||||||
|
public void onResetDialogPositiveClick();
|
||||||
|
public void onDialogNegativeClick();
|
||||||
|
}
|
|
@ -1,15 +1,25 @@
|
||||||
package tu_darmstadt.sudoku.ui.view;
|
package tu_darmstadt.sudoku.ui.view;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.app.DialogFragment;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
|
import android.os.Bundle;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.GridLayout;
|
import android.widget.GridLayout;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
|
||||||
import tu_darmstadt.sudoku.controller.GameController;
|
import tu_darmstadt.sudoku.controller.GameController;
|
||||||
import tu_darmstadt.sudoku.controller.Symbol;
|
import tu_darmstadt.sudoku.controller.Symbol;
|
||||||
import tu_darmstadt.sudoku.game.listener.IHighlightChangedListener;
|
import tu_darmstadt.sudoku.game.listener.IHighlightChangedListener;
|
||||||
|
import tu_darmstadt.sudoku.ui.listener.IDeleteDialogFragmentListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by TMZ_LToP on 12.11.2015.
|
* Created by TMZ_LToP on 12.11.2015.
|
||||||
|
|
|
@ -1,29 +1,42 @@
|
||||||
package tu_darmstadt.sudoku.ui.view;
|
package tu_darmstadt.sudoku.ui.view;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.app.DialogFragment;
|
||||||
|
import android.app.FragmentManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
|
import android.os.Bundle;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
|
||||||
import tu_darmstadt.sudoku.controller.GameController;
|
import tu_darmstadt.sudoku.controller.GameController;
|
||||||
|
import tu_darmstadt.sudoku.ui.listener.IHintDialogFragmentListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by TMZ_LToP on 17.11.2015.
|
* Created by TMZ_LToP on 17.11.2015.
|
||||||
*/
|
*/
|
||||||
public class SudokuSpecialButtonLayout extends LinearLayout {
|
public class SudokuSpecialButtonLayout extends LinearLayout {
|
||||||
|
|
||||||
|
|
||||||
SudokuSpecialButton[] fixedButtons;
|
SudokuSpecialButton[] fixedButtons;
|
||||||
public int fixedButtonsCount = SudokuButtonType.getSpecialButtons().size();
|
public int fixedButtonsCount = SudokuButtonType.getSpecialButtons().size();
|
||||||
GameController gameController;
|
GameController gameController;
|
||||||
SudokuKeyboardLayout keyboard;
|
SudokuKeyboardLayout keyboard;
|
||||||
Bitmap bitMap,bitResult;
|
Bitmap bitMap,bitResult;
|
||||||
Canvas canvas;
|
Canvas canvas;
|
||||||
|
FragmentManager fragmentManager;
|
||||||
|
|
||||||
OnClickListener listener = new OnClickListener() {
|
OnClickListener listener = new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -64,9 +77,18 @@ public class SudokuSpecialButtonLayout extends LinearLayout {
|
||||||
break;
|
break;
|
||||||
case Hint:
|
case Hint:
|
||||||
if(gameController.isValidCellSelected()) {
|
if(gameController.isValidCellSelected()) {
|
||||||
gameController.hint();
|
if(gameController.getUsedHints() == 0) {
|
||||||
|
// are you sure you want to use a hint?
|
||||||
|
HintConfirmationDialog hintDialog = new HintConfirmationDialog();
|
||||||
|
hintDialog.show(fragmentManager, "HintDialogFragment");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
gameController.hint();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO: Display a Toast that explains how to use the Hint function.
|
// Display a Toast that explains how to use the Hint function.
|
||||||
|
Toast t = Toast.makeText(getContext(), R.string.hint_usage, Toast.LENGTH_SHORT);
|
||||||
|
t.show();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -88,7 +110,8 @@ public class SudokuSpecialButtonLayout extends LinearLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setButtons(int width, GameController gc, SudokuKeyboardLayout key) {
|
public void setButtons(int width, GameController gc, SudokuKeyboardLayout key, FragmentManager fm) {
|
||||||
|
fragmentManager = fm;
|
||||||
keyboard=key;
|
keyboard=key;
|
||||||
gameController = gc;
|
gameController = gc;
|
||||||
fixedButtons = new SudokuSpecialButton[fixedButtonsCount];
|
fixedButtons = new SudokuSpecialButton[fixedButtonsCount];
|
||||||
|
@ -124,4 +147,39 @@ public class SudokuSpecialButtonLayout extends LinearLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("ValidFragment")
|
||||||
|
public class HintConfirmationDialog extends DialogFragment {
|
||||||
|
|
||||||
|
LinkedList<IHintDialogFragmentListener> listeners = new LinkedList<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(Activity activity) {
|
||||||
|
super.onAttach(activity);
|
||||||
|
// Verify that the host activity implements the callback interface
|
||||||
|
if(activity instanceof IHintDialogFragmentListener) {
|
||||||
|
listeners.add((IHintDialogFragmentListener) activity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
|
// Use the Builder class for convenient dialog construction
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
|
builder.setMessage(R.string.hint_confirmation)
|
||||||
|
.setPositiveButton(R.string.hint_confirmation_confirm, new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
for(IHintDialogFragmentListener l : listeners) {
|
||||||
|
l.onHintDialogPositiveClick();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
// User cancelled the dialog
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return builder.create();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,95 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
|
<android.support.design.widget.CoordinatorLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent" android:layout_height="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:fitsSystemWindows="true" tools:openDrawer="start">
|
android:layout_height="match_parent"
|
||||||
|
android:fitsSystemWindows="true"
|
||||||
|
android:id="@+id/game_coordinate_layout"
|
||||||
|
tools:context="tu_darmstadt.sudoku.activity.GameActivity">
|
||||||
|
|
||||||
<include layout="@layout/app_bar_game_view" android:layout_width="match_parent"
|
<android.support.design.widget.AppBarLayout
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:theme="@style/AppTheme.AppBarOverlay">
|
||||||
|
|
||||||
<android.support.design.widget.NavigationView android:id="@+id/nav_view"
|
<android.support.v7.widget.Toolbar android:id="@+id/toolbar"
|
||||||
android:layout_width="200dp" android:layout_height="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_gravity="start|start"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:background="@color/white"
|
android:background="?attr/colorPrimary"
|
||||||
app:menu="@menu/menu_drawer" />
|
app:popupTheme="@style/AppTheme.PopupOverlay" >
|
||||||
<!--app:headerLayout="@layout/nav_header_game_view"-->
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:weightSum="14"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_marginLeft="@dimen/activity_horizontal_margin"
|
||||||
|
android:layout_marginRight="@dimen/activity_horizontal_margin"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/gametype_unspecified"
|
||||||
|
android:id="@+id/gameModeText"
|
||||||
|
android:layout_weight="8"/>
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="4"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/difficulty_easy"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:id="@+id/difficultyText"
|
||||||
|
/>
|
||||||
|
<RatingBar
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:numStars="3"
|
||||||
|
android:clickable="false"
|
||||||
|
android:id="@+id/gameModeStar"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_below="@+id/difficultyText"
|
||||||
|
style="?android:attr/ratingBarStyleSmall"/>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
</android.support.v4.widget.DrawerLayout>
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="00:00"
|
||||||
|
android:layout_weight="2"
|
||||||
|
android:id="@+id/timerView"
|
||||||
|
android:gravity="right"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_centerVertical="true"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</android.support.v7.widget.Toolbar>
|
||||||
|
|
||||||
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
|
||||||
|
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/drawer_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginTop="?attr/actionBarSize"
|
||||||
|
android:fitsSystemWindows="true"
|
||||||
|
tools:openDrawer="start">
|
||||||
|
|
||||||
|
<include layout="@layout/content_game_view" />
|
||||||
|
|
||||||
|
<android.support.design.widget.NavigationView android:id="@+id/nav_view"
|
||||||
|
android:layout_width="200dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="start"
|
||||||
|
android:background="@color/white"
|
||||||
|
app:menu="@menu/menu_drawer" />
|
||||||
|
<!--app:headerLayout="@layout/nav_header_game_view"-->
|
||||||
|
|
||||||
|
</android.support.v4.widget.DrawerLayout>
|
||||||
|
|
||||||
|
</android.support.design.widget.CoordinatorLayout>
|
||||||
|
|
|
@ -1,21 +1,13 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<android.support.v4.widget.DrawerLayout
|
<android.support.design.widget.CoordinatorLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
android:id="@+id/drawer_layout_main"
|
|
||||||
tools:context="tu_darmstadt.sudoku.ui.MainActivity"
|
tools:context="tu_darmstadt.sudoku.ui.MainActivity"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_width="match_parent"
|
|
||||||
>
|
|
||||||
<android.support.design.widget.CoordinatorLayout
|
|
||||||
|
|
||||||
android:id="@+id/main_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_width="match_parent">
|
android:layout_width="match_parent">
|
||||||
|
|
||||||
|
|
||||||
<android.support.design.widget.AppBarLayout
|
<android.support.design.widget.AppBarLayout
|
||||||
android:id="@+id/appbar"
|
android:id="@+id/appbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -34,13 +26,19 @@
|
||||||
|
|
||||||
</android.support.design.widget.AppBarLayout>
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
|
||||||
|
<android.support.v4.widget.DrawerLayout
|
||||||
|
android:id="@+id/drawer_layout_main"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_marginTop="?attr/actionBarSize"
|
||||||
|
android:fitsSystemWindows="true"
|
||||||
|
tools:openDrawer="start">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:weightSum="10"
|
android:weightSum="10"
|
||||||
android:layout_marginTop="?attr/actionBarSize"
|
|
||||||
style="?android:buttonBarStyle">
|
style="?android:buttonBarStyle">
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
@ -106,7 +104,7 @@
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_marginLeft="30dp"
|
android:layout_marginLeft="30dp"
|
||||||
android:layout_marginRight="30dp"
|
android:layout_marginRight="30dp"
|
||||||
android:text="@string/menu_new_game"
|
android:text="@string/new_game"
|
||||||
android:textStyle="normal"
|
android:textStyle="normal"
|
||||||
android:id="@+id/playButton"
|
android:id="@+id/playButton"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
|
@ -136,6 +134,7 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Win Debug"
|
android:text="Win Debug"
|
||||||
|
android:visibility="invisible"
|
||||||
android:onClick="callFragment"/>
|
android:onClick="callFragment"/>
|
||||||
<!--
|
<!--
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -207,12 +206,14 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</android.support.design.widget.CoordinatorLayout>
|
<android.support.design.widget.NavigationView
|
||||||
|
android:id="@+id/nav_view_main"
|
||||||
<android.support.design.widget.NavigationView android:id="@+id/nav_view_main"
|
android:layout_width="200dp"
|
||||||
android:layout_width="200dp" android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="start" android:fitsSystemWindows="true"
|
android:layout_gravity="start"
|
||||||
android:background="@color/white"
|
android:background="@color/white"
|
||||||
app:menu="@menu/menu_drawer_main" />
|
app:menu="@menu/menu_drawer_main"/>
|
||||||
|
|
||||||
</android.support.v4.widget.DrawerLayout>
|
</android.support.v4.widget.DrawerLayout>
|
||||||
|
|
||||||
|
</android.support.design.widget.CoordinatorLayout>
|
|
@ -1,75 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<android.support.design.widget.CoordinatorLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:fitsSystemWindows="true"
|
|
||||||
android:id="@+id/game_coordinate_layout"
|
|
||||||
tools:context="tu_darmstadt.sudoku.activity.GameActivity">
|
|
||||||
|
|
||||||
<android.support.design.widget.AppBarLayout
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:theme="@style/AppTheme.AppBarOverlay">
|
|
||||||
|
|
||||||
<android.support.v7.widget.Toolbar android:id="@+id/toolbar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="?attr/actionBarSize"
|
|
||||||
android:background="?attr/colorPrimary"
|
|
||||||
app:popupTheme="@style/AppTheme.PopupOverlay" >
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:weightSum="14"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_marginLeft="@dimen/activity_horizontal_margin"
|
|
||||||
android:layout_marginRight="@dimen/activity_horizontal_margin"
|
|
||||||
android:gravity="center_vertical">
|
|
||||||
<TextView
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/gametype_unspecified"
|
|
||||||
android:id="@+id/gameModeText"
|
|
||||||
android:layout_weight="8"/>
|
|
||||||
<RelativeLayout
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_weight="4"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/difficulty_easy"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:id="@+id/difficultyText"
|
|
||||||
/>
|
|
||||||
<RatingBar
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:numStars="3"
|
|
||||||
android:clickable="false"
|
|
||||||
android:id="@+id/gameModeStar"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:layout_below="@+id/difficultyText"
|
|
||||||
style="?android:attr/ratingBarStyleSmall"/>
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="00:00"
|
|
||||||
android:layout_weight="2"
|
|
||||||
android:id="@+id/timerView"
|
|
||||||
android:gravity="right"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_centerVertical="true"/>
|
|
||||||
</LinearLayout>
|
|
||||||
</android.support.v7.widget.Toolbar>
|
|
||||||
|
|
||||||
</android.support.design.widget.AppBarLayout>
|
|
||||||
|
|
||||||
<include layout="@layout/content_game_view" />
|
|
||||||
|
|
||||||
|
|
||||||
</android.support.design.widget.CoordinatorLayout>
|
|
|
@ -4,20 +4,9 @@
|
||||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||||
android:weightSum="11"
|
android:weightSum="10"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
tools:context="tu_darmstadt.sudoku.ui.StatsActivity$PlaceholderFragment">
|
tools:context="tu_darmstadt.sudoku.ui.StatsActivity$PlaceholderFragment">
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="1">
|
|
||||||
<TextView
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/stats_name"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:gravity="center"/>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<group android:checkableBehavior="single">
|
<group android:id="@+id/group1">
|
||||||
|
<item android:id="@+id/menu_reset" android:icon="@android:drawable/ic_menu_delete"
|
||||||
|
android:title="@string/menu_reset" />
|
||||||
|
</group>
|
||||||
|
<group android:id="@+id/group2">
|
||||||
<item android:id="@+id/nav_newgame" android:icon="@android:drawable/ic_menu_today"
|
<item android:id="@+id/nav_newgame" android:icon="@android:drawable/ic_menu_today"
|
||||||
android:title="@string/menu_new_game" />
|
android:title="@string/menu_main" />
|
||||||
<item android:id="@+id/nav_continue" android:icon="@android:drawable/ic_menu_gallery"
|
|
||||||
android:title="@string/menu_continue_game" />
|
|
||||||
<item android:id="@+id/nav_highscore" android:icon="@android:drawable/ic_menu_myplaces"
|
<item android:id="@+id/nav_highscore" android:icon="@android:drawable/ic_menu_myplaces"
|
||||||
android:title="@string/menu_highscore" />
|
android:title="@string/menu_highscore" />
|
||||||
|
<item android:id="@+id/menu_settings" android:icon="@android:drawable/ic_menu_manage"
|
||||||
|
android:title="@string/menu_settings" />
|
||||||
</group>
|
</group>
|
||||||
<group android:menuCategory="container" android:title="">
|
<group android:id="@+id/group3">
|
||||||
<menu>
|
|
||||||
<item android:id="@+id/menu_settings" android:icon="@android:drawable/ic_menu_manage"
|
|
||||||
android:title="@string/menu_settings" />
|
|
||||||
<item android:id="@+id/menu_help" android:icon="@android:drawable/ic_menu_help"
|
<item android:id="@+id/menu_help" android:icon="@android:drawable/ic_menu_help"
|
||||||
android:title="@string/menu_help" />
|
android:title="@string/menu_help" />
|
||||||
<item android:id="@+id/menu_about" android:icon="@android:drawable/ic_menu_info_details"
|
<item android:id="@+id/menu_about" android:icon="@android:drawable/ic_menu_info_details"
|
||||||
android:title="@string/menu_about" />
|
android:title="@string/menu_about" />
|
||||||
</menu>
|
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
</menu>
|
</menu>
|
|
@ -1,19 +1,15 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<group android:id="@+id/group1">
|
||||||
<group android:checkableBehavior="single">
|
|
||||||
<item android:id="@+id/nav_highscore_main" android:icon="@android:drawable/ic_menu_myplaces"
|
<item android:id="@+id/nav_highscore_main" android:icon="@android:drawable/ic_menu_myplaces"
|
||||||
android:title="@string/menu_highscore" />
|
android:title="@string/menu_highscore" />
|
||||||
|
<item android:id="@+id/menu_settings_main" android:icon="@android:drawable/ic_menu_manage"
|
||||||
|
android:title="@string/menu_settings" />
|
||||||
</group>
|
</group>
|
||||||
<group android:menuCategory="container" android:title="">
|
<group android:id="@+id/group3">
|
||||||
<menu>
|
<item android:id="@+id/menu_help_main" android:icon="@android:drawable/ic_menu_help"
|
||||||
<item android:id="@+id/menu_settings_main" android:icon="@android:drawable/ic_menu_manage"
|
android:title="@string/menu_help" />
|
||||||
android:title="@string/menu_settings" />
|
<item android:id="@+id/menu_about_main" android:icon="@android:drawable/ic_menu_info_details"
|
||||||
<item android:id="@+id/menu_help_main" android:icon="@android:drawable/ic_menu_help"
|
android:title="@string/menu_about" />
|
||||||
android:title="@string/menu_help" />
|
|
||||||
<item android:id="@+id/menu_about_main" android:icon="@android:drawable/ic_menu_info_details"
|
|
||||||
android:title="@string/menu_about" />
|
|
||||||
</menu>
|
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
</menu>
|
</menu>
|
|
@ -6,7 +6,7 @@
|
||||||
<!-- Strings related to Menu -->
|
<!-- Strings related to Menu -->
|
||||||
<string name="new_game">Neues Spiel</string>
|
<string name="new_game">Neues Spiel</string>
|
||||||
<string name="menu_settings">Einstellungen</string>
|
<string name="menu_settings">Einstellungen</string>
|
||||||
<string name="menu_highscore">Bestenliste</string>
|
<string name="menu_highscore">Statistik</string>
|
||||||
<string name="menu_main">Hauptmenü</string>
|
<string name="menu_main">Hauptmenü</string>
|
||||||
<string name="menu_group">Gruppe</string>
|
<string name="menu_group">Gruppe</string>
|
||||||
<string name="menu_help">Hilfe</string>
|
<string name="menu_help">Hilfe</string>
|
||||||
|
|
|
@ -7,6 +7,6 @@
|
||||||
<dimen name="nav_header_vertical_spacing">13dp</dimen>
|
<dimen name="nav_header_vertical_spacing">13dp</dimen>
|
||||||
<dimen name="nav_header_height">160dp</dimen>
|
<dimen name="nav_header_height">160dp</dimen>
|
||||||
<dimen name="appbar_padding_top">8dp</dimen>
|
<dimen name="appbar_padding_top">8dp</dimen>
|
||||||
<dimen name="app_bar_height">180dp</dimen>
|
<dimen name="app_bar_height">24dp</dimen>
|
||||||
<dimen name="text_margin">16dp</dimen>
|
<dimen name="text_margin">16dp</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -2,14 +2,18 @@
|
||||||
<string name="app_name">Sudoku</string>
|
<string name="app_name">Sudoku</string>
|
||||||
<string name="title_activity_game_view">Sudoku</string>
|
<string name="title_activity_game_view">Sudoku</string>
|
||||||
|
|
||||||
|
<string name="cancel">Cancel</string>
|
||||||
|
|
||||||
<!-- ###MAIN MENU### -->
|
<!-- ###MAIN MENU### -->
|
||||||
<string name="menu_new_game">New Game</string>
|
<string name="new_game">New Game</string>
|
||||||
|
<string name="menu_main">Main Menu</string>
|
||||||
<string name="menu_settings">Settings</string>
|
<string name="menu_settings">Settings</string>
|
||||||
<string name="menu_highscore">Highscore</string>
|
<string name="menu_highscore">Highscore</string>
|
||||||
<string name="menu_group">Group</string>
|
<string name="menu_group">Group</string>
|
||||||
<string name="menu_help">Help</string>
|
<string name="menu_help">Help</string>
|
||||||
<string name="menu_about">About</string>
|
<string name="menu_about">About</string>
|
||||||
<string name="menu_continue_game">continue game</string>
|
<string name="menu_reset">Reset Board</string>
|
||||||
|
<string name="menu_continue_game">Continue Game</string>
|
||||||
|
|
||||||
<string name="description">a privacy friendly logic puzzle</string>
|
<string name="description">a privacy friendly logic puzzle</string>
|
||||||
|
|
||||||
|
@ -71,30 +75,33 @@
|
||||||
<string name="difficulty_hard">Hard</string>
|
<string name="difficulty_hard">Hard</string>
|
||||||
|
|
||||||
<!--###GameActivity -->
|
<!--###GameActivity -->
|
||||||
<string name="Sudoku"></string>
|
<string name="Sudoku">Sudoku</string>
|
||||||
<string name="gametype_default_9x9">Standart Sudoku 9x9</string>
|
<string name="gametype_default_9x9">Standart Sudoku 9x9</string>
|
||||||
<string name="gametype_default_6x6">Standart Sudoku 6x6</string>
|
<string name="gametype_default_6x6">Standart Sudoku 6x6</string>
|
||||||
<string name="gametype_unspecified">Unspec</string>
|
<string name="gametype_unspecified">Unspec</string>
|
||||||
<string name="gametype_default_12x12">Standart Sudoku 12x12</string>
|
<string name="gametype_default_12x12">Standart Sudoku 12x12</string>
|
||||||
<string name="gametype_x_9x9">X Sudoku 9x9</string>
|
<string name="gametype_x_9x9">X Sudoku 9x9</string>
|
||||||
<string name="gametype_hyper_9x9">Hyper Sudoku 9x9</string>
|
<string name="gametype_hyper_9x9">Hyper Sudoku 9x9</string>
|
||||||
<string name="title_activity_stats_game">StatsGameActivity</string>
|
<string name="title_activity_stats_game">Statistics</string>
|
||||||
<string name="section_format">Hello World from section: %1$d</string>
|
<string name="hint_usage">Select a valid field and then press the hint button to reveal the solution.</string>
|
||||||
|
<string name="hint_confirmation">Are you sure you want to use this hint? When using hints, you will not be able to achieve a personal best time.</string>
|
||||||
|
<string name="hint_confirmation_confirm">Use</string>
|
||||||
|
<string name="reset_confirmation">Are you sure you want to reset the game board?</string>
|
||||||
|
<string name="reset_confirmation_confirm">Reset</string>
|
||||||
|
|
||||||
<!-- ### Continue Game ### -->
|
<!-- ### Continue Game ### -->
|
||||||
<string name="loadgame_delete_confirmation">Are you sure you want to delete this save?</string>
|
<string name="loadgame_delete_confirmation">Are you sure you want to delete this save?</string>
|
||||||
<string name="loadgame_delete_confirm">Delete</string>
|
<string name="loadgame_delete_confirm">Delete</string>
|
||||||
<string name="loadgame_delete_cancel">Cancel</string>
|
|
||||||
<string name="title_activity_stats">StatsActivity</string>
|
<string name="title_activity_stats">StatsActivity</string>
|
||||||
|
|
||||||
<!-- ### Stats ###-->
|
<!-- ### Stats ###-->
|
||||||
<string name="stats_name">Statistics</string>
|
<string name="stats_name">Statistics</string>
|
||||||
<string name="number_of_hints">Number of Hints Used:</string>
|
<string name="number_of_hints">Number of hints used:</string>
|
||||||
<string name="number_of_games">#Games:</string>
|
<string name="number_of_games">Number of games played:</string>
|
||||||
<string name="total_of_time">Total time Played:</string>
|
<string name="total_of_time">Total time played:</string>
|
||||||
<string name="average_time">Av time:</string>
|
<string name="average_time">Average time:</string>
|
||||||
<string name="min_time">Min time:</string>
|
<string name="min_time">Minimum time:</string>
|
||||||
<string name="reset_stats">reset stats</string>
|
<string name="reset_stats">Reset All</string>
|
||||||
|
|
||||||
|
|
||||||
<!--### Win Strings -->
|
<!--### Win Strings -->
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="pref_symbols"
|
android:key="pref_symbols"
|
||||||
android:title="@string/pref_symbols"
|
android:title="@string/pref_symbols"
|
||||||
android:defaultValue="-1"
|
android:defaultValue="Default"
|
||||||
android:entries="@array/pref_symbols_list_titles"
|
android:entries="@array/pref_symbols_list_titles"
|
||||||
android:entryValues="@array/pref_symbols_list_values"
|
android:entryValues="@array/pref_symbols_list_values"
|
||||||
android:negativeButtonText="@null"
|
android:negativeButtonText="@null"
|
||||||
|
|
Loading…
Reference in a new issue