Renamed some stuff and fixed minor bugs.
This commit is contained in:
parent
9c3579d4af
commit
00c029fbbc
9 changed files with 87 additions and 68 deletions
22
README.md
22
README.md
|
@ -1,2 +1,20 @@
|
||||||
# privacy-friendly-sudoku
|
## Privacy Friendly Sudoku
|
||||||
This is a Sudoku App, that needs no permissions to run at all.
|
|
||||||
|
Privacy Friendly Sudoku is a game... // TODO
|
||||||
|
|
||||||
|
It does not use any permission, as the app can provide its full functionality without the usage of permissions.
|
||||||
|
It also does neither include advertisement nor tracking mechanisms.
|
||||||
|
|
||||||
|
## Motivation
|
||||||
|
|
||||||
|
As it is part of the Privacy Friendly Apps developed by the SECUSO research group of the Technische
|
||||||
|
Universtität Darmstadt in Germany it is optimized due to user's privacy.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Further development requires Android Studio.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Privacy Friendly Sudoku is lisenced under the GPLv3.
|
||||||
|
|
||||||
|
|
|
@ -67,9 +67,11 @@
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/debug" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
|
||||||
|
@ -80,15 +82,19 @@
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/mockable-android-23.jar" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||||
</content>
|
</content>
|
||||||
|
|
|
@ -516,8 +516,7 @@ public class GameController implements IModelChangedListener, Parcelable {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// notifyErrorListener();
|
// notifyErrorListener();
|
||||||
// TODO: errorList now holds all the errors
|
// TODO: errorList now holds all the errors => display errors .. notify some view?
|
||||||
// TODO: display errors .. notify some view?
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
notifiedOnSolvedListeners = false;
|
notifiedOnSolvedListeners = false;
|
||||||
|
|
|
@ -72,9 +72,9 @@ public class QQWingController {
|
||||||
opts.threads = 1;
|
opts.threads = 1;
|
||||||
opts.gameType = gameBoard.getGameType();
|
opts.gameType = gameBoard.getGameType();
|
||||||
doAction();
|
doAction();
|
||||||
if(solveImpossible) {
|
//if(solveImpossible) {
|
||||||
// TODO: do something else.
|
// Can not occur with normal use of the app.
|
||||||
}
|
//}
|
||||||
return solution;
|
return solution;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,7 @@ public class GameInfoContainer {
|
||||||
public static String getGameInfo(GameController controller) {
|
public static String getGameInfo(GameController controller) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
Date today = new Date();
|
Date today = new Date();
|
||||||
// TODO add some game information
|
|
||||||
sb.append(controller.getGameType().name());
|
sb.append(controller.getGameType().name());
|
||||||
sb.append("/");
|
sb.append("/");
|
||||||
sb.append(controller.getTime());
|
sb.append(controller.getTime());
|
||||||
|
|
|
@ -452,7 +452,6 @@ public class QQWing {
|
||||||
// Some hack to make easy levels on 12x12 .. because the generator wasn't able to create some
|
// Some hack to make easy levels on 12x12 .. because the generator wasn't able to create some
|
||||||
if(gameType == GameType.Default_12x12 && difficulty == GameDifficulty.Easy ) {
|
if(gameType == GameType.Default_12x12 && difficulty == GameDifficulty.Easy ) {
|
||||||
i += 4; // skip every 2nd round to find "easy" levels more frequent. Still takes about 20 Seconds.
|
i += 4; // skip every 2nd round to find "easy" levels more frequent. Still takes about 20 Seconds.
|
||||||
// TODO . save games be4 hand to load them when needed
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -741,7 +740,6 @@ public class QQWing {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: checked
|
|
||||||
private boolean colBoxReduction(int round) {
|
private boolean colBoxReduction(int round) {
|
||||||
for (int valIndex = 0; valIndex < ROW_COL_SEC_SIZE; valIndex++) {
|
for (int valIndex = 0; valIndex < ROW_COL_SEC_SIZE; valIndex++) {
|
||||||
for (int col = 0; col < ROW_COL_SEC_SIZE; col++) {
|
for (int col = 0; col < ROW_COL_SEC_SIZE; col++) {
|
||||||
|
|
|
@ -11,7 +11,6 @@ import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.graphics.Point;
|
import android.graphics.Point;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Parcelable;
|
|
||||||
import android.preference.PreferenceActivity;
|
import android.preference.PreferenceActivity;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.design.widget.NavigationView;
|
import android.support.design.widget.NavigationView;
|
||||||
|
@ -42,7 +41,7 @@ import org.secuso.privacyfriendlysudoku.game.listener.IGameSolvedListener;
|
||||||
import org.secuso.privacyfriendlysudoku.game.listener.ITimerListener;
|
import org.secuso.privacyfriendlysudoku.game.listener.ITimerListener;
|
||||||
import org.secuso.privacyfriendlysudoku.ui.listener.IHintDialogFragmentListener;
|
import org.secuso.privacyfriendlysudoku.ui.listener.IHintDialogFragmentListener;
|
||||||
import org.secuso.privacyfriendlysudoku.ui.listener.IResetDialogFragmentListener;
|
import org.secuso.privacyfriendlysudoku.ui.listener.IResetDialogFragmentListener;
|
||||||
import org.secuso.privacyfriendlysudoku.ui.view.DialogActivity;
|
import org.secuso.privacyfriendlysudoku.ui.view.WinDialog;
|
||||||
import org.secuso.privacyfriendlysudoku.ui.view.R;
|
import org.secuso.privacyfriendlysudoku.ui.view.R;
|
||||||
import org.secuso.privacyfriendlysudoku.ui.view.SudokuFieldLayout;
|
import org.secuso.privacyfriendlysudoku.ui.view.SudokuFieldLayout;
|
||||||
import org.secuso.privacyfriendlysudoku.ui.view.SudokuKeyboardLayout;
|
import org.secuso.privacyfriendlysudoku.ui.view.SudokuKeyboardLayout;
|
||||||
|
@ -59,7 +58,7 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
||||||
RatingBar ratingBar;
|
RatingBar ratingBar;
|
||||||
private boolean gameSolved = false;
|
private boolean gameSolved = false;
|
||||||
SaveLoadStatistics statistics = new SaveLoadStatistics(this);
|
SaveLoadStatistics statistics = new SaveLoadStatistics(this);
|
||||||
DialogActivity dialog = null;
|
WinDialog dialog = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -291,13 +290,10 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
||||||
|
|
||||||
statistics.saveGameStats();
|
statistics.saveGameStats();
|
||||||
|
|
||||||
|
boolean isNewBestTime = gameController.getUsedHints() == 0
|
||||||
|
&& statistics.loadStats(gameController.getGameType(),gameController.getDifficulty()).getMinTime() >= gameController.getTime();
|
||||||
|
|
||||||
if (gameController.getUsedHints() == 0){
|
dialog = new WinDialog(this, R.style.WinDialog , timeToString(gameController.getTime()), String.valueOf(gameController.getUsedHints()), isNewBestTime);
|
||||||
if (statistics.loadStats(gameController.getGameType(),gameController.getDifficulty()).getMinTime() >= gameController.getTime()) {
|
|
||||||
// ((TextView) dialog.findViewById(R.id.win_new_besttime)).setVisibility(View.VISIBLE);
|
|
||||||
dialog = new DialogActivity(this,R.style.WinDialog,timeToString(gameController.getTime()),String.valueOf(gameController.getUsedHints()),true);
|
|
||||||
}
|
|
||||||
}else dialog = new DialogActivity(this,R.style.WinDialog,timeToString(gameController.getTime()),String.valueOf(gameController.getUsedHints()),true);
|
|
||||||
|
|
||||||
dialog.getWindow().setContentView(R.layout.win_screen_layout);
|
dialog.getWindow().setContentView(R.layout.win_screen_layout);
|
||||||
//dialog.setContentView(getLayoutInflater().inflate(R.layout.win_screen_layout,null));
|
//dialog.setContentView(getLayoutInflater().inflate(R.layout.win_screen_layout,null));
|
||||||
|
@ -315,8 +311,10 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
|
Intent intent = new Intent(activity, MainActivity.class);
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
startActivity(intent);
|
||||||
activity.finish();
|
activity.finish();
|
||||||
startActivity(new Intent(activity,MainActivity.class));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
((Button)dialog.findViewById(R.id.win_button2)).setOnClickListener(new View.OnClickListener() {
|
((Button)dialog.findViewById(R.id.win_button2)).setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
package org.secuso.privacyfriendlysudoku.ui.view;
|
|
||||||
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by TMZ_LToP on 30.01.2016.
|
|
||||||
*/
|
|
||||||
public class DialogActivity extends Dialog {
|
|
||||||
|
|
||||||
private String time="";
|
|
||||||
private String hints="";
|
|
||||||
private boolean newBest=false;
|
|
||||||
|
|
||||||
public DialogActivity(Context context, int themeResId) {
|
|
||||||
super(context, themeResId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public DialogActivity(Context context,int themeResId,String t,String h, boolean newB) {
|
|
||||||
super(context,themeResId);
|
|
||||||
setParam(t,h,newB);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void setParam(String t,String h, boolean newB){
|
|
||||||
time = t;
|
|
||||||
hints=h;
|
|
||||||
newBest=newB;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
|
|
||||||
((TextView)findViewById(R.id.win_hints)).setText(hints);
|
|
||||||
((TextView)findViewById(R.id.win_time)).setText(time);
|
|
||||||
if(newBest){
|
|
||||||
((TextView)findViewById(R.id.win_new_besttime)).setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
package org.secuso.privacyfriendlysudoku.ui.view;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by TMZ_LToP on 30.01.2016.
|
||||||
|
*/
|
||||||
|
public class WinDialog extends Dialog {
|
||||||
|
|
||||||
|
private String timeString = "";
|
||||||
|
private String hintString = "";
|
||||||
|
private boolean isNewBestTime = false;
|
||||||
|
|
||||||
|
public WinDialog(Context context, int themeResId) {
|
||||||
|
super(context, themeResId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public WinDialog(Context context, int themeResId, String timeString, String hintString, boolean isNewBestTime) {
|
||||||
|
super(context,themeResId);
|
||||||
|
setParam(timeString, hintString, isNewBestTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setParam(String timeString, String hintString, boolean isNewBestTime){
|
||||||
|
this.timeString = timeString;
|
||||||
|
this.hintString = hintString;
|
||||||
|
this.isNewBestTime = isNewBestTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
((TextView)findViewById(R.id.win_hints)).setText(hintString);
|
||||||
|
((TextView)findViewById(R.id.win_time)).setText(timeString);
|
||||||
|
if(isNewBestTime){
|
||||||
|
((TextView)findViewById(R.id.win_new_besttime)).setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue