Added a new solve strategy to the Solver.

Added new settings that will work across the app.
Cleaned up code.
Added about page.
This commit is contained in:
Christopher Beckmann 2015-11-13 13:43:58 +01:00
parent fcf095c3dd
commit f43803ad46
31 changed files with 446 additions and 271 deletions

View file

@ -1,4 +1,4 @@
package tu_darmstadt.sudoku.view; package tu_darmstadt.sudoku.ui.view;
import android.app.Application; import android.app.Application;
import android.test.ApplicationTestCase; import android.test.ApplicationTestCase;

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="tu_darmstadt.sudoku.view" > package="tu_darmstadt.sudoku.ui.view" >
<application <application
android:allowBackup="true" android:allowBackup="true"
@ -8,7 +8,7 @@
android:label="@string/app_name" android:label="@string/app_name"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme" > android:theme="@style/AppTheme" >
<activity android:name=".MainActivity" > <activity android:name="tu_darmstadt.sudoku.ui.MainActivity" >
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
@ -16,18 +16,19 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name=".SettingsActivity" android:name="tu_darmstadt.sudoku.ui.SettingsActivity"
android:label="@string/title_activity_settings" android:label="@string/title_activity_settings"
android:parentActivityName=".MainActivity" > android:parentActivityName="tu_darmstadt.sudoku.ui.MainActivity" >
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value="tu_darmstadt.sudoku.view.MainActivity" /> android:value="tu_darmstadt.sudoku.ui.MainActivity" />
</activity> </activity>
<activity <activity
android:name=".GameActivity" android:name="tu_darmstadt.sudoku.ui.GameActivity"
android:label="@string/title_activity_game_view" android:label="@string/title_activity_game_view"
android:theme="@style/AppTheme.NoActionBar" > android:theme="@style/AppTheme.NoActionBar" >
</activity>
<activity android:name="tu_darmstadt.sudoku.ui.AboutActivity" >
</activity> </activity>
</application> </application>

View file

