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"/>