diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 1e1b5b5..a9ba154 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -31,6 +31,8 @@
+
+
diff --git a/app/src/main/java/tu_darmstadt/sudoku/controller/GameController.java b/app/src/main/java/tu_darmstadt/sudoku/controller/GameController.java
index 3892611..651edcb 100644
--- a/app/src/main/java/tu_darmstadt/sudoku/controller/GameController.java
+++ b/app/src/main/java/tu_darmstadt/sudoku/controller/GameController.java
@@ -242,7 +242,7 @@ public class GameController {
}
//gameID now has a value other than 0 and hopefully unique
- FileManager fm = new FileManager(context, settings);
+ SaveLoadController fm = new SaveLoadController(context, settings);
fm.saveGameState(this);
}
diff --git a/app/src/main/java/tu_darmstadt/sudoku/controller/FileManager.java b/app/src/main/java/tu_darmstadt/sudoku/controller/SaveLoadController.java
similarity index 78%
rename from app/src/main/java/tu_darmstadt/sudoku/controller/FileManager.java
rename to app/src/main/java/tu_darmstadt/sudoku/controller/SaveLoadController.java
index f7d43bf..ce1fc60 100644
--- a/app/src/main/java/tu_darmstadt/sudoku/controller/FileManager.java
+++ b/app/src/main/java/tu_darmstadt/sudoku/controller/SaveLoadController.java
@@ -16,7 +16,7 @@ import tu_darmstadt.sudoku.game.GameInfoContainer;
/**
* Created by Chris on 16.11.2015.
*/
-public class FileManager {
+public class SaveLoadController {
Context context;
private SharedPreferences settings;
@@ -24,11 +24,10 @@ public class FileManager {
private static String FILE_EXTENSION = ".txt";
private static String SAVE_PREFIX = "save_";
private static String SAVES_DIR = "saves";
- private static String highscoresDir = "highscores";
private static List list = new LinkedList<>();
- public FileManager(Context context, SharedPreferences settings) {
+ public SaveLoadController(Context context, SharedPreferences settings) {
this.context = context;
this.settings = settings;
}
@@ -70,7 +69,6 @@ public class FileManager {
String gameString = new String(bytes);
String[] values = gameString.split("/");
- //String[] levels = saves.split("###");
try {
if(values.length < 4) {
throw new IllegalArgumentException("Can not load game info. File seems to be damaged or incomplete.");
@@ -100,34 +98,6 @@ public class FileManager {
return result;
}
- /*public String loadGameState(int index) {
- File dir = context.getDir(SAVES_DIR, 0);
-
- dir.listFiles();
-
- File file = new File(dir, savesFile);
-
- byte[] bytes = new byte[(int)file.length()];
-
- try {
- FileInputStream stream = new FileInputStream(file);
- try {
- stream.read(bytes);
- } finally {
- stream.close();
- }
- } catch(IOException e) {
- Log.e("File Manager", "Could not load game. IOException occured.");
- }
- String saves = new String(bytes);
- String[] levels = saves.split("###");
- for(String level : levels) {
- String[] values = level.split("|");
- GameType type = Enum.valueOf(GameType.class, values[0]);
- }
- return saves;
- }*/
-
public void saveGameState(GameController controller) {
String level = GameInfoContainer.getGameInfo(controller);
diff --git a/app/src/main/java/tu_darmstadt/sudoku/controller/Symbol.java b/app/src/main/java/tu_darmstadt/sudoku/controller/Symbol.java
new file mode 100644
index 0000000..4478440
--- /dev/null
+++ b/app/src/main/java/tu_darmstadt/sudoku/controller/Symbol.java
@@ -0,0 +1,28 @@
+package tu_darmstadt.sudoku.controller;
+
+/**
+ * Created by Chris on 17.11.2015.
+ */
+public enum Symbol {
+
+ Default(new char[] {'1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N'}),
+ Fancy(new char[] {'♪', '♫', '☼', '♥', '♦', '♣', '♠', '•', '○', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N' });
+
+ private char[] map;
+
+ Symbol(char[] map) {
+ this.map = map;
+ }
+
+ public static String getSymbol(Symbol type, int value) {
+ return String.valueOf(type.map[value]);
+ }
+
+ public static int getValue(Symbol type, char c) {
+ for(int i = 0; i < type.map.length; i++) {
+ if(type.map[i] == c) return i;
+ }
+ return -1;
+ }
+
+}
diff --git a/app/src/main/java/tu_darmstadt/sudoku/game/GameInfoContainer.java b/app/src/main/java/tu_darmstadt/sudoku/game/GameInfoContainer.java
index 094a8bc..eb51b37 100644
--- a/app/src/main/java/tu_darmstadt/sudoku/game/GameInfoContainer.java
+++ b/app/src/main/java/tu_darmstadt/sudoku/game/GameInfoContainer.java
@@ -3,6 +3,7 @@ package tu_darmstadt.sudoku.game;
import android.util.Log;
import tu_darmstadt.sudoku.controller.GameController;
+import tu_darmstadt.sudoku.controller.Symbol;
/**
* Created by Chris on 17.11.2015.
@@ -35,23 +36,52 @@ public class GameInfoContainer {
}
public void parseFixedValues(String s){
+ if(gameType != GameType.Unspecified && gameType != null) {
+ int size = GameType.getSize(gameType);
+ int sq = size*size;
+
+ if(s.length() != sq) {
+ throw new IllegalArgumentException("The string must be "+sq+" characters long.");
+ }
+ }
fixedValues = new int[s.length()];
for(int i = 0; i < s.length(); i++) {
- fixedValues[i] = Integer.parseInt(s.charAt(i)+"");
+ fixedValues[i] = Symbol.getValue(Symbol.Default, s.charAt(i))+1;
}
}
public void parseSetValues(String s) {
+ if(gameType != GameType.Unspecified && gameType != null) {
+ int size = GameType.getSize(gameType);
+ int sq = size*size;
+
+ if(s.length() != sq) {
+ throw new IllegalArgumentException("The string must be "+sq+" characters long.");
+ }
+ }
setValues = new int[s.length()];
for(int i = 0; i < s.length(); i++) {
- setValues[i] = Integer.parseInt(s.charAt(i)+"");
+ setValues[i] = Symbol.getValue(Symbol.Default, s.charAt(i))+1;
}
}
public void parseNotes(String s) {
String[] strings = s.split("-");
+
+ int size = GameType.getSize(gameType);
+ int sq = size*size;
+
+ if(gameType != GameType.Unspecified && gameType != null) {
+ if(strings.length != sq) {
+ throw new IllegalArgumentException("The string array must have "+sq+" entries.");
+ }
+ }
+
setNotes = new boolean[strings.length][strings[0].length()];
for(int i = 0; i < strings.length; i++) {
+ if(strings[i].length() != size) {
+ throw new IllegalArgumentException("The string must be "+size+" characters long.");
+ }
for(int k = 0; k < strings[i].length(); k++) {
setNotes[i][k] = (strings[i].charAt(k)) == '1' ? true : false;
}
@@ -103,7 +133,7 @@ public class GameInfoContainer {
@Override
public StringBuilder action(GameCell gc, StringBuilder existing) {
if (gc.isFixed()) {
- existing.append(gc.getValue());
+ existing.append(Symbol.getSymbol(Symbol.Default, gc.getValue() - 1));
} else {
existing.append(0);
}
@@ -118,10 +148,10 @@ public class GameInfoContainer {
controller.actionOnCells(new ICellAction() {
@Override
public StringBuilder action(GameCell gc, StringBuilder existing) {
- if (gc.isFixed()) {
+ if (gc.isFixed() || gc.getValue() == 0) {
existing.append(0);
} else {
- existing.append(gc.getValue());
+ existing.append(Symbol.getSymbol(Symbol.Default, gc.getValue() - 1));
}
return existing;
}
diff --git a/app/src/main/java/tu_darmstadt/sudoku/ui/GameActivity.java b/app/src/main/java/tu_darmstadt/sudoku/ui/GameActivity.java
index 1b8fb29..5f1a259 100644
--- a/app/src/main/java/tu_darmstadt/sudoku/ui/GameActivity.java
+++ b/app/src/main/java/tu_darmstadt/sudoku/ui/GameActivity.java
@@ -15,13 +15,12 @@ import android.view.MenuItem;
import java.util.List;
-import tu_darmstadt.sudoku.controller.FileManager;
+import tu_darmstadt.sudoku.controller.SaveLoadController;
import tu_darmstadt.sudoku.controller.GameController;
import tu_darmstadt.sudoku.game.GameInfoContainer;
import tu_darmstadt.sudoku.game.GameType;
import tu_darmstadt.sudoku.ui.view.R;
import tu_darmstadt.sudoku.ui.view.SudokuFieldLayout;
-import tu_darmstadt.sudoku.ui.view.SudokuButton;
import tu_darmstadt.sudoku.ui.view.SudokuKeyboardLayout;
import tu_darmstadt.sudoku.ui.view.SudokuSpecialButtonLayout;
@@ -38,7 +37,8 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
GameType gameType = GameType.Unspecified;
int gameDifficulty = 0;
- int loadLevel = 0;
+ int loadLevelID = 0;
+ boolean loadLevel = false;
Bundle extras = getIntent().getExtras();
if (extras != null) {
@@ -47,7 +47,10 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
gameType = (GameType)extras.get("gameType");
}
gameDifficulty = extras.getInt("gameDifficulty");
- loadLevel = extras.getInt("loadLevel");
+ loadLevel = extras.getBoolean("loadLevel");
+ if(loadLevel) {
+ loadLevelID = extras.getInt("loadLevelID");
+ }
}
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
@@ -61,11 +64,11 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
layout = (SudokuFieldLayout)findViewById(R.id.sudokuLayout);
gameController = new GameController(sharedPref);
- List loadableGames = FileManager.getLoadableGameList();
+ List loadableGames = SaveLoadController.getLoadableGameList();
- if(loadLevel != 0 && loadableGames.size() >= loadLevel) {
- // load level from FileManager
- gameController.loadLevel(loadableGames.get(loadLevel-1));
+ if(loadLevel && loadableGames.size() > loadLevelID) {
+ // load level from SaveLoadController
+ gameController.loadLevel(loadableGames.get(loadLevelID));
} else {
// load a new level
gameController.loadNewLevel(gameType, gameDifficulty);
@@ -133,35 +136,51 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
Intent intent;
- if (id == R.id.nav_newgame) {
- //create new game
- intent = new Intent(this, MainActivity.class);
- startActivity(intent);
+ switch(id) {
+ case R.id.nav_newgame:
+ //create new game
+ intent = new Intent(this, MainActivity.class);
+ gameController.saveGame(getBaseContext());
+ finish();
+ startActivity(intent);
+ break;
- /*} else if (id == R.id.nav_mainmenu) {
- //go to main menu
- intent = new Intent(this, MainActivity.class);
- startActivity(intent);*/
+ case R.id.nav_continue:
+ //create new game
+ intent = new Intent(this, LoadGameActivity.class);
+ gameController.saveGame(getBaseContext());
+ finish();
+ startActivity(intent);
+ break;
- } else if (id == R.id.nav_settings) {
- //open settings
- intent = new Intent(this,SettingsActivity.class);
- startActivity(intent);
+ case R.id.menu_settings:
+ //open settings
+ intent = new Intent(this,SettingsActivity.class);
+ gameController.saveGame(getBaseContext());
+ finish();
+ startActivity(intent);
+ break;
- } else if (id == R.id.nav_highscore) {
- // see highscore list
- //intent = new Intent(this, HighscoreActivity.class);
- //startActivity(intent);
+ case R.id.nav_highscore:
+ // see highscore list
+ //intent = new Intent(this, HighscoreActivity.class);
+ //startActivity(intent);
+ break;
- } else if (id == R.id.nav_about) {
- //open about page
- intent = new Intent(this,AboutActivity.class);
- startActivity(intent);
+ case R.id.menu_about:
+ //open about page
+ intent = new Intent(this,AboutActivity.class);
+ gameController.saveGame(getBaseContext());
+ finish();
+ startActivity(intent);
+ break;
- } else if (id == R.id.nav_help) {
- //open about page
- //intent = new Intent(this,HelpActivity.class);
- //startActivity(intent);
+ case R.id.menu_help:
+ //open about page
+ //intent = new Intent(this,HelpActivity.class);
+ //startActivity(intent);
+ break;
+ default:
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
diff --git a/app/src/main/java/tu_darmstadt/sudoku/ui/LoadGameActivity.java b/app/src/main/java/tu_darmstadt/sudoku/ui/LoadGameActivity.java
new file mode 100644
index 0000000..8c1a396
--- /dev/null
+++ b/app/src/main/java/tu_darmstadt/sudoku/ui/LoadGameActivity.java
@@ -0,0 +1,124 @@
+package tu_darmstadt.sudoku.ui;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.preference.PreferenceManager;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.BaseAdapter;
+import android.widget.ImageView;
+import android.widget.ListView;
+import android.widget.TextView;
+
+import java.util.List;
+
+import tu_darmstadt.sudoku.controller.SaveLoadController;
+import tu_darmstadt.sudoku.game.GameInfoContainer;
+import tu_darmstadt.sudoku.ui.view.R;
+
+public class LoadGameActivity extends AppCompatActivity {
+
+ List loadableGameList;
+ SharedPreferences settings;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.activity_load_game);
+
+ settings = PreferenceManager.getDefaultSharedPreferences(this);
+
+ SaveLoadController saveLoadController = new SaveLoadController(this, settings);
+ loadableGameList = saveLoadController.loadGameStateInfo();
+
+ AdapterView.OnItemClickListener clickListener = new AdapterView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView> parent, View view, int position, long id) {
+ Intent i = new Intent(parent.getContext(), GameActivity.class);
+ i.putExtra("loadLevel", true);
+ i.putExtra("loadLevelID", position);
+ finish();
+ startActivity(i);
+ }
+ };
+
+ AdapterView.OnItemLongClickListener longClickListener = new AdapterView.OnItemLongClickListener() {
+ @Override
+ public boolean onItemLongClick(AdapterView> parent, View view, int position, long id) {
+ return false;
+ }
+ };
+
+ ListView listView = (ListView)findViewById(R.id.load_game_list);
+ listView.setAdapter(new LoadGameAdapter(this, loadableGameList));
+ listView.setOnItemClickListener(clickListener);
+ listView.setOnItemLongClickListener(longClickListener);
+
+ }
+
+
+
+ private class LoadGameAdapter extends BaseAdapter {
+
+ private Context context;
+ private List loadableGameList;
+
+ public LoadGameAdapter(Context context, List loadableGameList) {
+ this.context = context;
+ this.loadableGameList = loadableGameList;
+ }
+
+ @Override
+ public int getCount() {
+ return loadableGameList.size();
+ }
+
+ @Override
+ public Object getItem(int position) {
+ return loadableGameList.get(position);
+ }
+
+ @Override
+ public long getItemId(int position) {
+ return loadableGameList.get(position).getID();
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ if (convertView == null) {
+ LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ convertView = (View) inflater.inflate(R.layout.list_entry_layout, null);
+ }
+
+ GameInfoContainer gic = loadableGameList.get(position);
+
+ TextView name = (TextView)convertView.findViewById(R.id.loadgame_listentry_gametype);
+ TextView summary=(TextView)convertView.findViewById(R.id.loadgame_listentry_id);
+ ImageView image = (ImageView)convertView.findViewById(R.id.loadgame_listentry_gametypeimage);
+
+ switch(gic.getGameType()) {
+ case Default_6x6:
+ image.setImageResource(R.drawable.icon_default_6x6);
+ break;
+ case Default_12x12:
+ image.setImageResource(R.drawable.icon_default_12x12);
+ break;
+ case Default_9x9:
+ image.setImageResource(R.drawable.icon_default_9x9);
+ break;
+ default:
+ image.setImageResource(R.drawable.icon_default_9x9);
+ }
+ name.setText(gic.getGameType().name());
+ summary.setText(String.valueOf(gic.getID()));
+
+ return convertView;
+ }
+ }
+}
diff --git a/app/src/main/java/tu_darmstadt/sudoku/ui/MainActivity.java b/app/src/main/java/tu_darmstadt/sudoku/ui/MainActivity.java
index e535924..59af77f 100644
--- a/app/src/main/java/tu_darmstadt/sudoku/ui/MainActivity.java
+++ b/app/src/main/java/tu_darmstadt/sudoku/ui/MainActivity.java
@@ -23,7 +23,7 @@ import android.widget.TextView;
import java.util.List;
-import tu_darmstadt.sudoku.controller.FileManager;
+import tu_darmstadt.sudoku.controller.SaveLoadController;
import tu_darmstadt.sudoku.game.GameInfoContainer;
import tu_darmstadt.sudoku.game.GameType;
import tu_darmstadt.sudoku.ui.view.R;
@@ -97,10 +97,7 @@ public class MainActivity extends AppCompatActivity {
i = new Intent(this, AboutActivity.class);
break;
case R.id.continueButton:
- // TODO continue from file.
- i = new Intent(this, GameActivity.class);
- int levelNr = 1;
- i.putExtra("loadLevel", levelNr);
+ i = new Intent(this, LoadGameActivity.class);
break;
case R.id.highscoreButton:
// TODO: create highscore screen
@@ -144,7 +141,7 @@ public class MainActivity extends AppCompatActivity {
private void refreshContinueButton() {
// enable continue button if we have saved games.
Button continueButton = (Button)findViewById(R.id.continueButton);
- FileManager fm = new FileManager(getBaseContext(), settings);
+ SaveLoadController fm = new SaveLoadController(getBaseContext(), settings);
List gic = fm.loadGameStateInfo();
if(gic.size() > 0) {
continueButton.setEnabled(true);
diff --git a/app/src/main/java/tu_darmstadt/sudoku/ui/view/CellHighlightTypes.java b/app/src/main/java/tu_darmstadt/sudoku/ui/view/CellHighlightTypes.java
index 12a03b5..1a11916 100644
--- a/app/src/main/java/tu_darmstadt/sudoku/ui/view/CellHighlightTypes.java
+++ b/app/src/main/java/tu_darmstadt/sudoku/ui/view/CellHighlightTypes.java
@@ -8,5 +8,8 @@ public enum CellHighlightTypes {
Selected,
Error,
Connected,
- Highlighted // Same Numbers are not connected but might be highlighted.
+ Value_Highlighted,
+ Value_Highlighted_Selected,
+
+ // Same Numbers are not connected but might be highlighted.
}
diff --git a/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuCellView.java b/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuCellView.java
index ef59922..35f4e14 100644
--- a/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuCellView.java
+++ b/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuCellView.java
@@ -11,6 +11,7 @@ import android.view.View;
import android.widget.RelativeLayout;
import tu_darmstadt.sudoku.game.GameCell;
+import tu_darmstadt.sudoku.controller.Symbol;
/**
* Created by TMZ_LToP on 10.11.2015.
@@ -26,6 +27,7 @@ public class SudokuCellView extends View {
int mCol;
boolean selected;
CellHighlightTypes highlightType = CellHighlightTypes.Default;
+ Symbol symbolsToUse = Symbol.Default;
public SudokuCellView(Context context) {
@@ -97,7 +99,7 @@ public class SudokuCellView extends View {
p.setColor(Color.YELLOW);
p.setAlpha(100);
break;
- case Highlighted:
+ case Value_Highlighted:
p.setColor(Color.YELLOW);
break;
default:
@@ -125,9 +127,10 @@ public class SudokuCellView extends View {
for (int i = 0; i < mGameCell.getNotes().length; i++) {
if (mGameCell.getNotes()[i]) {
p.setTypeface(Typeface.SANS_SERIF);
- p.setTextSize(mWidth/4);
+ p.setTextSize(mWidth / 4);
p.setTextAlign(Paint.Align.RIGHT);
- canvas.drawText(String.valueOf(i+1),(mWidth*1/12)*k,(mWidth*1/12)*j,p);
+ // TODO settings: get SymbolEnum from settings
+ canvas.drawText(String.valueOf(Symbol.getSymbol(symbolsToUse, i)),(mWidth*1/12)*k,(mWidth*1/12)*j,p);
/*canvas.drawText(String.valueOf(1), (mWidth * 1 / 12)*3, (mWidth* 1 / 12)*3, p);
canvas.drawText(String.valueOf(2),(mWidth*1/12)*7, (mWidth* 1 / 12)*7,p );
canvas.drawText(String.valueOf(3),(mWidth*1/12)*11, (mWidth* 1 / 12)*11,p );*/
@@ -148,7 +151,8 @@ public class SudokuCellView extends View {
p.setAntiAlias(true);
p.setTextSize(Math.min(mHeight * 3 / 4, mHeight * 3 / 4));
p.setTextAlign(Paint.Align.CENTER);
- canvas.drawText(String.valueOf(mGameCell.getValue()), mHeight / 2, mHeight / 2 + mHeight / 4, p);
+ // TODO settings: get SymbolEnum from settings
+ canvas.drawText(String.valueOf(Symbol.getSymbol(symbolsToUse, mGameCell.getValue()-1)), mHeight / 2, mHeight / 2 + mHeight / 4, p);
}
public int getRow() {
diff --git a/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuKeyboardLayout.java b/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuKeyboardLayout.java
index d3c9b51..384a9ff 100644
--- a/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuKeyboardLayout.java
+++ b/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuKeyboardLayout.java
@@ -9,7 +9,7 @@ import android.view.View;
import android.widget.GridLayout;
import tu_darmstadt.sudoku.controller.GameController;
-import tu_darmstadt.sudoku.game.GameType;
+import tu_darmstadt.sudoku.controller.Symbol;
/**
* Created by TMZ_LToP on 12.11.2015.
@@ -22,20 +22,19 @@ public class SudokuKeyboardLayout extends GridLayout {
SudokuButton [] buttons;
GameController gameController;
boolean notesEnabled=false;
-
+ Symbol symbolsToUse = Symbol.Default;
OnClickListener listener = new OnClickListener() {
@Override
public void onClick(View v) {
if(v instanceof SudokuButton) {
SudokuButton btn = (SudokuButton)v;
- if(notesEnabled) {
- gameController.toggleSelectedNote(btn.getValue());
- } else {
- gameController.setSelectedValue(btn.getValue());
- }
+ if(notesEnabled) {
+ gameController.toggleSelectedNote(btn.getValue());
+ } else {
+ gameController.setSelectedValue(btn.getValue());
+ }
}
-
}
};
@@ -68,14 +67,12 @@ public class SudokuKeyboardLayout extends GridLayout {
buttons[number].setLayoutParams(p);
buttons[number].setGravity(Gravity.CENTER);
buttons[number].setType(SudokuButtonType.Value);
- buttons[number].setText(String.valueOf(number + 1));
+ // TODO settings: get SymbolEnum from settings
+ buttons[number].setText(Symbol.getSymbol(symbolsToUse, number));
buttons[number].setValue(number + 1);
buttons[number].setOnClickListener(listener);
addView(buttons[number]);
number++;
-
-
-
}
}
}
@@ -84,8 +81,8 @@ public class SudokuKeyboardLayout extends GridLayout {
gameController=gc;
}
- public void setNotesEnabled(boolean b) {
- notesEnabled = b;
+ public void toggleNotesEnabled() {
+ notesEnabled = !notesEnabled;
if(notesEnabled) {
setTextSize(buttons[0].getPaint().getTextSize()/2);
}else {
diff --git a/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuSpecialButtonLayout.java b/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuSpecialButtonLayout.java
index 7e77ad5..02d5400 100644
--- a/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuSpecialButtonLayout.java
+++ b/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuSpecialButtonLayout.java
@@ -1,16 +1,12 @@
package tu_darmstadt.sudoku.ui.view;
import android.content.Context;
-import android.text.style.TextAppearanceSpan;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.Button;
-import android.widget.GridLayout;
import android.widget.LinearLayout;
-import java.awt.font.TextAttribute;
import java.util.ArrayList;
import tu_darmstadt.sudoku.controller.GameController;
@@ -23,7 +19,6 @@ public class SudokuSpecialButtonLayout extends LinearLayout {
SudokuButton [] fixedButtons;
public int fixedButtonsCount = SudokuButtonType.getSpecialButtons().size();
GameController gameController;
- boolean notesEnabled=false;
SudokuKeyboardLayout keyboard;
@@ -38,9 +33,8 @@ public class SudokuSpecialButtonLayout extends LinearLayout {
gameController.deleteSelectedValue();
break;
case NoteToggle:
- notesEnabled = !notesEnabled;
- btn.setText(notesEnabled ? "ON" : "OFF");
- keyboard.setNotesEnabled(notesEnabled);
+ btn.setText(keyboard.notesEnabled ? "ON" : "OFF");
+ keyboard.toggleNotesEnabled();
break;
case Do:
// TODO: not implemented
diff --git a/app/src/main/res/layout/activity_load_game.xml b/app/src/main/res/layout/activity_load_game.xml
new file mode 100644
index 0000000..6d5ed8a
--- /dev/null
+++ b/app/src/main/res/layout/activity_load_game.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_main_menu.xml b/app/src/main/res/layout/activity_main_menu.xml
index 317ad3c..dc27433 100644
--- a/app/src/main/res/layout/activity_main_menu.xml
+++ b/app/src/main/res/layout/activity_main_menu.xml
@@ -85,8 +85,7 @@
android:onClick="onClick"
android:capitalize="none"
android:clickable="false"
- android:elevation="10dp"
- style="?android:attr/borderlessButtonStyle"/>
+ android:elevation="10dp"/>
+ android:clickable="false"/>
+ android:weightSum="2">
+ android:clickable="false"/>
+ android:clickable="false"/>
+ android:weightSum="2">
+ android:clickable="false"/>
+ android:clickable="false"/>
diff --git a/app/src/main/res/layout/content_game_view.xml b/app/src/main/res/layout/content_game_view.xml
index 35883cd..af6905a 100644
--- a/app/src/main/res/layout/content_game_view.xml
+++ b/app/src/main/res/layout/content_game_view.xml
@@ -32,8 +32,7 @@
android:id="@+id/sudokuSpecialLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:layout_below="@+id/sudokuKeyboardLayout"
- >
+ android:layout_below="@+id/sudokuKeyboardLayout">
diff --git a/app/src/main/res/layout/fragment_main_menu.xml b/app/src/main/res/layout/fragment_main_menu.xml
index 1f48dd4..0cf37fa 100644
--- a/app/src/main/res/layout/fragment_main_menu.xml
+++ b/app/src/main/res/layout/fragment_main_menu.xml
@@ -8,21 +8,24 @@
android:paddingBottom="@dimen/activity_vertical_margin"
android:gravity="center_horizontal|center_vertical"
android:orientation="vertical"
+ android:weightSum="8"
tools:context="tu_darmstadt.sudoku.ui.MainActivity$GameTypeFragment">
+ android:src="@drawable/icon_default_9x9"
+ android:layout_height="0dp" />
diff --git a/app/src/main/res/layout/list_entry_layout.xml b/app/src/main/res/layout/list_entry_layout.xml
new file mode 100644
index 0000000..00821d7
--- /dev/null
+++ b/app/src/main/res/layout/list_entry_layout.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/menu_drawer.xml b/app/src/main/res/menu/menu_drawer.xml
index 619c512..71b1c86 100644
--- a/app/src/main/res/menu/menu_drawer.xml
+++ b/app/src/main/res/menu/menu_drawer.xml
@@ -3,19 +3,19 @@
-
+ android:title="@string/menu_new_game" />
+
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 9c4b3f9..e9a416e 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -2,5 +2,5 @@
#024265
#024265
- #FFFF00
+ #AA0000
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 1960fc0..a1d5525 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -6,7 +6,6 @@
New Game
Settings
Highscore
- Main Menu
Group
Help
About
@@ -17,25 +16,22 @@
Open navigation drawer
Close navigation drawer
+ Load Game
Settings
Settings
Highlighting
-
Selection highlight
Connected rows
Connected columns
Connected sections
-
Value highlight
Same values
Notes
-
Game
-
Game settings
Note deletion
Automatically remove notes when setting values on connected cells
@@ -43,7 +39,7 @@
Privacy friendly Sudoku
- v0.8
+ v0.9
Author:
Christopher Beckmann, Timm Lippert
In affiliation with:
@@ -51,139 +47,4 @@
More information can be found on:
https://www.secuso.org
-
- - 15 minutes
- - 30 minutes
- - 1 hour
- - 3 hours
- - 6 hours
- - Never
-
- Test String
- MainMenuActivity
- Hello World from section: %1$d
- testActivity
- LoadGameActivity
-
- "Material is the metaphor.\n\n"
-
- "A material metaphor is the unifying theory of a rationalized space and a system of motion."
- "The material is grounded in tactile reality, inspired by the study of paper and ink, yet "
- "technologically advanced and open to imagination and magic.\n"
- "Surfaces and edges of the material provide visual cues that are grounded in reality. The "
- "use of familiar tactile attributes helps users quickly understand affordances. Yet the "
- "flexibility of the material creates new affordances that supercede those in the physical "
- "world, without breaking the rules of physics.\n"
- "The fundamentals of light, surface, and movement are key to conveying how objects move, "
- "interact, and exist in space and in relation to each other. Realistic lighting shows "
- "seams, divides space, and indicates moving parts.\n\n"
-
- "Bold, graphic, intentional.\n\n"
-
- "The foundational elements of print based design typography, grids, space, scale, color, "
- "and use of imagery guide visual treatments. These elements do far more than please the "
- "eye. They create hierarchy, meaning, and focus. Deliberate color choices, edge to edge "
- "imagery, large scale typography, and intentional white space create a bold and graphic "
- "interface that immerse the user in the experience.\n"
- "An emphasis on user actions makes core functionality immediately apparent and provides "
- "waypoints for the user.\n\n"
-
- "Motion provides meaning.\n\n"
-
- "Motion respects and reinforces the user as the prime mover. Primary user actions are "
- "inflection points that initiate motion, transforming the whole design.\n"
- "All action takes place in a single environment. Objects are presented to the user without "
- "breaking the continuity of experience even as they transform and reorganize.\n"
- "Motion is meaningful and appropriate, serving to focus attention and maintain continuity. "
- "Feedback is subtle yet clear. Transitions are efficient yet coherent.\n\n"
-
- "3D world.\n\n"
-
- "The material environment is a 3D space, which means all objects have x, y, and z "
- "dimensions. The z-axis is perpendicularly aligned to the plane of the display, with the "
- "positive z-axis extending towards the viewer. Every sheet of material occupies a single "
- "position along the z-axis and has a standard 1dp thickness.\n"
- "On the web, the z-axis is used for layering and not for perspective. The 3D world is "
- "emulated by manipulating the y-axis.\n\n"
-
- "Light and shadow.\n\n"
-
- "Within the material environment, virtual lights illuminate the scene. Key lights create "
- "directional shadows, while ambient light creates soft shadows from all angles.\n"
- "Shadows in the material environment are cast by these two light sources. In Android "
- "development, shadows occur when light sources are blocked by sheets of material at "
- "various positions along the z-axis. On the web, shadows are depicted by manipulating the "
- "y-axis only. The following example shows the card with a height of 6dp.\n\n"
-
- "Resting elevation.\n\n"
-
- "All material objects, regardless of size, have a resting elevation, or default elevation "
- "that does not change. If an object changes elevation, it should return to its resting "
- "elevation as soon as possible.\n\n"
-
- "Component elevations.\n\n"
-
- "The resting elevation for a component type is consistent across apps (e.g., FAB elevation "
- "does not vary from 6dp in one app to 16dp in another app).\n"
- "Components may have different resting elevations across platforms, depending on the depth "
- "of the environment (e.g., TV has a greater depth than mobile or desktop).\n\n"
-
- "Responsive elevation and dynamic elevation offsets.\n\n"
-
- "Some component types have responsive elevation, meaning they change elevation in response "
- "to user input (e.g., normal, focused, and pressed) or system events. These elevation "
- "changes are consistently implemented using dynamic elevation offsets.\n"
- "Dynamic elevation offsets are the goal elevation that a component moves towards, relative "
- "to the component’s resting state. They ensure that elevation changes are consistent "
- "across actions and component types. For example, all components that lift on press have "
- "the same elevation change relative to their resting elevation.\n"
- "Once the input event is completed or cancelled, the component will return to its resting "
- "elevation.\n\n"
-
- "Avoiding elevation interference.\n\n"
-
- "Components with responsive elevations may encounter other components as they move between "
- "their resting elevations and dynamic elevation offsets. Because material cannot pass "
- "through other material, components avoid interfering with one another any number of ways, "
- "whether on a per component basis or using the entire app layout.\n"
- "On a component level, components can move or be removed before they cause interference. "
- "For example, a floating action button (FAB) can disappear or move off screen before a "
- "user picks up a card, or it can move if a snackbar appears.\n"
- "On the layout level, design your app layout to minimize opportunities for interference. "
- "For example, position the FAB to one side of stream of a cards so the FAB won’t interfere "
- "when a user tries to pick up one of cards.\n\n"
-
-
-
-
-
-