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.GameController;
|
||||
import tu_darmstadt.sudoku.controller.SaveLoadStatistics;
|
||||
import tu_darmstadt.sudoku.controller.Symbol;
|
||||
import tu_darmstadt.sudoku.controller.helper.GameInfoContainer;
|
||||
import tu_darmstadt.sudoku.game.GameDifficulty;
|
||||
import tu_darmstadt.sudoku.game.GameType;
|
||||
|
@ -154,6 +155,11 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
|||
if(!gameSolved) {
|
||||
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;
|
||||
}
|
||||
|
||||
public void setSymbols(Symbol s) {
|
||||
symbolsToUse = s;
|
||||
}
|
||||
|
||||
public void setHighlightType(CellHighlightTypes highlightType) {
|
||||
this.highlightType = highlightType;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import android.widget.RelativeLayout;
|
|||
import java.util.LinkedList;
|
||||
|
||||
import tu_darmstadt.sudoku.controller.GameController;
|
||||
import tu_darmstadt.sudoku.controller.Symbol;
|
||||
import tu_darmstadt.sudoku.game.GameCell;
|
||||
import tu_darmstadt.sudoku.game.ICellAction;
|
||||
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
|
||||
protected void onLayout(boolean changed, int l, int t, int r, int 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) {
|
||||
LayoutParams p ;
|
||||
buttons = new SudokuButton[size];
|
||||
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 width2 =(width-(realSize*30))/(realSize);
|
||||
//int width2 =(width-(realSize*30))/(realSize);
|
||||
|
||||
for (int k = 0; k<2;k++){
|
||||
for (int i = 0; i< torun; i++){
|
||||
if (number == size) {
|
||||
|
@ -99,7 +107,10 @@ public class SudokuKeyboardLayout extends GridLayout implements IHighlightChange
|
|||
}
|
||||
|
||||
public void updateNotesEnabled() {
|
||||
if (normalTextSize == 0) {normalTextSize = buttons[0].getTextSize();}
|
||||
if (normalTextSize == 0) {
|
||||
normalTextSize = buttons[0].getTextSize();
|
||||
}
|
||||
|
||||
if(gameController.getNoteStatus()) {
|
||||
setTextSize(normalTextSize*0.6f);
|
||||
} else {
|
||||
|
@ -119,7 +130,6 @@ public class SudokuKeyboardLayout extends GridLayout implements IHighlightChange
|
|||
@Override
|
||||
public void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -135,7 +135,7 @@
|
|||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="testforwinshitz"
|
||||
android:text="Win Debug"
|
||||
android:onClick="callFragment"/>
|
||||
<!--
|
||||
<LinearLayout
|
||||
|
|
|
@ -14,34 +14,39 @@
|
|||
android:id="@+id/sudokuLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="200dp"
|
||||
android:clickable="true"
|
||||
android:gravity="center" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_below="@+id/sudokuLayout"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="3">
|
||||
|
||||
<tu_darmstadt.sudoku.ui.view.SudokuKeyboardLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:minHeight="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/sudokuLayout"
|
||||
android:layout_height="0px"
|
||||
android:id="@+id/sudokuKeyboardLayout"
|
||||
android:layout_centerVertical="true"
|
||||
android:useDefaultMargins="true"
|
||||
android:alignmentMode="alignBounds"
|
||||
android:columnOrderPreserved="false"
|
||||
android:columnCount="6"
|
||||
android:rowCount="2"
|
||||
android:alwaysDrawnWithCache="true"
|
||||
android:foregroundGravity="fill_horizontal">
|
||||
android:foregroundGravity="fill_horizontal"
|
||||
android:layout_weight="2">
|
||||
|
||||
</tu_darmstadt.sudoku.ui.view.SudokuKeyboardLayout>
|
||||
|
||||
|
||||
<tu_darmstadt.sudoku.ui.view.SudokuSpecialButtonLayout
|
||||
android:id="@+id/sudokuSpecialLayout"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/sudokuKeyboardLayout">
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="1">
|
||||
|
||||
</tu_darmstadt.sudoku.ui.view.SudokuSpecialButtonLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -34,6 +34,23 @@
|
|||
<!-- #Game -->
|
||||
<string name="pref_header_game">Game</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_summary">Automatically remove notes when setting values on connected cells</string>
|
||||
|
||||
|
@ -81,6 +98,6 @@
|
|||
|
||||
|
||||
<!--### 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>
|
||||
|
|
|
@ -1,13 +1,22 @@
|
|||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<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:title="@string/pref_automatic_note_deletion"
|
||||
android:summary="@string/pref_automatic_note_deletion_summary"
|
||||
android:defaultValue="true"/>
|
||||
</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's summary should be set to its value by the activity code. -->
|
||||
<!-- <EditTextPreference
|
||||
|
|
Loading…
Reference in a new issue