@ -1,5 +1,7 @@
package tu_darmstadt.sudoku.controller; package tu_darmstadt.sudoku.controller;
import android.content.SharedPreferences;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@ -7,10 +9,8 @@ import tu_darmstadt.sudoku.game.CellConflict;
import tu_darmstadt.sudoku.game.CellConflictList; import tu_darmstadt.sudoku.game.CellConflictList;
import tu_darmstadt.sudoku.game.GameCell; import tu_darmstadt.sudoku.game.GameCell;
import tu_darmstadt.sudoku.game.GameField; import tu_darmstadt.sudoku.game.GameField;
import tu_darmstadt.sudoku.game.GameSettings;
import tu_darmstadt.sudoku.game.GameType; import tu_darmstadt.sudoku.game.GameType;
import tu_darmstadt.sudoku.game.ICellAction; import tu_darmstadt.sudoku.game.solver.Solver;
import tu_darmstadt.sudoku.game.solver.Default9x9Solver;
import tu_darmstadt.sudoku.game.solver.ISolver; import tu_darmstadt.sudoku.game.solver.ISolver;
/** /**
@ -26,21 +26,26 @@ public class GameController {
private GameType gameType; private GameType gameType;
private int selectedRow; private int selectedRow;
private int selectedCol; private int selectedCol;
private SharedPreferences settings;
private CellConflictList errorList = new CellConflictList(); private CellConflictList errorList = new CellConflictList();
private GameSettings settings = new GameSettings();
//private LinkedList<IModelChangeListener> listeners = new LinkedList<>(); //private LinkedList<IModelChangeListener> listeners = new LinkedList<>();
// private Default9x9Solver solver; // private Solver solver;
// private SudokuGenerator generator; // private SudokuGenerator generator;
public GameController() { public GameController(SharedPreferences pref) {
this(GameType.Default_9x9); this(GameType.Default_9x9, pref);
} }
public GameController(GameType type) { public GameController() {
this(null);
}
public GameController(GameType type, SharedPreferences pref) {
this.gameType = type; this.gameType = type;
setGameType(type); setGameType(type);
gameField = new GameField(size, sectionHeight, sectionWidth); gameField = new GameField(size, sectionHeight, sectionWidth);
setSettings(pref);
setValue(0, 1, 8); setValue(0, 4, 2); setValue(0, 1, 8); setValue(0, 4, 2);
setValue(0, 5, 6); setValue(0, 6, 7); setValue(0, 5, 6); setValue(0, 6, 7);
setValue(0, 7, 3); setValue(0, 8, 4); setValue(0, 7, 3); setValue(0, 8, 4);
@ -53,10 +58,31 @@ public class GameController {
setNote(7, 3, 9); setNote(7, 3, 9);
} }
public void loadLevel(int size, int sectionHeight, int sectionWidth, int[] fixedValues, int[] setValues, int[][] setNotes) {
this.size = size;
this.sectionHeight = sectionHeight;
this.sectionWidth = sectionWidth;
this.gameField = new GameField(size, sectionHeight, sectionWidth);
gameField.initCells(fixedValues);
// now set the values that are not fixed
for(int i = 0; i < size*size; i++) {
int row = (int)Math.floor(i/size);
int col = i%size;
setValue(row, col, setValues[i]);
}
}
public void setSettings(SharedPreferences pref) {
settings = pref;
}
private GameField solve(GameField gameField) { private GameField solve(GameField gameField) {
switch(gameType) { switch(gameType) {
case Default_9x9: case Default_9x9:
solver = new Default9x9Solver(gameField); case Default_6x6:
case Default_12x12:
solver = new Solver(gameField);
break; break;
default: default:
throw new UnsupportedOperationException("No Solver for this GameType defined."); throw new UnsupportedOperationException("No Solver for this GameType defined.");
@ -116,7 +142,7 @@ public class GameController {
cell.deleteNotes(); cell.deleteNotes();
cell.setValue(value); cell.setValue(value);
if(settings.getEnableAutomaticNoteDeletion()) { if(settings != null && settings.getBoolean("pref_automatic_note_deletion",true)) {
LinkedList<GameCell> updateList = new LinkedList<GameCell>(); LinkedList<GameCell> updateList = new LinkedList<GameCell>();
updateList.addAll(gameField.getRow(cell.getRow())); updateList.addAll(gameField.getRow(cell.getRow()));
updateList.addAll(gameField.getColumn(cell.getCol())); updateList.addAll(gameField.getColumn(cell.getCol()));
@ -126,7 +152,7 @@ public class GameController {
} }
} }
public LinkedList<GameCell> getConnectedCells(int row, int col, boolean connectedSec, boolean connectedRow, boolean connectedCol) { public LinkedList<GameCell> getConnectedCells(int row, int col, boolean connectedRow, boolean connectedCol, boolean connectedSec) {
LinkedList<GameCell> list = new LinkedList<>(); LinkedList<GameCell> list = new LinkedList<>();
if(connectedRow) list.addAll(gameField.getRow(row)); if(connectedRow) list.addAll(gameField.getRow(row));

View file

@ -23,7 +23,7 @@ public class GameField implements Cloneable {
this.size = size; this.size = size;
field = new GameCell[size][size]; field = new GameCell[size][size];
initCells(null); initCells(new int[][]{{1}});
} }
public void reset() { public void reset() {
@ -58,6 +58,18 @@ public class GameField implements Cloneable {
} }
} }
public void initCells(int[] level) {
if(level.length != size*size) {
throw new IllegalArgumentException("Levelarray must have length of "+size*size+".");
}
// Initit the game field with a 1 dimension array
for(int i = 0; i < size*size; i++) {
int row = (int)Math.floor(i/size);
int col = i%size;
field[row][col] = new GameCell(row,col,size,level[i]);
}
}
public GameCell getCell(int row, int col) { public GameCell getCell(int row, int col) {
return field[row][col]; return field[row][col];
} }

View file

@ -1,5 +1,7 @@
package tu_darmstadt.sudoku.game.solver; package tu_darmstadt.sudoku.game.solver;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@ -11,11 +13,11 @@ import tu_darmstadt.sudoku.game.ICellAction;
/** /**
* Created by Chris on 10.11.2015. * Created by Chris on 10.11.2015.
*/ */
public class Default9x9Solver implements ISolver { public class Solver implements ISolver {
private GameField gameField = null; private GameField gameField = null;
public Default9x9Solver(GameField gf) { public Solver(GameField gf) {
try { try {
if(gf == null) { if(gf == null) {
throw new IllegalArgumentException("GameField may not be null."); throw new IllegalArgumentException("GameField may not be null.");
@ -31,6 +33,17 @@ public class Default9x9Solver implements ISolver {
throw new IllegalArgumentException("This GameField is not solveable."); throw new IllegalArgumentException("This GameField is not solveable.");
} }
setNotes(gameField);
}
public void setNotes(GameField gameField) {
for(int i = 0; i < gameField.getSize(); i++) {
for(int j = 0; j < gameField.getSize(); j++) {
for(int k = 0; k < gameField.getSize(); k++) {
gameField.getCell(i,j).setNote(k);
}
}
}
} }
public boolean isSolvable(GameField gameField) { public boolean isSolvable(GameField gameField) {
@ -110,6 +123,69 @@ public class Default9x9Solver implements ISolver {
return false; return false;
} }
private boolean searchHiddenSingles() {
boolean foundHiddenSingles = false;
LinkedList<GameCell> list = new LinkedList<>();
for(int i = 0; i < gameField.getSize()*3; i++) {
int index = i % gameField.getSize();
int listSelector = (int)Math.floor(i / gameField.getSize());
if(listSelector == 0) list = gameField.getRow(index);
if(listSelector == 1) list = gameField.getColumn(index);
if(listSelector == 2) list = gameField.getSection(index);
LinkedList<Integer[]> possibles = new LinkedList<>();
LinkedList<Integer> notPossibles = new LinkedList<Integer>();
for(GameCell c : list) { // check all gameCells in Row
if(c.hasValue()) {
notPossibles.add(c.getValue());
continue;
}
for(int k = 0; k < gameField.getSize(); k++) { // check all nodes
if(c.getNotes()[k]) { // if k note active
for(int p = 0; p < possibles.size(); p++) { // check possible list
if(possibles.get(p)[2] == k+1) { // is value in possible list?
// value already exists in possible list
// add to impossibles
if(!notPossibles.contains(k+1)) {
notPossibles.add(k + 1);
}
}
}
if(!notPossibles.contains(k+1)){ // if k node is possible
possibles.add(new Integer[] {c.getRow(), c.getCol(), k+1});
}
}
}
}
// we checked a section/row/column
// now set the remaining possibles that are not impossible
boolean possible = true;
for(int p = 0; p < possibles.size(); p++) {
possible = true;
for(int np = 0; np < notPossibles.size(); np++) {
if(possibles.get(p)[2] == notPossibles.get(np)) {
// found that current possible is impossible
possible = false;
}
}
// if this is still possible then SET IT :D YAY
if(possible) {
gameField.getCell(possibles.get(p)[0],possibles.get(p)[1]).setValue(possibles.get(p)[2]);
foundHiddenSingles = true;
}
}
}
return foundHiddenSingles;
}
public boolean searchNakedPairsTriples() { public boolean searchNakedPairsTriples() {
return false; return false;
} }
@ -145,9 +221,5 @@ public class Default9x9Solver implements ISolver {
}}, false); }}, false);
} }
private boolean searchHiddenSingles() {
return false;
}
} }

