diff --git a/app/app.iml b/app/app.iml
index 74d7e06..0bf93b8 100644
--- a/app/app.iml
+++ b/app/app.iml
@@ -67,9 +67,11 @@
+
+
@@ -80,15 +82,19 @@
+
+
+
+
diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/GameController.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/GameController.java
index a863916..23eb02c 100644
--- a/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/GameController.java
+++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/GameController.java
@@ -5,28 +5,27 @@ import android.content.SharedPreferences;
import android.os.Handler;
import android.os.Parcel;
import android.os.Parcelable;
-import android.util.Log;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.concurrent.atomic.AtomicBoolean;
import org.secuso.privacyfriendlysudoku.controller.helper.GameInfoContainer;
-import org.secuso.privacyfriendlysudoku.game.CellConflict;
import org.secuso.privacyfriendlysudoku.game.CellConflictList;
import org.secuso.privacyfriendlysudoku.game.GameBoard;
import org.secuso.privacyfriendlysudoku.game.GameCell;
import org.secuso.privacyfriendlysudoku.game.GameDifficulty;
import org.secuso.privacyfriendlysudoku.game.GameType;
import org.secuso.privacyfriendlysudoku.game.ICellAction;
+import org.secuso.privacyfriendlysudoku.game.listener.IGameErrorListener;
import org.secuso.privacyfriendlysudoku.game.listener.IGameSolvedListener;
import org.secuso.privacyfriendlysudoku.game.listener.IHighlightChangedListener;
import org.secuso.privacyfriendlysudoku.game.listener.IHintListener;
import org.secuso.privacyfriendlysudoku.game.listener.IModelChangedListener;
import org.secuso.privacyfriendlysudoku.game.listener.ITimerListener;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.concurrent.atomic.AtomicBoolean;
+
/**
* Created by Chris on 06.11.2015.
*/
@@ -45,6 +44,7 @@ public class GameController implements IModelChangedListener, Parcelable {
private LinkedList highlightListeners = new LinkedList<>();
private LinkedList solvedListeners = new LinkedList<>();
private LinkedList hintListener = new LinkedList<>();
+ private LinkedList errorListeners = new LinkedList<>();
private boolean notifiedOnSolvedListeners = false;
// Game
@@ -306,7 +306,7 @@ public class GameController implements IModelChangedListener, Parcelable {
return 0 < val && val <= size;
}
- public List getErrorList() {
+ public CellConflictList getErrorList() {
return errorList;
}
@@ -507,23 +507,24 @@ public class GameController implements IModelChangedListener, Parcelable {
@Override
public void onModelChange(GameCell c) {
if(gameBoard.isFilled()) {
- List errorList = new LinkedList<>();
+ errorList = new CellConflictList();
if(gameBoard.isSolved(errorList)) {
if(!notifiedOnSolvedListeners) {
notifiedOnSolvedListeners = true;
notifySolvedListeners();
resetSelects();
}
- } else {
- // notifyErrorListener();
- // TODO: errorList now holds all the errors => display errors .. notify some view?
- }
+ }// else {
+ // errorList now holds all the errors => display errors
+ //notifyErrorListener(errorList);
+ //resetSelects();
+ //}
} else {
notifiedOnSolvedListeners = false;
}
}
- private void resetSelects() {
+ public void resetSelects() {
selectedCol = -1;
selectedRow = -1;
selectedValue = 0;
@@ -543,6 +544,12 @@ public class GameController implements IModelChangedListener, Parcelable {
}
}
+ /*public void registerGameErrorListener(IGameErrorListener l) {
+ if(!errorListeners.contains(l)) {
+ errorListeners.add(l);
+ }
+ }*/
+
public void removeGameSolvedListener(IGameSolvedListener l) {
if(solvedListeners.contains(l)) {
solvedListeners.remove(l);
@@ -578,6 +585,12 @@ public class GameController implements IModelChangedListener, Parcelable {
}
}
+ /*public void notifyErrorListener(List errorList) {
+ for (IGameErrorListener listener : errorListeners){
+ listener.onGameFilledWithErrors(errorList);
+ }
+ }*/
+
public void registerHintListener(IHintListener listener){
if (!hintListener.contains(listener)){
hintListener.add(listener);
@@ -756,6 +769,7 @@ public class GameController implements IModelChangedListener, Parcelable {
solvedListeners = new LinkedList<>();
hintListener = new LinkedList<>();
timerListeners = new LinkedList<>();
+ errorListeners = new LinkedList<>();
}
public void setContextAndSettings(Context applicationContext, SharedPreferences sharedPref) {
diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/game/CellConflict.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/game/CellConflict.java
index 9909871..b132a29 100644
--- a/app/src/main/java/org/secuso/privacyfriendlysudoku/game/CellConflict.java
+++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/game/CellConflict.java
@@ -11,6 +11,19 @@ public class CellConflict {
private GameCell c1 = null;
private GameCell c2 = null;
+ public int getRowCell1() {
+ return c1.getRow();
+ }
+ public int getRowCell2() {
+ return c2.getRow();
+ }
+ public int getColCell1() {
+ return c1.getCol();
+ }
+ public int getColCell2() {
+ return c2.getCol();
+ }
+
public CellConflict(GameCell first, GameCell second) {
c1 = first;
diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/game/GameBoard.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/game/GameBoard.java
index defb466..95f5081 100644
--- a/app/src/main/java/org/secuso/privacyfriendlysudoku/game/GameBoard.java
+++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/game/GameBoard.java
@@ -3,11 +3,11 @@ package org.secuso.privacyfriendlysudoku.game;
import android.os.Parcel;
import android.os.Parcelable;
+import org.secuso.privacyfriendlysudoku.game.listener.IModelChangedListener;
+
import java.util.LinkedList;
import java.util.List;
-import org.secuso.privacyfriendlysudoku.game.listener.IModelChangedListener;
-
/**
* Created by Christopher Beckmann on 06.11.2015.
*/
@@ -127,7 +127,7 @@ public class GameBoard implements Cloneable, Parcelable {
return existing;
}
- public boolean isSolved(final List errorList) {
+ public boolean isSolved(final CellConflictList errorList) {
boolean solved = true;
if(errorList == null) {
diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/game/listener/IGameErrorListener.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/game/listener/IGameErrorListener.java
new file mode 100644
index 0000000..628a35c
--- /dev/null
+++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/game/listener/IGameErrorListener.java
@@ -0,0 +1,12 @@
+package org.secuso.privacyfriendlysudoku.game.listener;
+
+import org.secuso.privacyfriendlysudoku.game.CellConflict;
+
+import java.util.List;
+
+/**
+ * Created by Chris on 02.02.2016.
+ */
+public interface IGameErrorListener {
+ public void onGameFilledWithErrors(List errorList);
+}
diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/StatsActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/StatsActivity.java
index 79ec106..e41190e 100644
--- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/StatsActivity.java
+++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/StatsActivity.java
@@ -3,32 +3,30 @@ package org.secuso.privacyfriendlysudoku.ui;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
+import android.os.Bundle;
import android.support.design.widget.TabLayout;
-import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.Toolbar;
-
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
-import android.os.Bundle;
+import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
-
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.TextView;
-import java.util.List;
-
import org.secuso.privacyfriendlysudoku.controller.SaveLoadStatistics;
import org.secuso.privacyfriendlysudoku.controller.helper.HighscoreInfoContainer;
import org.secuso.privacyfriendlysudoku.game.GameType;
import org.secuso.privacyfriendlysudoku.ui.view.R;
+import java.util.List;
+
public class StatsActivity extends AppCompatActivity {
/**
@@ -198,14 +196,14 @@ public class StatsActivity extends AppCompatActivity {
private String formatTime(int totalTime){
- if (totalTime==0) return "/";
+ if (totalTime==0) return "-";
int seconds = totalTime % 60;
int minutes = ((totalTime -seconds)/60)%60 ;
int hours = (totalTime - minutes - seconds)/(3600);
String h,m,s;
- s = (seconds< 10)? "0"+String.valueOf(seconds):String.valueOf(seconds);
- m = (minutes< 10)? "0"+String.valueOf(minutes):String.valueOf(minutes);
- h = (hours< 10)? "0"+String.valueOf(hours):String.valueOf(hours);
+ s = (seconds < 10)? "0"+String.valueOf(seconds):String.valueOf(seconds);
+ m = (minutes < 10)? "0"+String.valueOf(minutes):String.valueOf(minutes);
+ h = (hours < 10)? "0"+String.valueOf(hours):String.valueOf(hours);
return (h + ":" + m + ":" + s);
}
diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/SudokuCellView.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/SudokuCellView.java
index 9a7b98c..5558a3d 100644
--- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/SudokuCellView.java
+++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/SudokuCellView.java
@@ -10,8 +10,8 @@ import android.util.AttributeSet;
import android.view.View;
import android.widget.RelativeLayout;
-import org.secuso.privacyfriendlysudoku.game.GameCell;
import org.secuso.privacyfriendlysudoku.controller.Symbol;
+import org.secuso.privacyfriendlysudoku.game.GameCell;
/**
* Created by TMZ_LToP on 10.11.2015.
@@ -116,6 +116,7 @@ public class SudokuCellView extends View {
drawBackground(canvas, 3, 3, mWidth - 3, mHeight - 3, p);
+
// if there is no mGameCell .. we can not retrieve the information to draw
if(mGameCell != null) {
drawValue(canvas);
diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/SudokuFieldLayout.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/SudokuFieldLayout.java
index e12bf9a..2b97c6b 100644
--- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/SudokuFieldLayout.java
+++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/SudokuFieldLayout.java
@@ -10,14 +10,15 @@ import android.view.MotionEvent;
import android.view.View;
import android.widget.RelativeLayout;
-import java.util.LinkedList;
-
import org.secuso.privacyfriendlysudoku.controller.GameController;
import org.secuso.privacyfriendlysudoku.controller.Symbol;
+import org.secuso.privacyfriendlysudoku.game.CellConflict;
import org.secuso.privacyfriendlysudoku.game.GameCell;
import org.secuso.privacyfriendlysudoku.game.ICellAction;
import org.secuso.privacyfriendlysudoku.game.listener.IHighlightChangedListener;
+import java.util.LinkedList;
+
/**
* Created by Timm Lippert on 11.11.2015.
*/
@@ -29,6 +30,7 @@ public class SudokuFieldLayout extends RelativeLayout implements IHighlightChang
private int gameCellWidth;
private int gameCellHeight;
private SharedPreferences settings;
+ private Paint p = new Paint();
private OnTouchListener listener = new OnTouchListener() {
@Override
@@ -46,14 +48,13 @@ public class SudokuFieldLayout extends RelativeLayout implements IHighlightChang
}
};
- private Paint p = new Paint();
-
public SudokuCellView [][] gamecells;
AttributeSet attrs;
public SudokuFieldLayout(Context context, AttributeSet attrs) {
super(context, attrs);
this.attrs=attrs;
+ setWillNotDraw(false);
setBackgroundColor(Color.argb(255, 200, 200, 200));
}
@@ -198,6 +199,35 @@ public class SudokuFieldLayout extends RelativeLayout implements IHighlightChang
gamecells[i][j].invalidate();
}
}
+ }
+ @Override
+ public void dispatchDraw(Canvas canvas) {
+ super.dispatchDraw(canvas);
+
+ // draw error list
+ p = new Paint(Paint.ANTI_ALIAS_FLAG);
+ p.setStyle(Paint.Style.STROKE);
+ p.setStrokeWidth(4);
+ p.setColor(Color.RED);
+
+ for(CellConflict conflict : gameController.getErrorList()) {
+
+ //gamecells[conflict.getRowCell1()][conflict.getColCell1()].
+
+ int row = conflict.getRowCell1();
+ int col = conflict.getColCell1();
+ canvas.drawCircle(gameCellWidth * col + gameCellWidth / 2, gameCellHeight * row + gameCellHeight / 2, gameCellWidth/2 - gameCellWidth / 8, p);
+
+ int row2 = conflict.getRowCell2();
+ int col2 = conflict.getColCell2();
+ canvas.drawCircle(gameCellWidth * col2 + gameCellWidth / 2, gameCellHeight * row2 + gameCellHeight / 2, gameCellWidth/2 - gameCellWidth / 8, p);
+
+ canvas.drawLine(
+ gameCellWidth * col + gameCellWidth / 2,
+ gameCellHeight * row + gameCellHeight / 2,
+ gameCellWidth * col2 + gameCellWidth / 2,
+ gameCellHeight * row2 + gameCellHeight / 2, p);
+ }
}
}
diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml
index 4606737..30d1d12 100644
--- a/app/src/main/res/values-ru/strings.xml
+++ b/app/src/main/res/values-ru/strings.xml
@@ -39,7 +39,7 @@
Выбери поле которое должно быть решено.
Удалить
Ты уверен что хочеш удалить эту игру?
- О
+ О нас
Продолжить игру
Общее время:
Настройки
@@ -72,4 +72,5 @@
Настройки
Лучшее время:
Больше информации на:
+ Информация конфиденциальности
\ No newline at end of file