diff --git a/README.md b/README.md index 337f4fc..abd8fdb 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,20 @@ -# privacy-friendly-sudoku -This is a Sudoku App, that needs no permissions to run at all. +## Privacy Friendly Sudoku + +Privacy Friendly Sudoku is a logic based game. + +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. + 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 8e60fb7..a863916 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/GameController.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/GameController.java @@ -516,8 +516,7 @@ public class GameController implements IModelChangedListener, Parcelable { } } else { // notifyErrorListener(); - // TODO: errorList now holds all the errors - // TODO: display errors .. notify some view? + // TODO: errorList now holds all the errors => display errors .. notify some view? } } else { notifiedOnSolvedListeners = false; @@ -709,10 +708,6 @@ public class GameController implements IModelChangedListener, Parcelable { out.writeParcelable(difficulty, 0); out.writeParcelable(gameBoard, 0); out.writeParcelable(undoRedoManager, 0); - - // delete lists, in case we get the same object back from Parcel - removeAllListeners(); - } public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/QQWingController.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/QQWingController.java index 0bafec8..2a2f1d4 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/QQWingController.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/QQWingController.java @@ -72,9 +72,9 @@ public class QQWingController { opts.threads = 1; opts.gameType = gameBoard.getGameType(); doAction(); - if(solveImpossible) { - // TODO: do something else. - } + //if(solveImpossible) { + // Can not occur with normal use of the app. + //} return solution; } diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/helper/GameInfoContainer.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/helper/GameInfoContainer.java index 195c57d..58838d2 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/helper/GameInfoContainer.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/helper/GameInfoContainer.java @@ -162,7 +162,7 @@ public class GameInfoContainer { public static String getGameInfo(GameController controller) { StringBuilder sb = new StringBuilder(); Date today = new Date(); - // TODO add some game information + sb.append(controller.getGameType().name()); sb.append("/"); sb.append(controller.getTime()); diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/qqwing/QQWing.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/qqwing/QQWing.java index 2cfb7c5..2e152f9 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/qqwing/QQWing.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/qqwing/QQWing.java @@ -452,7 +452,6 @@ public class QQWing { // 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 ) { 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; } - // TODO: checked private boolean colBoxReduction(int round) { for (int valIndex = 0; valIndex < ROW_COL_SEC_SIZE; valIndex++) { for (int col = 0; col < ROW_COL_SEC_SIZE; col++) { diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java index 8b04ac4..a52d49d 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java @@ -11,7 +11,6 @@ import android.content.SharedPreferences; import android.content.res.Configuration; import android.graphics.Point; import android.os.Bundle; -import android.os.Parcelable; import android.preference.PreferenceActivity; import android.preference.PreferenceManager; 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.ui.listener.IHintDialogFragmentListener; 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.SudokuFieldLayout; import org.secuso.privacyfriendlysudoku.ui.view.SudokuKeyboardLayout; @@ -59,7 +58,7 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On RatingBar ratingBar; private boolean gameSolved = false; SaveLoadStatistics statistics = new SaveLoadStatistics(this); - DialogActivity dialog = null; + WinDialog dialog = null; @Override protected void onCreate(Bundle savedInstanceState) { @@ -177,7 +176,8 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On // start the game gameController.startTimer(); } - onTick(gameController.getTime()); + gameController.notifyHighlightChangedListeners(); + gameController.notifyTimerListener(gameController.getTime()); } @Override @@ -291,13 +291,10 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On statistics.saveGameStats(); + boolean isNewBestTime = gameController.getUsedHints() == 0 + && statistics.loadStats(gameController.getGameType(),gameController.getDifficulty()).getMinTime() >= gameController.getTime(); - if (gameController.getUsedHints() == 0){ - 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 = new WinDialog(this, R.style.WinDialog , timeToString(gameController.getTime()), String.valueOf(gameController.getUsedHints()), isNewBestTime); dialog.getWindow().setContentView(R.layout.win_screen_layout); //dialog.setContentView(getLayoutInflater().inflate(R.layout.win_screen_layout,null)); @@ -315,8 +312,10 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On @Override public void onClick(View v) { dialog.dismiss(); + Intent intent = new Intent(activity, MainActivity.class); + intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + startActivity(intent); activity.finish(); - startActivity(new Intent(activity,MainActivity.class)); } }); ((Button)dialog.findViewById(R.id.win_button2)).setOnClickListener(new View.OnClickListener() { @@ -345,9 +344,8 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On @Override public void onTick(int time) { - if(gameSolved) return; - //do something not so awesome + // display the time timerView.setText(timeToString(time)); if(gameSolved) return; diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/HelpActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/HelpActivity.java index 840760c..ea8db62 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/HelpActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/HelpActivity.java @@ -100,29 +100,6 @@ public class HelpActivity extends AppCompatPreferenceActivity { index >= 0 ? listPreference.getEntries()[index] : 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 { // For all other preferences, set the summary to the value's // simple string representation. diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/DialogActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/DialogActivity.java deleted file mode 100644 index a85bc35..0000000 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/DialogActivity.java +++ /dev/null @@ -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); - } - - } - - -} diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/WinDialog.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/WinDialog.java new file mode 100644 index 0000000..923589f --- /dev/null +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/WinDialog.java @@ -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); + } + + } + + +} diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 28a2400..4b2d6b5 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -25,7 +25,6 @@ Diese App benutzt eine modifizierte Version des QQWing v1.3.4. Durchschnittliche Zeit: Abbrechen - eine privacy friendly App Unspezifiziert Generiere neue Level im Hintergrund… Bist du sicher, dass du einen Hinweis verwenden möchtest? Wenn Hinweise benutzt wurden, kann in dem Spiel keine Bestzeit mehr erreicht werden. @@ -45,20 +44,41 @@ Wert hervorheben Spiel Hervorhebung - Verbundene Spalten Notizen - Verbundene Reihen - Verbundene Sektionen Gleiche Werte Symbole Spiel laden Statistik Alles zurücksetzen - zurücksetzen + Zurücksetzen Bist du dir sicher, dass du das komplette Spielfeld zurücksetzen möchtest? Gesamtspielzeit: fortsetzen Glückwunsch! Sudoku + Neue Bestzeit! + Hinweise: + Zeige Spielfeld + Zeit: + Hilfe + Verbundene Felder + Macht die letzte Aktion rückgängig + Rückgängig + Privacy Friendly Sudoku verwendet keine Berechtigungen. + Berechtigungen + Schaltet zwischen Notizen- und Werteingabe hin und her + Notizen + Zeigt an, ob die korrekte Anzahl des Wertes im Spielfeld vorkommt. + Zeigt an, dass der Wert ausgewählt ist. Jede Berührung eines Feldes setzt in diesem Modus die Zahl direkt, ohne das Feld vorher auszuwählen. + Tastatur + Zeige die korrekte Lösung für das ausgewählte Feld + Hinweis + Spielfeld + Stellt die letzte rückgängig gemachte Aktion wieder her + Wiederherstellen + Löscht das ausgewählte Feld + Löschen + Hilfe + Privatsphäre Information \ No newline at end of file diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 07bff72..3022830 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -1,4 +1,76 @@ Sudoku + En conjunción con: + Ayuda + Autor: + Está Aplicación utiliza una versión modificada de QQWing v1.3.4 + Tiempo promedio: + Cancelar + Fácil + Difícil + Normal + No especificado + Generando nuevo nivel en segundo plano… + Borrar + Borrar el campo seleccionado + Rehacer + Rehacer la acción pasada + Campo de juego + Consejo + Revelar el campo seleccionado\nAtención: Si se utiliza, el juego actual no va a valer como mejor tiempo. + Teclado + Indica el valor de botón seleccionado. Al tocar en el campo se pondra el valor directamente. + Indica el número correcto de valores que se ha utilizado. + Notas + Cambia, si los números se muestran como notas o valores en el campo + Permisos + Privacy Friendly Sudoku no utiliza permisos + Deshacer + Deshacer la acción pasada + Está seguro que quiere utilizar este consejo? Si lo utiliza no sera posible mejorar su tiempo personal. + Usar + Escoja un campo válido y presione en consejo para que aparezca la solución. + Borrar + Está seguro que quiere borrar el juego actual? + Sobre nosotros + Continuar juego + Grupo + Ayuda + Estadísticas + Menu principal + Resetear tabla + Configuraciones + Mejor tiempo: + Más información puede encontrarlo: + Nuevo juego + Juego completados: + Consejos utilizados: + Borrar nota + Borrado automático de notas, cuando se ponen los valores las celdas conectadas. + Configuraciones de juego + Resaltar de las celdas conectadas. + Resaltar de los valores. + Juego + Resaltar + Celdas conectadas + Notas + Valores iguales + Símbolos + Esta aplicación pertenece a Privacy Friendly Apps. + Está seguro que quiere reiniciar el juego actual? + Resetear + Resetear todo + Estadísticas + Ayuda + Cargar juego + Configuraciones + Tiempo total jugado: + Nuevo mejor tiempo! + Continuar + Consejos: + Mostrar campo de juego + Felicitaciones! + Tiempo: + Información de Privacidad \ No newline at end of file diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 07bff72..943fe5c 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -1,4 +1,76 @@ Sudoku + Совместно с: + Авторы: + Данное приложение использует модифицированную версию QQWing v1.3.4. + Среднее время: + Отмена + + Легкий + Сложный + Средний + Необычный + Генерирую новый уровень на заднем плане… + Помощь + Удалить + Удаляет выбранное поле + Вернуть + Возвращает отменённое действие + Игровое поле + Подсказка + Показывает правильное решение для указанного поля + Клавиатура + Показывает что значение выбрано. Последущий выбор поля устанавливает значение поля. + Показывает правильное ли количество данного значение установлено на поле. + Заметки + Время: + Поздравления! + Показать поле + Подсказки: + продолжить + Новый рекорд! + Переключает между заметками и вводом значений. + Права + Это прилажение не использует дополнительных прав. + Назад + Отменяет последнее действие. + Ты уверен? + Использовать + Выбери поле которое должно быть решено. + Удалить + Ты уверен что хочеш удалить эту игру? + О + Продолжить игру + Общее время: + Настройки + Загрузить игру + Помощь + Статистика + Сбросить всё. + Сброс + Ты уверен что хочеш сбросить поле? + Это приложение пренадлежит группе Privacy Friendly Apps. + Симболы + Одинаковые значения + Заметки + Связанные поля + Выделение + Игра + Выделить поле + Новая игра + Оконченые игры: + Использованные подсказки: + Удаление заметок + Автоматическое удаление заметок при вводе поля. + Настройки + Выделить выбор + Група + Помощь + Статистика + Главное меню + Возврат + Настройки + Лучшее время: + Больше информации на: \ No newline at end of file diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 07bff72..9920b28 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -1,4 +1,19 @@ Sudoku + 时间: + 继续 + 作者: + 平均时间: + 退出 + 简单 + + 普通 + 不明 + 删除 + 祝贺! + 提示: + 显示游戏版 + 新纪录! + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8b90dc5..7459cec 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -15,8 +15,6 @@ Reset Board Continue Game - a privacy friendly app - Open navigation drawer Close navigation drawer @@ -74,10 +72,10 @@ Sudoku - Standard Sudoku 9x9 - Standard Sudoku 6x6 + Sudoku 9x9 + Sudoku 6x6 Unspecified - Standard Sudoku 12x12 + Sudoku 12x12 X Sudoku 9x9 Hyper Sudoku 9x9 Select a valid field and then press the hint button to reveal the solution. @@ -95,99 +93,38 @@ # used hints: # completed games: Total time played: - average time: - best time: + Average time: + Best time: Reset All - Congratulations! - continue + Continue Help - needed time: - hints used: + Time: + Hints: Show gamefield - New best time ! - - - - - General - - Enable social recommendations - Recommendations for people to contact - based on your message history - - - Display name - John Smith - - Add friends to messages - - Always - When possible - Never - - - 1 - 0 - -1 - - - - Data & sync - - Sync frequency - - 15 minutes - 30 minutes - 1 hour - 3 hours - 6 hours - Never - - - 15 - 30 - 60 - 180 - 360 - -1 - - - System sync settings - - - Notifications - - New message notifications - - Ringtone - Silent - - Vibrate - Help - + New personal best time! - - Keyboard - Game field - Statusbar - Key Heighlighted with black border - Indicates that the number is selected and will be set in every clicked field - Key Heighlighted with yellow border - Indicates that all numbers have been set + Help + Keyboard + Game field + Indicates that the value is selected and will be set in every clicked field + Indicates that the correct number of values for this number have been placed. - Do button - Redoes the last action - Undo button - Undoes the last action - Hint button - Unveals the selected field Warning:When used the game is not appear as best in the Statistics - Delete button - deletes a selected cell - Toggle notes button - toggles if numbers should be set as notes or as value in a cell + Do button + Redoes the last undone action + Undo button + Undoes the last action + Hint button + Unveals the selected field\nWarning: When used, the current game can not count towards a new best time. + Delete button + Deletes a selected field + Note toggle button + toggles if numbers should be set as notes or as values in a field + Privacy Info + Permissions + Privacy Friendly Sudoku does not use any permissions. diff --git a/app/src/main/res/xml/pref_help_general.xml b/app/src/main/res/xml/pref_help_general.xml index 7e65229..c91ce22 100644 --- a/app/src/main/res/xml/pref_help_general.xml +++ b/app/src/main/res/xml/pref_help_general.xml @@ -1,51 +1,43 @@ - - - + - + + - + - + - + - + + android:summary="@string/help_notes_summary"/> - + + - - - - - - - - - - -