View file

@ -0,0 +1,35 @@
package tu_darmstadt.sudoku.ui;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MenuItem;
import tu_darmstadt.sudoku.ui.view.R;
public class AboutActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
android.support.v7.app.ActionBar actionBar = getSupportActionBar();
actionBar.setTitle(R.string.about);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#024265")));
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
// Respond to the action bar's Up/Home button
case android.R.id.home:
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
}

View file

@ -1,4 +1,4 @@
package tu_darmstadt.sudoku.view; package tu_darmstadt.sudoku.ui;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.os.Bundle; import android.os.Bundle;

View file

@ -1,8 +1,9 @@
package tu_darmstadt.sudoku.view; package tu_darmstadt.sudoku.ui;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import android.preference.PreferenceManager;
import android.support.design.widget.NavigationView; import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat; import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout; import android.support.v4.widget.DrawerLayout;
@ -11,26 +12,31 @@ import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.ViewGroup;
import tu_darmstadt.sudoku.controller.GameController; import tu_darmstadt.sudoku.controller.GameController;
import tu_darmstadt.sudoku.game.*; import tu_darmstadt.sudoku.game.*;
import tu_darmstadt.sudoku.ui.view.R;
import tu_darmstadt.sudoku.ui.view.SudokuFieldLayout;
public class GameActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { public class GameActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
GameController gameController = new GameController(GameType.Default_9x9); GameController gameController;
SudokuFieldLayout layout; SudokuFieldLayout layout;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
setContentView(R.layout.activity_game_view); setContentView(R.layout.activity_game_view);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
layout = (SudokuFieldLayout)findViewById(R.id.sudokuLayout); layout = (SudokuFieldLayout)findViewById(R.id.sudokuLayout);
gameController = new GameController(GameType.Default_9x9, sharedPref);
layout.setGame(gameController); layout.setGame(gameController);
layout.setSettings(sharedPref);
/* /*
// DEBUG // DEBUG
String debug = gameController.getFieldAsString(); String debug = gameController.getFieldAsString();
@ -75,8 +81,11 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
if (id == R.id.nav_newgame) { if (id == R.id.nav_newgame) {
//create new game //create new game
//intent = new Intent(this, NewGameActivity.class);
//startActivity(intent);
} else if (id == R.id.nav_mainmenu) { } else if (id == R.id.nav_mainmenu) {
//new Game //go to main menu
intent = new Intent(this, MainActivity.class); intent = new Intent(this, MainActivity.class);
startActivity(intent); startActivity(intent);
@ -85,15 +94,19 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
intent = new Intent(this,SettingsActivity.class); intent = new Intent(this,SettingsActivity.class);
startActivity(intent); startActivity(intent);
} else if (id == R.id.nav_highscore) { } else if (id == R.id.nav_highscore) {
//open highscore // see highscore list
//intent = new Intent(this, HighscoreActivity.class);
// } else if (id == R.id.nav_share) { //startActivity(intent);
// } else if (id == R.id.nav_send) {
} else if (id == R.id.nav_about) {
//open about page
intent = new Intent(this,AboutActivity.class);
startActivity(intent);
} else if (id == R.id.nav_help) {
//open about page
//intent = new Intent(this,HelpActivity.class);
//startActivity(intent);
} }
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);

View file

@ -1,10 +1,11 @@
package tu_darmstadt.sudoku.view; package tu_darmstadt.sudoku.ui;
import android.content.Intent; import android.content.Intent;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.widget.TextView;
import tu_darmstadt.sudoku.ui.view.R;
public class MainActivity extends AppCompatActivity { public class MainActivity extends AppCompatActivity {

View file

@ -1,4 +1,4 @@
package tu_darmstadt.sudoku.view; package tu_darmstadt.sudoku.ui;
import android.annotation.TargetApi; import android.annotation.TargetApi;
@ -19,9 +19,8 @@ import android.preference.PreferenceManager;
import android.preference.RingtonePreference; import android.preference.RingtonePreference;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.MenuItem; import android.view.MenuItem;
import android.support.v4.app.NavUtils;
import tu_darmstadt.sudoku.view.R; import tu_darmstadt.sudoku.ui.view.R;
import java.util.List; import java.util.List;
@ -59,7 +58,8 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
int id = item.getItemId(); int id = item.getItemId();
if (id == android.R.id.home) { if (id == android.R.id.home) {
if (!super.onMenuItemSelected(featureId, item)) { if (!super.onMenuItemSelected(featureId, item)) {
NavUtils.navigateUpFromSameTask(this); finish();
//NavUtils.navigateUpFromSameTask(this);
} }
return true; return true;
} }
@ -114,28 +114,6 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
? listPreference.getEntries()[index] ? listPreference.getEntries()[index]
: null); : null);
} else if (preference instanceof RingtonePreference) {
// For ringtone preferences, look up the correct display value
// using RingtoneManager.
if (TextUtils.isEmpty(stringValue)) {
// Empty values correspond to 'silent' (no ringtone).
preference.setSummary(R.string.pref_ringtone_silent);
} else {
Ringtone ringtone = RingtoneManager.getRingtone(
preference.getContext(), Uri.parse(stringValue));
if (ringtone == null) {
// Clear the summary if there was a lookup error.
preference.setSummary(null);
} else {
// Set the summary to reflect the new ringtone display
// name.
String name = ringtone.getTitle(preference.getContext());
preference.setSummary(name);
}
}
} else { } else {
// For all other preferences, set the summary to the value's // For all other preferences, set the summary to the value's
// simple string representation. // simple string representation.
@ -172,9 +150,8 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
*/ */
protected boolean isValidFragment(String fragmentName) { protected boolean isValidFragment(String fragmentName) {
return PreferenceFragment.class.getName().equals(fragmentName) return PreferenceFragment.class.getName().equals(fragmentName)
|| GeneralPreferenceFragment.class.getName().equals(fragmentName) || GamePreferenceFragment.class.getName().equals(fragmentName)
|| DataSyncPreferenceFragment.class.getName().equals(fragmentName) || HighlightingPreferenceFragment.class.getName().equals(fragmentName);
|| NotificationPreferenceFragment.class.getName().equals(fragmentName);
} }
/** /**
@ -182,7 +159,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
* activity is showing a two-pane settings UI. * activity is showing a two-pane settings UI.
*/ */
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static class GeneralPreferenceFragment extends PreferenceFragment { public static class GamePreferenceFragment extends PreferenceFragment {
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -193,8 +170,9 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
// to their values. When their values change, their summaries are // to their values. When their values change, their summaries are
// updated to reflect the new value, per the Android Design // updated to reflect the new value, per the Android Design
// guidelines. // guidelines.
bindPreferenceSummaryToValue(findPreference("example_text"));
bindPreferenceSummaryToValue(findPreference("example_list")); //bindPreferenceSummaryToValue(findPreference("example_text"));
//bindPreferenceSummaryToValue(findPreference("example_list"));
} }
@ -202,7 +180,8 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId(); int id = item.getItemId();
if (id == android.R.id.home) { if (id == android.R.id.home) {
startActivity(new Intent(getActivity(), SettingsActivity.class)); getActivity().finish();
//startActivity(new Intent(getActivity(), SettingsActivity.class));
return true; return true;
} }
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
@ -214,64 +193,9 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
* activity is showing a two-pane settings UI. * activity is showing a two-pane settings UI.
*/ */
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static class NotificationPreferenceFragment extends PreferenceFragment { public static class HighlightingPreferenceFragment extends PreferenceFragment {
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_notification);
setHasOptionsMenu(true);
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
// to their values. When their values change, their summaries are
// updated to reflect the new value, per the Android Design
// guidelines.
bindPreferenceSummaryToValue(findPreference("notifications_new_message_ringtone"));
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
startActivity(new Intent(getActivity(), SettingsActivity.class));
return true;
}
return super.onOptionsItemSelected(item);
}
}
/**
* This fragment shows data and sync preferences only. It is used when the
* activity is showing a two-pane settings UI.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static class DataSyncPreferenceFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_data_sync);
setHasOptionsMenu(true);
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
// to their values. When their values change, their summaries are
// updated to reflect the new value, per the Android Design
// guidelines.
bindPreferenceSummaryToValue(findPreference("sync_frequency"));
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
startActivity(new Intent(getActivity(), SettingsActivity.class));
return true;
}
return super.onOptionsItemSelected(item);
}
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static class TestFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_highlighting); addPreferencesFromResource(R.xml.pref_highlighting);
setHasOptionsMenu(true); setHasOptionsMenu(true);
@ -280,18 +204,21 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
// to their values. When their values change, their summaries are // to their values. When their values change, their summaries are
// updated to reflect the new value, per the Android Design // updated to reflect the new value, per the Android Design
// guidelines. // guidelines.
//bindPreferenceSummaryToValue(findPreference(""));
//bindPreferenceSummaryToValue(findPreference("highlighting_connected_rows"));
//bindPreferenceSummaryToValue(findPreference("highlighting_connected_columns"));
//bindPreferenceSummaryToValue(findPreference("highlighting_connected_sections"));
} }
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId(); int id = item.getItemId();
if (id == android.R.id.home) { if (id == android.R.id.home) {
startActivity(new Intent(getActivity(), SettingsActivity.class)); getActivity().finish();
//startActivity(new Intent(getActivity(), SettingsActivity.class));
return true; return true;
} }
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
} }
} }

View file

@ -1,4 +1,4 @@
package tu_darmstadt.sudoku.view.highlighting; package tu_darmstadt.sudoku.ui.view;
/** /**
* Created by Chris on 12.11.2015. * Created by Chris on 12.11.2015.

View file

@ -1,4 +1,4 @@
package tu_darmstadt.sudoku.view; package tu_darmstadt.sudoku.ui.view;
import android.content.Context; import android.content.Context;
import android.graphics.Canvas; import android.graphics.Canvas;
@ -7,16 +7,10 @@ import android.graphics.Paint;
import android.graphics.RectF; import android.graphics.RectF;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import java.util.jar.Attributes;
import tu_darmstadt.sudoku.game.GameCell; import tu_darmstadt.sudoku.game.GameCell;
import tu_darmstadt.sudoku.view.highlighting.CellHighlightTypes;
/** /**
* Created by TMZ_LToP on 10.11.2015. * Created by TMZ_LToP on 10.11.2015.
@ -98,7 +92,10 @@ public class SudokuCellView extends View {
p.setColor(Color.GREEN); p.setColor(Color.GREEN);
break; break;
case Connected: case Connected:
p.setColor(Color.argb(55, 255, 255, 0)); p.setColor(Color.WHITE);
drawBackground(canvas, 3, 3, mWidth - 3, mHeight - 3, p);
p.setColor(Color.YELLOW);
p.setAlpha(100);
break; break;
case Highlighted: case Highlighted:
p.setColor(Color.YELLOW); p.setColor(Color.YELLOW);
@ -128,9 +125,9 @@ public class SudokuCellView extends View {
for (int i = 0; i < mGameCell.getNotes().length; i++) { for (int i = 0; i < mGameCell.getNotes().length; i++) {
if (mGameCell.getNotes()[i]) { if (mGameCell.getNotes()[i]) {
p.setTypeface(Typeface.SANS_SERIF); p.setTypeface(Typeface.SANS_SERIF);
p.setTextSize(mWidth * 3 / 12); p.setTextSize(mWidth/4);
p.setTextAlign(Paint.Align.RIGHT); p.setTextAlign(Paint.Align.RIGHT);
canvas.drawText(String.valueOf(i+1),(mWidth*1/12)*k,(mWidth*1/12)*j,p); canvas.drawText(String.valueOf(i+1),(mWidth/12)*k,(mWidth/12)*j,p);
k+=4; k+=4;
if (k > 11) { if (k > 11) {
k = 3; k = 3;
@ -151,7 +148,7 @@ public class SudokuCellView extends View {
p.setAntiAlias(true); p.setAntiAlias(true);
p.setTextSize(Math.min(mHeight * 3 / 4, mHeight * 3 / 4)); p.setTextSize(Math.min(mHeight * 3 / 4, mHeight * 3 / 4));
p.setTextAlign(Paint.Align.CENTER); p.setTextAlign(Paint.Align.CENTER);
canvas.drawText(String.valueOf(mGameCell.getValue()), mHeight/2, mHeight/2 + mHeight/4, p); canvas.drawText(String.valueOf(mGameCell.getValue()), mHeight / 2, mHeight / 2 + mHeight / 4, p);
} }
public int getRow() { public int getRow() {
@ -160,4 +157,11 @@ public class SudokuCellView extends View {
public int getCol() { public int getCol() {
return mCol; return mCol;
} }
/*@Override
public Parcelable onSaveInstanceState() {
Parcelable state = super.onSaveInstanceState();
return state;
}*/
} }

