Symbol Map selectable in settings.
This commit is contained in:
parent
0d4a222cfc
commit
29028c39f5
8 changed files with 90 additions and 30 deletions
|
@ -22,6 +22,7 @@ import java.util.List;
|
||||||
import tu_darmstadt.sudoku.controller.GameStateManager;
|
import tu_darmstadt.sudoku.controller.GameStateManager;
|
||||||
import tu_darmstadt.sudoku.controller.GameController;
|
import tu_darmstadt.sudoku.controller.GameController;
|
||||||
import tu_darmstadt.sudoku.controller.SaveLoadStatistics;
|
import tu_darmstadt.sudoku.controller.SaveLoadStatistics;
|
||||||
|
import tu_darmstadt.sudoku.controller.Symbol;
|
||||||
import tu_darmstadt.sudoku.controller.helper.GameInfoContainer;
|
import tu_darmstadt.sudoku.controller.helper.GameInfoContainer;
|
||||||
import tu_darmstadt.sudoku.game.GameDifficulty;
|
import tu_darmstadt.sudoku.game.GameDifficulty;
|
||||||
import tu_darmstadt.sudoku.game.GameType;
|
import tu_darmstadt.sudoku.game.GameType;
|
||||||
|
@ -154,6 +155,11 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
||||||
if(!gameSolved) {
|
if(!gameSolved) {
|
||||||
gameController.startTimer();
|
gameController.startTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
Symbol s = Symbol.valueOf(Symbol.class, sharedPref.getString("pref_symbols", "Default"));
|
||||||
|
layout.setSymbols(s);
|
||||||
|
keyboard.setSymbols(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,10 @@ public class SudokuCellView extends View {
|
||||||
this.size = size;
|
this.size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSymbols(Symbol s) {
|
||||||
|
symbolsToUse = s;
|
||||||
|
}
|
||||||
|
|
||||||
public void setHighlightType(CellHighlightTypes highlightType) {
|
public void setHighlightType(CellHighlightTypes highlightType) {
|
||||||
this.highlightType = highlightType;
|
this.highlightType = highlightType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import android.widget.RelativeLayout;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
import tu_darmstadt.sudoku.controller.GameController;
|
import tu_darmstadt.sudoku.controller.GameController;
|
||||||
|
import tu_darmstadt.sudoku.controller.Symbol;
|
||||||
import tu_darmstadt.sudoku.game.GameCell;
|
import tu_darmstadt.sudoku.game.GameCell;
|
||||||
import tu_darmstadt.sudoku.game.ICellAction;
|
import tu_darmstadt.sudoku.game.ICellAction;
|
||||||
import tu_darmstadt.sudoku.game.listener.IHighlightChangedListener;
|
import tu_darmstadt.sudoku.game.listener.IHighlightChangedListener;
|
||||||
|
@ -103,6 +104,14 @@ public class SudokuFieldLayout extends RelativeLayout implements IHighlightChang
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSymbols(Symbol s) {
|
||||||
|
for(int i = 0; i < gamecells.length ; i++) {
|
||||||
|
for(int j = 0; j < gamecells[i].length; j++) {
|
||||||
|
gamecells[i][j].setSymbols(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||||
super.onLayout(changed,l,t,r,b);
|
super.onLayout(changed,l,t,r,b);
|
||||||
|
|
|
@ -44,14 +44,22 @@ public class SudokuKeyboardLayout extends GridLayout implements IHighlightChange
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSymbols(Symbol s) {
|
||||||
|
symbolsToUse = s;
|
||||||
|
for(SudokuButton b : buttons) {
|
||||||
|
b.setText(Symbol.getSymbol(symbolsToUse, b.getValue()-1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setKeyBoard(int size,int width, int height) {
|
public void setKeyBoard(int size,int width, int height) {
|
||||||
LayoutParams p ;
|
LayoutParams p ;
|
||||||
buttons = new SudokuButton[size];
|
buttons = new SudokuButton[size];
|
||||||
int number = 0;
|
int number = 0;
|
||||||
int torun = ((size)%2==0) ? (size)/2 :(size+1)/2 ;
|
int torun = (size % 2 == 0) ? size/2 :(size+1)/2 ;
|
||||||
int realSize = torun;
|
int realSize = torun;
|
||||||
|
|
||||||
int width2 =(width-(realSize*30))/(realSize);
|
//int width2 =(width-(realSize*30))/(realSize);
|
||||||
|
|
||||||
for (int k = 0; k<2;k++){
|
for (int k = 0; k<2;k++){
|
||||||
for (int i = 0; i< torun; i++){
|
for (int i = 0; i< torun; i++){
|
||||||
if (number == size) {
|
if (number == size) {
|
||||||
|
@ -65,8 +73,8 @@ public class SudokuKeyboardLayout extends GridLayout implements IHighlightChange
|
||||||
|
|
||||||
//p = new LayoutParams(rowSpec,colSpec);
|
//p = new LayoutParams(rowSpec,colSpec);
|
||||||
p.setMargins((i == 0) ? 0 : 5,5,5,5);
|
p.setMargins((i == 0) ? 0 : 5,5,5,5);
|
||||||
p.width= (width-(int)((getResources().getDimension(R.dimen.activity_horizontal_margin))*2))/realSize;
|
p.width = (width - (int)((getResources().getDimension(R.dimen.activity_horizontal_margin))*2)) / realSize;
|
||||||
p.width= p.width-10;
|
p.width = p.width - 10;
|
||||||
p.setGravity(LayoutParams.WRAP_CONTENT);
|
p.setGravity(LayoutParams.WRAP_CONTENT);
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,10 +107,13 @@ public class SudokuKeyboardLayout extends GridLayout implements IHighlightChange
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateNotesEnabled() {
|
public void updateNotesEnabled() {
|
||||||
if (normalTextSize == 0) {normalTextSize = buttons[0].getTextSize();}
|
if (normalTextSize == 0) {
|
||||||
|
normalTextSize = buttons[0].getTextSize();
|
||||||
|
}
|
||||||
|
|
||||||
if(gameController.getNoteStatus()) {
|
if(gameController.getNoteStatus()) {
|
||||||
setTextSize(normalTextSize*0.6f);
|
setTextSize(normalTextSize*0.6f);
|
||||||
}else {
|
} else {
|
||||||
setTextSize(normalTextSize);
|
setTextSize(normalTextSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,7 +130,6 @@ public class SudokuKeyboardLayout extends GridLayout implements IHighlightChange
|
||||||
@Override
|
@Override
|
||||||
public void onDraw(Canvas canvas) {
|
public void onDraw(Canvas canvas) {
|
||||||
super.onDraw(canvas);
|
super.onDraw(canvas);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -135,7 +135,7 @@
|
||||||
<Button
|
<Button
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="testforwinshitz"
|
android:text="Win Debug"
|
||||||
android:onClick="callFragment"/>
|
android:onClick="callFragment"/>
|
||||||
<!--
|
<!--
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -14,34 +14,39 @@
|
||||||
android:id="@+id/sudokuLayout"
|
android:id="@+id/sudokuLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:minHeight="200dp"
|
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:gravity="center" />
|
android:gravity="center" />
|
||||||
|
|
||||||
<tu_darmstadt.sudoku.ui.view.SudokuKeyboardLayout
|
<LinearLayout
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:minHeight="100dp"
|
android:layout_height="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/sudokuLayout"
|
android:layout_below="@+id/sudokuLayout"
|
||||||
android:id="@+id/sudokuKeyboardLayout"
|
android:orientation="vertical"
|
||||||
android:layout_centerVertical="true"
|
android:weightSum="3">
|
||||||
android:useDefaultMargins="true"
|
|
||||||
android:alignmentMode="alignBounds"
|
|
||||||
android:columnOrderPreserved="false"
|
|
||||||
android:columnCount="6"
|
|
||||||
android:rowCount="2"
|
|
||||||
android:alwaysDrawnWithCache="true"
|
|
||||||
android:foregroundGravity="fill_horizontal">
|
|
||||||
|
|
||||||
</tu_darmstadt.sudoku.ui.view.SudokuKeyboardLayout>
|
<tu_darmstadt.sudoku.ui.view.SudokuKeyboardLayout
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="0px"
|
||||||
|
android:id="@+id/sudokuKeyboardLayout"
|
||||||
|
android:useDefaultMargins="true"
|
||||||
|
android:alignmentMode="alignBounds"
|
||||||
|
android:columnOrderPreserved="false"
|
||||||
|
android:columnCount="6"
|
||||||
|
android:rowCount="2"
|
||||||
|
android:alwaysDrawnWithCache="true"
|
||||||
|
android:foregroundGravity="fill_horizontal"
|
||||||
|
android:layout_weight="2">
|
||||||
|
|
||||||
|
</tu_darmstadt.sudoku.ui.view.SudokuKeyboardLayout>
|
||||||
|
|
||||||
<tu_darmstadt.sudoku.ui.view.SudokuSpecialButtonLayout
|
<tu_darmstadt.sudoku.ui.view.SudokuSpecialButtonLayout
|
||||||
android:id="@+id/sudokuSpecialLayout"
|
android:id="@+id/sudokuSpecialLayout"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="0px"
|
||||||
android:layout_below="@+id/sudokuKeyboardLayout">
|
android:layout_weight="1">
|
||||||
|
|
||||||
</tu_darmstadt.sudoku.ui.view.SudokuSpecialButtonLayout>
|
</tu_darmstadt.sudoku.ui.view.SudokuSpecialButtonLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
|
@ -34,6 +34,23 @@
|
||||||
<!-- #Game -->
|
<!-- #Game -->
|
||||||
<string name="pref_header_game">Game</string>
|
<string name="pref_header_game">Game</string>
|
||||||
<string name="pref_group_game">Game settings</string>
|
<string name="pref_group_game">Game settings</string>
|
||||||
|
<string name="pref_symbols">Symbols</string>
|
||||||
|
<array name="pref_symbols_list_titles">
|
||||||
|
<item>Default 1,2,3,..</item>
|
||||||
|
<item>Roman I,II,III,..</item>
|
||||||
|
<item>Fancy ♪,♫,☼,..</item>
|
||||||
|
<item>Chinese 一,二,三,..</item>
|
||||||
|
<item>Greek α,β,γ,..</item>
|
||||||
|
<item>Indian १,२,३,..</item>
|
||||||
|
</array>
|
||||||
|
<array name="pref_symbols_list_values">
|
||||||
|
<item>Default</item>
|
||||||
|
<item>Roman</item>
|
||||||
|
<item>Fancy</item>
|
||||||
|
<item>Chinese</item>
|
||||||
|
<item>Greek</item>
|
||||||
|
<item>Indian</item>
|
||||||
|
</array>
|
||||||
<string name="pref_automatic_note_deletion">Note deletion</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>
|
<string name="pref_automatic_note_deletion_summary">Automatically remove notes when setting values on connected cells</string>
|
||||||
|
|
||||||
|
@ -81,6 +98,6 @@
|
||||||
|
|
||||||
|
|
||||||
<!--### Win Strings -->
|
<!--### Win Strings -->
|
||||||
<string name="win_text">Congratz du depp du hast gewonnen oder so was</string>
|
<string name="win_text">Congratulations, you have solved the puzzle.</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,13 +1,22 @@
|
||||||
<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_group_game">
|
<PreferenceCategory android:title="@string/pref_group_game">
|
||||||
<SwitchPreference android:id="@+id/pref_highlighting_selection_values"
|
<SwitchPreference android:id="@+id/pref_automatic_note_deletion"
|
||||||
android:key="pref_automatic_note_deletion"
|
android:key="pref_automatic_note_deletion"
|
||||||
android:title="@string/pref_automatic_note_deletion"
|
android:title="@string/pref_automatic_note_deletion"
|
||||||
android:summary="@string/pref_automatic_note_deletion_summary"
|
android:summary="@string/pref_automatic_note_deletion_summary"
|
||||||
android:defaultValue="true"/>
|
android:defaultValue="true"/>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
android:key="pref_symbols"
|
||||||
|
android:title="@string/pref_symbols"
|
||||||
|
android:defaultValue="-1"
|
||||||
|
android:entries="@array/pref_symbols_list_titles"
|
||||||
|
android:entryValues="@array/pref_symbols_list_values"
|
||||||
|
android:negativeButtonText="@null"
|
||||||
|
android:positiveButtonText="@null" />
|
||||||
|
|
||||||
<!-- 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
|
||||||
|
|
Loading…
Reference in a new issue