View file

@ -1,6 +1,7 @@
package tu_darmstadt.sudoku.view; package tu_darmstadt.sudoku.ui.view;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Paint; import android.graphics.Paint;
@ -9,12 +10,8 @@ import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import java.util.List;
import tu_darmstadt.sudoku.controller.GameController; import tu_darmstadt.sudoku.controller.GameController;
import tu_darmstadt.sudoku.game.GameCell; import tu_darmstadt.sudoku.game.GameCell;
import tu_darmstadt.sudoku.game.GameSettings;
import tu_darmstadt.sudoku.view.highlighting.CellHighlightTypes;
/** /**
* Created by Timm Lippert on 11.11.2015. * Created by Timm Lippert on 11.11.2015.
@ -26,6 +23,7 @@ public class SudokuFieldLayout extends RelativeLayout {
private int sectionWidth; private int sectionWidth;
private int gameCellWidth; private int gameCellWidth;
private int gameCellHeight; private int gameCellHeight;
private SharedPreferences settings;
public SudokuCellView [][] gamecells; public SudokuCellView [][] gamecells;
AttributeSet attrs; AttributeSet attrs;
@ -36,6 +34,10 @@ public class SudokuFieldLayout extends RelativeLayout {
setBackgroundColor(Color.argb(255, 200, 200, 200)); setBackgroundColor(Color.argb(255, 200, 200, 200));
} }
public void setSettings(SharedPreferences sharedPref) {
settings = sharedPref;
}
public void setGame(GameController gc) { public void setGame(GameController gc) {
if (gc == null) throw new IllegalArgumentException("GameController may not be null."); if (gc == null) throw new IllegalArgumentException("GameController may not be null.");
gameController = gc; gameController = gc;
@ -58,7 +60,13 @@ public class SudokuFieldLayout extends RelativeLayout {
} }
} }
// Set connected Fields // Set connected Fields
for(GameCell c : gameController.getConnectedCells(row,col, GameSettings.getHighlightConnectedRow(), GameSettings.getHighlightConnectedColumn(), GameSettings.getHighlightConnectedSection())) {
//String syncConnPref = sharedPref.getString(SettingsActivity., "");
boolean highlightConnectedRow = settings.getBoolean("pref_highlight_rows", true);
boolean highlightConnectedColumn = settings.getBoolean("pref_highlight_cols", true);
boolean highlightConnectedSection = settings.getBoolean("pref_highlight_secs", true);
for(GameCell c : gameController.getConnectedCells(row,col, highlightConnectedRow, highlightConnectedColumn, highlightConnectedSection)) {
gamecells[c.getRow()][c.getCol()].setHighlightType(CellHighlightTypes.Connected); gamecells[c.getRow()][c.getCol()].setHighlightType(CellHighlightTypes.Connected);
} }
// Select touched Cell // Select touched Cell

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View file

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".AboutActivity"
android:weightSum="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="85dp"
android:layout_weight="0.36">
<ImageView
android:id="@+id/barcodeLogo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/privacyfriendlyappslogo" />
</LinearLayout>
<TextView
android:id="@+id/appName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:text="@string/app_name_long" />
<TextView
android:id="@+id/textFieldVersion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:text="@string/version_number" />
<TextView
android:id="@+id/textFieldAuthor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:text="@string/about_author" />
<TextView
android:id="@+id/textFieldAffiliation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="40dp"
android:text="@string/about_affiliation"
android:textStyle="bold" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/secuso_logo_blau_blau" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:layout_gravity="center_horizontal"
android:text="@string/privacy_friendly"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:text="@string/more_info"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/url"
android:textStyle="bold"
android:layout_gravity="center_horizontal"
android:autoLink="web"/>
</LinearLayout>

View file

@ -5,7 +5,7 @@
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"
tools:context="tu_darmstadt.sudoku.view.MainActivity"> tools:context="tu_darmstadt.sudoku.activity.MainActivity">
<TextView android:id="@+id/testString" <TextView android:id="@+id/testString"
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -4,7 +4,7 @@
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:layout_width="match_parent" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:fitsSystemWindows="true" android:layout_height="match_parent" android:fitsSystemWindows="true"
tools:context="tu_darmstadt.sudoku.view.GameActivity"> tools:context="tu_darmstadt.sudoku.activity.GameActivity">
<android.support.design.widget.AppBarLayout android:layout_height="wrap_content" <android.support.design.widget.AppBarLayout android:layout_height="wrap_content"
android:layout_width="match_parent" android:theme="@style/AppTheme.AppBarOverlay"> android:layout_width="match_parent" android:theme="@style/AppTheme.AppBarOverlay">

View file

@ -9,8 +9,8 @@
android:paddingTop="@dimen/activity_vertical_margin" android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior" app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/app_bar_game_view" tools:context="tu_darmstadt.sudoku.view.GameActivity"> tools:showIn="@layout/app_bar_game_view" tools:context="tu_darmstadt.sudoku.activity.GameActivity">
<tu_darmstadt.sudoku.view.SudokuFieldLayout <tu_darmstadt.sudoku.ui.view.SudokuFieldLayout
android:id="@+id/sudokuLayout" android:id="@+id/sudokuLayout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -14,10 +14,10 @@
android:src="@android:drawable/sym_def_app_icon" android:id="@+id/imageView" /> android:src="@android:drawable/sym_def_app_icon" android:id="@+id/imageView" />
<TextView android:layout_width="match_parent" android:layout_height="wrap_content" <TextView android:layout_width="match_parent" android:layout_height="wrap_content"
android:paddingTop="@dimen/nav_header_vertical_spacing" android:text="Android Studio" android:paddingTop="@dimen/nav_header_vertical_spacing" android:text="Sudoku"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" /> android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="android.studio@android.com" android:id="@+id/textView" /> android:text="@string/description" android:id="@+id/textView" />
</LinearLayout> </LinearLayout>

View file

@ -2,23 +2,22 @@
<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:checkableBehavior="single">
<item android:id="@+id/nav_newgame" android:icon="@android:drawable/ic_menu_camera" <item android:id="@+id/nav_newgame" android:icon="@android:drawable/ic_menu_today"
android:title="@string/new_game" /> android:title="@string/new_game" />
<item android:id="@+id/nav_mainmenu" android:icon="@android:drawable/ic_menu_gallery" <item android:id="@+id/nav_mainmenu" android:icon="@android:drawable/ic_menu_gallery"
android:title="@string/mainmenu" /> android:title="@string/mainmenu" />
<item android:id="@+id/nav_settings" android:icon="@android:drawable/ic_menu_slideshow" <item android:id="@+id/nav_highscore" android:icon="@android:drawable/ic_menu_myplaces"
android:title="@string/settings" />
<item android:id="@+id/nav_highscore" android:icon="@android:drawable/ic_menu_manage"
android:title="@string/highscore" /> android:title="@string/highscore" />
</group> </group>
<group android:menuCategory="container" android:title="">
<item android:title="@string/group">
<menu> <menu>
<item android:id="@+id/nav_share" android:icon="@android:drawable/ic_menu_share" <item android:id="@+id/nav_settings" android:icon="@android:drawable/ic_menu_manage"
android:title="@string/settings" />
<item android:id="@+id/nav_help" android:icon="@android:drawable/ic_menu_help"
android:title="@string/help" /> android:title="@string/help" />
<item android:id="@+id/nav_send" android:icon="@android:drawable/ic_menu_send" <item android:id="@+id/nav_about" android:icon="@android:drawable/ic_menu_info_details"
android:title="@string/about" /> android:title="@string/about" />
</menu> </menu>
</item> </group>
</menu> </menu>

View file

@ -17,7 +17,13 @@
<string name="action_settings">Einstellungen</string> <string name="action_settings">Einstellungen</string>
<!-- Strings related to Highlight --> <!-- Strings related to Highlight -->
<string name="pref_highlighting_selection">Auswahl</string> <string name="pref_highlighting_selection">Feld Auswahl</string>
<string name="pref_highlighting_selection_values">Werte</string> <string name="pref_highlighting_selection_values">Werte</string>
<!-- About Page -->
<string name="privacy_friendly">Diese App gehört zur Gruppe der Privacy Friendly Apps.</string>
<string name="more_info">Mehr Informationen unter:</string>
<string name="about_affiliation">In Zusammenarbeit mit:</string>
<string name="about_author">Autor: \nChristopher Beckmann, Timm Lippert</string>
</resources> </resources>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="colorPrimary">#3F51B5</color> <color name="colorPrimary">#024265</color>
<color name="colorPrimaryDark">#303F9F</color> <color name="colorPrimaryDark">#024265</color>
<color name="colorAccent">#FF4081</color> <color name="colorAccent">#FF4081</color>
</resources> </resources>

View file

@ -2,7 +2,7 @@
<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>
<!-- Strings related to Menu --> <!-- ###MAIN MENU### -->
<string name="new_game">New Game</string> <string name="new_game">New Game</string>
<string name="settings">Settings</string> <string name="settings">Settings</string>
<string name="highscore">Highscore</string> <string name="highscore">Highscore</string>
@ -11,31 +11,49 @@
<string name="help">Help</string> <string name="help">Help</string>
<string name="about">About</string> <string name="about">About</string>
<string name="description">a privacy friendly logic puzzle</string>
<string name="navigation_drawer_open">Open navigation drawer</string> <string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string> <string name="navigation_drawer_close">Close navigation drawer</string>
<!-- Strings related to Settings --> <!-- ###SETTINGS### -->
<string name="title_activity_settings">Settings</string> <string name="title_activity_settings">Settings</string>
<string name="action_settings">Settings</string> <string name="action_settings">Settings</string>
<!-- #Highlight -->
<string name="pref_header_highlight">Highlighting</string>
<!-- Strings related to Highlight --> <string name="pref_group_highlight_selection">Selection highlight</string>
<string name="pref_highlighting_selection">Selection</string> <string name="pref_highlight_rows">Connected rows</string>
<string name="pref_highlighting_selection_values">Values</string> <string name="pref_highlight_cols">Connected columns</string>
<string name="pref_highlight_secs">Connected sections</string>
<string name="pref_group_highlight_value">Value highlight</string>
<string name="pref_highlight_vals">Same values</string>
<string name="pref_highlight_notes">Notes</string>
<!-- #Game -->
<string name="pref_header_game">Game</string>
<string name="pref_group_game">Game settings</string>
<string name="pref_automatic_note_deletion">Note deletion</string>
<string name="pref_automatic_note_deletion_summary">Automatically remove notes when setting values on connected cells</string>
<!-- Example General settings --> <!-- ###ABOUT### -->
<string name="pref_header_general">General</string> <string name="app_name_long">Privacy friendly Sudoku</string>
<string name="version_number">v0.1</string>
<string name="about_author">Author: Christopher Beckmann, Timm Lippert</string>
<string name="about_affiliation">In affiliation with:</string>
<string name="privacy_friendly">This application belongs to the Privacy Friendly Apps.</string>
<string name="more_info">More information can be found on:</string>
<string name="url"><a href="https://www.secuso.informatik.tu-darmstadt.de/en/research/results/">https://www.secuso.org</a></string>
<string name="pref_title_social_recommendations">Enable social recommendations</string>
<string name="pref_description_social_recommendations">Recommendations for people to contact
based on your message history
</string>
<string name="pref_title_display_name">Display DeineMudda</string> <!-- end of valid settings -->
<string name="pref_default_display_name">Anonymous</string>
<string name="pref_title_add_friends_to_messages">Add friends to messages</string>
<!-- <string name="pref_title_add_friends_to_messages">Add friends to messages</string>
<string-array name="pref_example_list_titles"> <string-array name="pref_example_list_titles">
<item>Always</item> <item>Always</item>
<item>When possible</item> <item>When possible</item>
@ -47,9 +65,6 @@
<item>-1</item> <item>-1</item>
</string-array> </string-array>
<!-- Example settings for Data & Sync -->
<string name="pref_header_data_sync">Data &amp; sync</string>
<string name="pref_title_sync_frequency">Sync frequency</string> <string name="pref_title_sync_frequency">Sync frequency</string>
<string-array name="pref_sync_frequency_titles"> <string-array name="pref_sync_frequency_titles">
<item>15 minutes</item> <item>15 minutes</item>
@ -66,17 +81,5 @@
<item>180</item> <item>180</item>
<item>360</item> <item>360</item>
<item>-1</item> <item>-1</item>
</string-array> </string-array> -->
<string name="pref_title_system_sync_settings">System sync settings</string>
<!-- Example settings for Notifications -->
<string name="pref_header_notifications">Notifications</string>
<string name="pref_title_new_message_notifications">New message notifications</string>
<string name="pref_title_ringtone">Ringtone</string>
<string name="pref_ringtone_silent">Silent</string>
<string name="pref_title_vibrate">Vibrate</string>
</resources> </resources>

View file

@ -1,21 +0,0 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<!-- NOTE: Hide buttons to simplify the UI. Users can touch outside the dialog to
dismiss it. -->
<!-- NOTE: ListPreference's summary should be set to its value by the activity code. -->
<ListPreference
android:key="sync_frequency"
android:title="@string/pref_title_sync_frequency"
android:entries="@array/pref_sync_frequency_titles"
android:entryValues="@array/pref_sync_frequency_values"
android:defaultValue="180"
android:negativeButtonText="@null"
android:positiveButtonText="@null" />
<!-- This preference simply launches an intent when selected. Use this UI sparingly, per
design guidelines. -->
<Preference android:title="@string/pref_title_system_sync_settings">
<intent android:action="android.settings.SYNC_SETTINGS" />
</Preference>
</PreferenceScreen>

View file

@ -1,14 +1,16 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<SwitchPreference <PreferenceCategory android:title="@string/pref_group_game">
android:key="example_switch" <SwitchPreference android:id="@+id/pref_highlighting_selection_values"
android:title="@string/pref_title_social_recommendations" android:key="pref_automatic_note_deletion"
android:summary="@string/pref_description_social_recommendations" android:title="@string/pref_automatic_note_deletion"
android:defaultValue="true" /> android:summary="@string/pref_automatic_note_deletion_summary"
android:defaultValue="true"/>
</PreferenceCategory>
<!-- NOTE: EditTextPreference accepts EditText attributes. --> <!-- NOTE: EditTextPreference accepts EditText attributes. -->
<!-- NOTE: EditTextPreference's summary should be set to its value by the activity code. --> <!-- NOTE: EditTextPreference's summary should be set to its value by the activity code. -->
<EditTextPreference <!-- <EditTextPreference
android:key="example_text" android:key="example_text"
android:title="@string/pref_title_display_name" android:title="@string/pref_title_display_name"
android:defaultValue="@string/pref_default_display_name" android:defaultValue="@string/pref_default_display_name"
@ -16,18 +18,18 @@
android:inputType="textCapWords" android:inputType="textCapWords"
android:capitalize="words" android:capitalize="words"
android:singleLine="true" android:singleLine="true"
android:maxLines="1" /> android:maxLines="1" /> -->
<!-- NOTE: Hide buttons to simplify the UI. Users can touch outside the dialog to <!-- NOTE: Hide buttons to simplify the UI. Users can touch outside the dialog to
dismiss it. --> dismiss it. -->
<!-- NOTE: ListPreference's summary should be set to its value by the activity code. --> <!-- NOTE: ListPreference's summary should be set to its value by the activity code. -->
<ListPreference <!-- <ListPreference
android:key="example_list" android:key="example_list"
android:title="@string/pref_title_add_friends_to_messages" android:title="@string/pref_title_add_friends_to_messages"
android:defaultValue="-1" android:defaultValue="-1"
android:entries="@array/pref_example_list_titles" android:entries="@array/pref_example_list_titles"
android:entryValues="@array/pref_example_list_values" android:entryValues="@array/pref_example_list_values"
android:negativeButtonText="@null" android:negativeButtonText="@null"
android:positiveButtonText="@null" /> android:positiveButtonText="@null" /> -->
</PreferenceScreen> </PreferenceScreen>

View file

@ -2,15 +2,12 @@
<!-- These settings headers are only used on tablets. --> <!-- These settings headers are only used on tablets. -->
<header android:fragment="tu_darmstadt.sudoku.view.SettingsActivity$GeneralPreferenceFragment" <header android:fragment="tu_darmstadt.sudoku.ui.SettingsActivity$GamePreferenceFragment"
android:title="@string/pref_header_general" android:icon="@drawable/ic_info_black_24dp" /> android:title="@string/pref_header_game" android:icon="@drawable/ic_info_black_24dp" />
<header <header
android:fragment="tu_darmstadt.sudoku.view.SettingsActivity$NotificationPreferenceFragment" android:fragment="tu_darmstadt.sudoku.ui.SettingsActivity$HighlightingPreferenceFragment"
android:title="@string/pref_header_notifications" android:title="Highlighting"
android:icon="@drawable/ic_notifications_black_24dp" /> android:icon="@drawable/ic_notifications_black_24dp" />
<header android:fragment="tu_darmstadt.sudoku.view.SettingsActivity$DataSyncPreferenceFragment"
android:title="@string/pref_header_data_sync" android:icon="@drawable/ic_sync_black_24dp" />
</preference-headers> </preference-headers>

View file

@ -1,11 +1,33 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="@string/pref_highlighting_selection"> <PreferenceCategory android:title="@string/pref_group_highlight_selection">
<SwitchPreference android:id="@+id/pref_highlighting_selection_values" <SwitchPreference android:id="@+id/pref_highlight_rows"
android:key="example_switch" android:key="pref_highlight_rows"
android:title="@string/pref_title_social_recommendations" android:title="@string/pref_highlight_rows"
android:summary="@string/pref_description_social_recommendations" android:summary=""
android:defaultValue="true"/>
<SwitchPreference android:id="@+id/pref_highlight_cols"
android:key="pref_highlight_cols"
android:title="@string/pref_highlight_cols"
android:summary=""
android:defaultValue="true"/>
<SwitchPreference android:id="@+id/pref_highlight_secs"
android:key="pref_highlight_secs"
android:title="@string/pref_highlight_secs"
android:summary=""
android:defaultValue="true"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_group_highlight_value">
<SwitchPreference android:id="@+id/pref_highlight_vals"
android:key="pref_highlight_vals"
android:title="@string/pref_highlight_vals"
android:summary="not implemented yet"
android:defaultValue="true"/>
<SwitchPreference android:id="@+id/pref_highlight_notes"
android:key="pref_highlight_notes"
android:title="@string/pref_highlight_notes"
android:summary="not implemented yet"
android:defaultValue="true"/> android:defaultValue="true"/>
</PreferenceCategory> </PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>

View file

@ -1,27 +0,0 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<!-- A 'parent' preference, which enables/disables child preferences (below)
when checked/unchecked. -->
<SwitchPreference
android:key="notifications_new_message"
android:title="@string/pref_title_new_message_notifications"
android:defaultValue="true" />
<!-- Allows the user to choose a ringtone in the 'notification' category. -->
<!-- NOTE: This preference will be enabled only when the checkbox above is checked. -->
<!-- NOTE: RingtonePreference's summary should be set to its value by the activity code. -->
<RingtonePreference
android:dependency="notifications_new_message"
android:key="notifications_new_message_ringtone"
android:title="@string/pref_title_ringtone"
android:ringtoneType="notification"
android:defaultValue="content://settings/system/notification_sound" />
<!-- NOTE: This preference will be enabled only when the checkbox above is checked. -->
<SwitchPreference
android:dependency="notifications_new_message"
android:key="notifications_new_message_vibrate"
android:title="@string/pref_title_vibrate"
android:defaultValue="true" />
</PreferenceScreen>

View file

@ -1,4 +1,4 @@
package tu_darmstadt.sudoku.view; package tu_darmstadt.sudoku.ui.view;
import org.junit.Test; import org.junit.Test;

View file

@ -28,6 +28,10 @@ public class SolverTest {
{ 7, 0, 0, 0, 1, 0, 3, 0, 5 }}; { 7, 0, 0, 0, 1, 0, 3, 0, 5 }};
} }
//000041000060000200000000000320600000000050041700000000000200300048000000501000000
//501900000200004950390700026030001072006057000072009041000070409640000000700010305
@Test @Test
public void solveTest() { public void solveTest() {
} }