Added some Layouts for landscape ordientation as well as some for high density screens.

Also made the arrows in the main menu clickable.
This commit is contained in:
Christopher Beckmann 2016-01-30 12:38:26 +01:00
parent 65e5dbe5fc
commit 1b31b5cfe2
39 changed files with 1516 additions and 201 deletions

View file

@ -37,7 +37,7 @@
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View file

@ -67,28 +67,25 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" 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/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<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/debug" />
<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-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/design/23.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/mockable-android-23.jar" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<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/tmp" />
</content>

View file

@ -9,8 +9,8 @@ android {
}
defaultConfig {
applicationId "tu_darmstadt.sudoku"
minSdkVersion 14
applicationId "org.secuso.privacyfriendlysudoku"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"

View file

@ -26,7 +26,6 @@
<activity
android:name="org.secuso.privacyfriendlysudoku.ui.GameActivity"
android:label="@string/title_activity_game_view"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" >
</activity>
<activity android:name="org.secuso.privacyfriendlysudoku.ui.AboutActivity" >
@ -35,7 +34,11 @@
</activity>
<activity
android:name="org.secuso.privacyfriendlysudoku.ui.StatsActivity"
android:theme="@style/AppTheme.NoActionBar">
android:theme="@style/AppTheme.NoActionBar" >
</activity>
<activity
android:name="org.secuso.privacyfriendlysudoku.ui.HelpActivity"
android:label="@string/title_activity_help" >
</activity>
</application>

View file

@ -92,7 +92,7 @@ public class GameController implements IModelChangedListener {
}
public void loadNewLevel(GameType type, GameDifficulty difficulty) {
NewLevelManager newLevelManager = NewLevelManager.getInstance();
NewLevelManager newLevelManager = NewLevelManager.getInstance(context, settings);
int[] level = newLevelManager.loadLevel(type, difficulty);
@ -173,7 +173,6 @@ public class GameController implements IModelChangedListener {
}
int[] solved = solve();
// TODO test every placed value so far
// and reveal the selected value.
selectValue(solved[selectedRow * getSize() + selectedCol]);
usedHints++;
@ -215,14 +214,14 @@ public class GameController implements IModelChangedListener {
}
}
public LinkedList<GameCell> getConnectedCells(int row, int col, boolean connectedRow, boolean connectedCol, boolean connectedSec) {
public LinkedList<GameCell> getConnectedCells(int row, int col) {
LinkedList<GameCell> list = new LinkedList<>();
if(connectedRow) list.addAll(gameBoard.getRow(row));
list.addAll(gameBoard.getRow(row));
list.remove(gameBoard.getCell(row, col));
if(connectedCol) list.addAll(gameBoard.getColumn(col));
list.addAll(gameBoard.getColumn(col));
list.remove(gameBoard.getCell(row, col));
if(connectedSec) list.addAll(gameBoard.getSection(row, col));
list.addAll(gameBoard.getSection(row, col));
list.remove(gameBoard.getCell(row, col));
return list;
@ -308,6 +307,7 @@ public class GameController implements IModelChangedListener {
public void resetLevel() {
gameBoard.reset();
undoRedoManager.addState(gameBoard);
//notifyListeners();
notifyHighlightChangedListeners();
}
@ -441,10 +441,11 @@ public class GameController implements IModelChangedListener {
highlightValue = value;
}
}
} else {
} else if(selectedRow == -1 && selectedCol == -1){
if(value == selectedValue) {
// if the value we are selecting is the one we already have selected... deselect it
selectedValue = 0;
highlightValue = 0;
} else {
selectedValue = value;
highlightValue = value;
@ -506,6 +507,7 @@ public class GameController implements IModelChangedListener {
if(!notifiedOnSolvedListeners) {
notifiedOnSolvedListeners = true;
notifySolvedListeners();
resetSelects();
}
} else {
// notifyErrorListener();
@ -517,6 +519,14 @@ public class GameController implements IModelChangedListener {
}
}
private void resetSelects() {
selectedCol = -1;
selectedRow = -1;
selectedValue = 0;
highlightValue = 0;
notifyHighlightChangedListeners();
}
public void registerGameSolvedListener(IGameSolvedListener l) {
if(!solvedListeners.contains(l)) {
solvedListeners.add(l);

View file

@ -11,6 +11,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import org.secuso.privacyfriendlysudoku.game.GameDifficulty;
import org.secuso.privacyfriendlysudoku.game.GameType;
@ -30,10 +31,7 @@ public class NewLevelManager {
private static String LEVELS_DIR = "level";
private static File DIR;
public static NewLevelManager getInstance() {
return instance;
}
public static NewLevelManager init(Context context, SharedPreferences settings) {
public static NewLevelManager getInstance(Context context, SharedPreferences settings) {
if(instance == null) {
instance = new NewLevelManager(context, settings);
}
@ -118,8 +116,10 @@ public class NewLevelManager {
}
if(result.size() > 0) {
int chosen = availableFiles.get(0);
int[] resultPuzzle = result.get(0);
Random r = new Random();
int i = r.nextInt(availableFiles.size());
int chosen = availableFiles.get(i);
int[] resultPuzzle = result.get(i);
StringBuilder sb = new StringBuilder();
sb.append(LEVEL_PREFIX);

View file

@ -50,6 +50,11 @@ public class UndoRedoManager {
public void addState(GameBoard gameBoard) {
// don't add duplicates right after each other..
if(gameBoard.equals(states.get(activeState))) {
return;
}
LinkedList<GameBoard> deleteList = new LinkedList<>();
for(int i = 0; i < states.size(); i++) {

View file

@ -245,4 +245,31 @@ public class GameBoard implements Cloneable {
modelChangedListeners.remove(listener);
}
}
@Override
public boolean equals(Object o) {
if(o instanceof GameBoard) {
GameBoard other = (GameBoard) o;
if(!other.gameType.equals(gameType)
|| other.sectionHeight != sectionHeight
|| other.sectionWidth != sectionWidth
|| other.size != size) {
return false;
}
try {
for(int i = 0; i < size; i++) {
for(int j = 0; j < size; j++) {
if(!other.field[i][j].equals(field[i][j])) {
return false;
}
}
}
} catch(IndexOutOfBoundsException e) {
return false;
}
return true;
}
return false;
}
}

View file

@ -4,7 +4,6 @@ import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatDelegate;
@ -42,7 +41,6 @@ public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
getDelegate().setSupportActionBar(toolbar);
}
@NonNull
@Override
public MenuInflater getMenuInflater() {
return getDelegate().getMenuInflater();

View file

@ -10,6 +10,7 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Point;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.support.design.widget.NavigationView;
import android.support.v4.app.FragmentManager;
@ -218,6 +219,8 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
case R.id.menu_settings:
//open settings
intent = new Intent(this,SettingsActivity.class);
intent.putExtra( PreferenceActivity.EXTRA_SHOW_FRAGMENT, SettingsActivity.GamePreferenceFragment.class.getName() );
intent.putExtra( PreferenceActivity.EXTRA_NO_HEADERS, true );
startActivity(intent);
break;
@ -267,6 +270,7 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
dialog.getWindow().setBackgroundDrawableResource(R.color.transparent);
dialog.show();
layout.setEnabled(false);
keyboard.setButtonsEnabled(false);
specialButtonLayout.setButtonsEnabled(false);
}

View file

@ -0,0 +1,193 @@
package org.secuso.privacyfriendlysudoku.ui;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.support.v7.app.ActionBar;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.preference.RingtonePreference;
import android.text.TextUtils;
import android.view.MenuItem;
import org.secuso.privacyfriendlysudoku.ui.view.R;
import java.util.List;
/**
* A {@link PreferenceActivity} that presents a set of application settings. On
* handset devices, settings are presented as a single list. On tablets,
* settings are split by category, with category headers shown to the left of
* the list of settings.
* <p>
* See <a href="http://developer.android.com/design/patterns/settings.html">
* Android Design: Settings</a> for design guidelines and the <a
* href="http://developer.android.com/guide/topics/ui/settings.html">Settings
* API Guide</a> for more information on developing a Settings UI.
*/
public class HelpActivity extends AppCompatPreferenceActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setupActionBar();
}
/**
* Set up the {@link android.app.ActionBar}, if the API is available.
*/
private void setupActionBar() {
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
// Show the Up button in the action bar.
actionBar.setDisplayHomeAsUpEnabled(true);
}
}
/**
* {@inheritDoc}
*/
@Override
public boolean onIsMultiPane() {
return isXLargeTablet(this);
}
/**
* Helper method to determine if the device has an extra-large screen. For
* example, 10" tablets are extra-large.
*/
private static boolean isXLargeTablet(Context context) {
return (context.getResources().getConfiguration().screenLayout
& Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
/**
* {@inheritDoc}
*/
@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onBuildHeaders(List<Header> target) {
loadHeadersFromResource(R.xml.pref_help_headers, target);
}
/**
* A preference value change listener that updates the preference's summary
* to reflect its new value.
*/
private static Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object value) {
String stringValue = value.toString();
if (preference instanceof ListPreference) {
// For list preferences, look up the correct display value in
// the preference's 'entries' list.
ListPreference listPreference = (ListPreference) preference;
int index = listPreference.findIndexOfValue(stringValue);
// Set the summary to reflect the new value.
preference.setSummary(
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.
preference.setSummary(stringValue);
}
return true;
}
};
/**
* Binds a preference's summary to its value. More specifically, when the
* preference's value is changed, its summary (line of text below the
* preference title) is updated to reflect the value. The summary is also
* immediately updated upon calling this method. The exact display format is
* dependent on the type of preference.
*
* @see #sBindPreferenceSummaryToValueListener
*/
private static void bindPreferenceSummaryToValue(Preference preference) {
// Set the listener to watch for value changes.
preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
// Trigger the listener immediately with the preference's
// current value.
sBindPreferenceSummaryToValueListener.onPreferenceChange(preference,
PreferenceManager
.getDefaultSharedPreferences(preference.getContext())
.getString(preference.getKey(), ""));
}
/**
* This method stops fragment injection in malicious applications.
* Make sure to deny any unknown fragments here.
*/
protected boolean isValidFragment(String fragmentName) {
return PreferenceFragment.class.getName().equals(fragmentName)
|| HelpFragment.class.getName().equals(fragmentName);
}
/**
* This fragment shows general preferences only. It is used when the
* activity is showing a two-pane settings UI.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static class HelpFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_help_general);
setHasOptionsMenu(true);
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
// to their values. When their values change, their summaries are
// updated to reflect the new value, per the Android Design
// guidelines.
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
startActivity(new Intent(getActivity(), SettingsActivity.class));
return true;
}
return super.onOptionsItemSelected(item);
}
}
}

View file

@ -4,6 +4,7 @@ import android.app.Dialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
@ -58,8 +59,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
settings = PreferenceManager.getDefaultSharedPreferences(this);
NewLevelManager.init(getApplicationContext(), settings);
NewLevelManager newLevelManager = NewLevelManager.getInstance();
NewLevelManager newLevelManager = NewLevelManager.getInstance(getApplicationContext(), settings);
// Is this the very first time we start this app?
boolean firstStart = settings.getBoolean("firstStart", true);
@ -151,9 +151,13 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
Intent i = null;
if(view instanceof Button) {
Button b = (Button)view;
switch(b.getId()) {
switch(view.getId()) {
case R.id.arrow_left:
mViewPager.arrowScroll(View.FOCUS_LEFT);
break;
case R.id.arrow_right:
mViewPager.arrowScroll(View.FOCUS_RIGHT);
break;
case R.id.continueButton:
i = new Intent(this, LoadGameActivity.class);
break;
@ -162,7 +166,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
int index = difficultyBar.getProgress()-1;
GameDifficulty gameDifficulty = GameDifficulty.getValidDifficultyList().get(index < 0 ? 0 : index);
NewLevelManager newLevelManager = NewLevelManager.getInstance();
NewLevelManager newLevelManager = NewLevelManager.getInstance(getApplicationContext(), settings);
if(newLevelManager.isLevelLoadable(gameType, gameDifficulty)) {
// save current setting for later
SharedPreferences.Editor editor = settings.edit();
@ -183,7 +187,6 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
break;
default:
}
}
if(i != null) {
startActivity(i);
}
@ -221,6 +224,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
case R.id.menu_settings_main:
//open settings
intent = new Intent(this,SettingsActivity.class);
intent.putExtra( PreferenceActivity.EXTRA_SHOW_FRAGMENT, SettingsActivity.GamePreferenceFragment.class.getName() );
intent.putExtra( PreferenceActivity.EXTRA_NO_HEADERS, true );
startActivity(intent);
break;

View file

@ -84,7 +84,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onBuildHeaders(List<Header> target) {
loadHeadersFromResource(R.xml.pref_headers, target);
loadHeadersFromResource(R.xml.pref_settings_headers, target);
}
/**
@ -144,8 +144,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
*/
protected boolean isValidFragment(String fragmentName) {
return PreferenceFragment.class.getName().equals(fragmentName)
|| GamePreferenceFragment.class.getName().equals(fragmentName)
|| HighlightingPreferenceFragment.class.getName().equals(fragmentName);
|| GamePreferenceFragment.class.getName().equals(fragmentName);
}
/**
@ -157,7 +156,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_general);
addPreferencesFromResource(R.xml.pref_settings_general);
setHasOptionsMenu(true);
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
@ -181,38 +180,4 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
return super.onOptionsItemSelected(item);
}
}
/**
* This fragment shows notification preferences only. It is used when the
* activity is showing a two-pane settings UI.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static class HighlightingPreferenceFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_highlighting);
setHasOptionsMenu(true);
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
// to their values. When their values change, their summaries are
// updated to reflect the new value, per the Android Design
// guidelines.
//bindPreferenceSummaryToValue(findPreference("highlighting_connected_rows"));
//bindPreferenceSummaryToValue(findPreference("highlighting_connected_columns"));
//bindPreferenceSummaryToValue(findPreference("highlighting_connected_sections"));
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
getActivity().finish();
//startActivity(new Intent(getActivity(), SettingsActivity.class));
return true;
}
return super.onOptionsItemSelected(item);
}
}
}

View file

@ -30,6 +30,22 @@ public class SudokuFieldLayout extends RelativeLayout implements IHighlightChang
private int gameCellHeight;
private SharedPreferences settings;
private OnTouchListener listener = new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if(v instanceof SudokuCellView) {
SudokuCellView scv = ((SudokuCellView) v);
int row = scv.getRow();
int col = scv.getCol();
gameController.selectCell(row, col);
}
return false;
}
};
private Paint p = new Paint();
public SudokuCellView [][] gamecells;
@ -52,22 +68,6 @@ public class SudokuFieldLayout extends RelativeLayout implements IHighlightChang
gamecells = new SudokuCellView[gc.getSize()][gc.getSize()];
OnTouchListener listener = new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if(v instanceof SudokuCellView) {
SudokuCellView scv = ((SudokuCellView) v);
int row = scv.getRow();
int col = scv.getCol();
gameController.selectCell(row, col);
}
return false;
}
};
sectionHeight = gameController.getSectionHeight();
sectionWidth = gameController.getSectionWidth();
@ -80,6 +80,17 @@ public class SudokuFieldLayout extends RelativeLayout implements IHighlightChang
}
}
@Override
public void setEnabled(boolean enabled) {
for (int i = 0; i < gameController.getSize(); i++) {
for (int j = 0; j < gameController.getSize(); j++) {
gamecells[i][j].setEnabled(false);
gamecells[i][j].setOnTouchListener(null);
}
}
return;
}
@Override
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
@ -143,14 +154,14 @@ public class SudokuFieldLayout extends RelativeLayout implements IHighlightChang
// Set connected Fields
if(gameController.isValidCellSelected()) {
//String syncConnPref = sharedPref.getString(SettingsActivity., "");
final boolean highlightConnectedRow = settings.getBoolean("pref_highlight_rows", true);
final boolean highlightConnectedColumn = settings.getBoolean("pref_highlight_cols", true);
final boolean highlightConnectedSection = settings.getBoolean("pref_highlight_secs", true);
final boolean highlightConnected = settings.getBoolean("pref_highlight_connected", true);
for (GameCell c : gameController.getConnectedCells(row, col, highlightConnectedRow, highlightConnectedColumn, highlightConnectedSection)) {
if(highlightConnected) {
for (GameCell c : gameController.getConnectedCells(row, col)) {
gamecells[c.getRow()][c.getCol()].setHighlightType(CellHighlightTypes.Connected);
}
}
}
// highlight values
final boolean highlightValues = settings.getBoolean("pref_highlight_vals", true);
@ -180,5 +191,13 @@ public class SudokuFieldLayout extends RelativeLayout implements IHighlightChang
gamecells[gc.getRow()][gc.getCol()].setHighlightType(CellHighlightTypes.Selected);
}
}
// invalidate everything, so it gets redrawn
for(int i = 0; i < gameController.getSize(); i++) {
for(int j = 0; j < gameController.getSize(); j++) {
gamecells[i][j].invalidate();
}
}
}
}

View file

@ -4,12 +4,8 @@ import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.GridLayout;
import android.widget.GridView;
import android.widget.LinearLayout;
import org.secuso.privacyfriendlysudoku.controller.GameController;
@ -58,10 +54,11 @@ public class SudokuKeyboardLayout extends LinearLayout implements IHighlightChan
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 realSize = torun;
int numberOfButtonsPerRow = (size % 2 == 0) ? size/2 :(size+1)/2;
int numberOfButtons = numberOfButtonsPerRow * 2;
buttons = new SudokuButton[numberOfButtons];
//set layout parameters and init Layouts
@ -71,7 +68,7 @@ public class SudokuKeyboardLayout extends LinearLayout implements IHighlightChan
p.setMargins(0,5,0,5);
layouts[i] = new LinearLayout(getContext(),null);
layouts[i].setLayoutParams(p);
layouts[i].setWeightSum(torun);
layouts[i].setWeightSum(numberOfButtonsPerRow);
layouts[i].setOrientation(LinearLayout.HORIZONTAL);
addView(layouts[i]);
}
@ -80,15 +77,13 @@ public class SudokuKeyboardLayout extends LinearLayout implements IHighlightChan
for (int k = 0; k<2;k++){
for (int i = 0; i< torun; i++){
if (number == size) {
break;
}
buttons[number] = new SudokuButton(getContext(),null);
for (int layoutNumber = 0; layoutNumber <= 1 ; layoutNumber++){
for (int i = 0; i < numberOfButtonsPerRow; i++){
int buttonIndex = i + layoutNumber * numberOfButtonsPerRow;
buttons[buttonIndex] = new SudokuButton(getContext(),null);
p = new LayoutParams(0, LayoutParams.MATCH_PARENT,1);
p.setMargins(5,5,5,5);
buttons[number].setLayoutParams(p);
buttons[buttonIndex].setLayoutParams(p);
/* removed GridLayout because of bad scaling will use now a Linearlayout
Spec rowSpec = spec(k,1);
Spec colSpec = spec(i,1);
@ -106,14 +101,18 @@ public class SudokuKeyboardLayout extends LinearLayout implements IHighlightChan
// buttons[number].setLayoutParams(p);
//buttons[number].setGravity(Gravity.CENTER);
buttons[number].setType(SudokuButtonType.Value);
buttons[number].setTextColor(getResources().getColor(R.color.white));
buttons[number].setBackgroundResource(R.drawable.mnenomic_numpad_button);
buttons[number].setText(Symbol.getSymbol(symbolsToUse, number));
buttons[number].setValue(number + 1);
buttons[number].setOnClickListener(listener);
layouts[k].addView(buttons[number]);
number++;
buttons[buttonIndex].setType(SudokuButtonType.Value);
buttons[buttonIndex].setTextColor(getResources().getColor(R.color.white));
buttons[buttonIndex].setBackgroundResource(R.drawable.mnenomic_numpad_button);
buttons[buttonIndex].setText(Symbol.getSymbol(symbolsToUse, buttonIndex));
buttons[buttonIndex].setValue(buttonIndex + 1);
buttons[buttonIndex].setOnClickListener(listener);
if (buttonIndex == size) {
buttons[buttonIndex].setVisibility(INVISIBLE);
}
layouts[layoutNumber].addView(buttons[buttonIndex]);
}
}
}
@ -175,6 +174,7 @@ public class SudokuKeyboardLayout extends LinearLayout implements IHighlightChan
}
}
}
public void fixHeight (){
int i = getHeight();
i = buttons[0].getHeight();

View file

@ -22,16 +22,19 @@ import android.widget.Toast;
import java.util.LinkedList;
import org.secuso.privacyfriendlysudoku.controller.GameController;
import org.secuso.privacyfriendlysudoku.game.listener.IHighlightChangedListener;
import org.secuso.privacyfriendlysudoku.ui.listener.IHintDialogFragmentListener;
import static org.secuso.privacyfriendlysudoku.ui.view.SudokuButtonType.*;
/**
* Created by TMZ_LToP on 17.11.2015.
*/
public class SudokuSpecialButtonLayout extends LinearLayout {
public class SudokuSpecialButtonLayout extends LinearLayout implements IHighlightChangedListener {
SudokuSpecialButton[] fixedButtons;
public int fixedButtonsCount = SudokuButtonType.getSpecialButtons().size();
public int fixedButtonsCount = getSpecialButtons().size();
GameController gameController;
SudokuKeyboardLayout keyboard;
Bitmap bitMap,bitResult;
@ -114,18 +117,21 @@ public class SudokuSpecialButtonLayout extends LinearLayout {
fragmentManager = fm;
keyboard=key;
gameController = gc;
if(gc != null) {
gc.registerHighlightChangedListener(this);
}
fixedButtons = new SudokuSpecialButton[fixedButtonsCount];
LayoutParams p;
int i = 0;
//ArrayList<SudokuButtonType> type = (ArrayList<SudokuButtonType>) SudokuButtonType.getSpecialButtons();
for (SudokuButtonType t : SudokuButtonType.getSpecialButtons()){
for (SudokuButtonType t : getSpecialButtons()){
fixedButtons[i] = new SudokuSpecialButton(getContext(),null);
p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT,1);
p.setMargins(5, 5, 5, 5);
//int width2 =width/(fixedButtonsCount);
//p.width= width2-15;
if(t == SudokuButtonType.Spacer) {
if(t == Spacer) {
fixedButtons[i].setVisibility(View.INVISIBLE);
}
/*if(t == SudokuButtonType.Do && !gameController.isRedoAvailable()) {
@ -148,6 +154,24 @@ public class SudokuSpecialButtonLayout extends LinearLayout {
}
@Override
public void onHighlightChanged() {
for(int i = 0; i < fixedButtons.length; i++) {
switch(fixedButtons[i].getType()) {
case Undo:
fixedButtons[i].setBackgroundResource(gameController.isUndoAvailable() ?
R.drawable.numpad_highlighted_four : R.drawable.inactive_button);
break;
case Do:
fixedButtons[i].setBackgroundResource(gameController.isRedoAvailable() ?
R.drawable.numpad_highlighted_four : R.drawable.inactive_button);
break;
default:
break;
}
}
}
@SuppressLint("ValidFragment")
public class HintConfirmationDialog extends DialogFragment {

View file

Before

Width:  |  Height:  |  Size: 321 B

After

Width:  |  Height:  |  Size: 321 B

View file

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View file

@ -0,0 +1,145 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
android:orientation="horizontal"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".AboutActivity"
android:weightSum="2">
<LinearLayout
android:layout_width="0px"
android:layout_height="fill_parent"
android:orientation="vertical"
android:layout_weight="1">
<ImageView
android:id="@+id/barcodeLogo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/privacyfriendlyappslogo" />
<TextView
android:id="@+id/appName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:textSize="@dimen/text_size"
android:text="@string/app_name_long" />
<TextView
android:id="@+id/textFieldVersion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:textSize="@dimen/text_size"
android:text="@string/version_number" />
<TextView
android:id="@+id/textFieldAuthor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:textSize="@dimen/text_size"
android:text="@string/about_author" />
<TextView
android:id="@+id/textFieldAuthorNames"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="0dp"
android:textSize="@dimen/text_size"
android:text="@string/about_author_names" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:textSize="@dimen/text_size"
android:layout_gravity="center_horizontal"
android:text="@string/privacy_friendly"/>
</LinearLayout>
<LinearLayout
android:layout_width="0px"
android:layout_height="fill_parent"
android:orientation="vertical"
android:layout_weight="1">
<TextView
android:id="@+id/textFieldAffiliation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textSize="@dimen/text_size"
android:text="@string/about_affiliation"
android:textStyle="bold" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/secuso_logo_blau_blau" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:textSize="@dimen/text_size"
android:text="@string/more_info"/>
<TextView
android:id="@+id/linkID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/url"
android:textStyle="bold"
android:textSize="@dimen/text_size"
android:layout_gravity="center_horizontal"
android:autoLink="web"/>
<TextView
android:id="@+id/qqWing"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/about_qqwing"
android:textSize="@dimen/text_size"
android:layout_gravity="center_horizontal"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/about_qqwingLink"
android:layout_gravity="center_horizontal"
android:autoLink="web"/>
</LinearLayout>
<!--
-->
</LinearLayout>

View file

@ -0,0 +1,165 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:fitsSystemWindows="true"
tools:context="tu_darmstadt.sudoku.ui.MainActivity"
android:layout_height="match_parent"
android:layout_width="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay">
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout_main"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_marginTop="?attr/actionBarSize"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="2"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1">
<android.support.v4.view.ViewPager
android:id="@+id/scroller"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<ImageView
android:id="@+id/arrow_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_keyboard_arrow_left_black_24dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:padding="@dimen/activity_horizontal_margin"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_centerVertical="true"
android:onClick="onClick"/>
<ImageView
android:id="@+id/arrow_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/activity_horizontal_margin"
android:src="@drawable/ic_keyboard_arrow_right_black_24dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_centerVertical="true"
android:onClick="onClick"/>
</RelativeLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_below="@+id/scroller"
android:layout_weight="1"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="tu_darmstadt.sudoku.ui.MainActivity"
android:orientation="vertical"
android:weightSum="0"
android:divider="#000"
android:baselineAligned="false"
android:gravity="center_horizontal">
<TextView
android:id="@+id/difficultyText"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/difficulty_easy"
android:textSize="@dimen/main_text_difficulty"/>
<RatingBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:id="@+id/difficultyBar"
android:layout_gravity="center_horizontal"
android:clickable="true"
android:numStars="4"
android:rating="1"
android:stepSize="1"/>
<Button
android:textColor="@color/white"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:text="@string/new_game"
android:textStyle="normal"
android:textSize="@dimen/text_size"
android:id="@+id/playButton"
android:layout_gravity="center_horizontal"
android:onClick="onClick"
android:capitalize="none"
android:clickable="false"
android:elevation="10dp"
android:background="@drawable/standalone_button"/>
<Button
android:textColor="@color/white"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:text="@string/menu_continue_game"
android:textStyle="normal"
android:textSize="@dimen/text_size"
android:id="@+id/continueButton"
android:layout_gravity="center_horizontal"
android:onClick="onClick"
android:capitalize="none"
android:clickable="true"
android:background="@drawable/standalone_button"/>
</LinearLayout>
</LinearLayout>
<android.support.design.widget.NavigationView
android:id="@+id/nav_view_main"
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/white"
app:menu="@menu/menu_drawer_main"/>
</android.support.v4.widget.DrawerLayout>
</android.support.design.widget.CoordinatorLayout>

View file

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="tu_darmstadt.sudoku.activity.GameActivity">
<org.secuso.privacyfriendlysudoku.ui.view.SudokuFieldLayout
android:id="@+id/sudokuLayout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:clickable="true"
android:gravity="center" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentRight="@+id/sudokuLayout"
android:layout_alignParentEnd="@+id/sudokuLayout"
android:orientation="horizontal"
android:weightSum="3">
<org.secuso.privacyfriendlysudoku.ui.view.SudokuKeyboardLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:id="@+id/sudokuKeyboardLayout"
android:orientation="horizontal"
android:layout_weight="2"
android:weightSum="2">
</org.secuso.privacyfriendlysudoku.ui.view.SudokuKeyboardLayout>
<org.secuso.privacyfriendlysudoku.ui.view.SudokuSpecialButtonLayout
android:id="@+id/sudokuSpecialLayout"
android:layout_width="0dp"
android:orientation="vertical"
android:layout_height="match_parent"
android:layout_weight="1">
</org.secuso.privacyfriendlysudoku.ui.view.SudokuSpecialButtonLayout>
</LinearLayout>
</RelativeLayout>

View file

@ -0,0 +1,316 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:weightSum="10"
android:orientation="vertical"
tools:context="tu_darmstadt.sudoku.ui.StatsActivity$PlaceholderFragment">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="4"
android:weightSum="5">
<ImageView
android:layout_weight="2"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:id="@+id/statistic_image"
android:src="@drawable/icon_default_9x9"
android:adjustViewBounds="true"/>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<View
android:layout_width="2dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:foregroundGravity="center_vertical"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:background="@color/colorPrimary"
android:layout_marginTop="@dimen/activity_horizontal_margin"
android:layout_marginBottom="@dimen/activity_horizontal_margin"/>
</RelativeLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="fill_parent"
android:weightSum="6"
android:layout_weight="2"
android:orientation="vertical"
android:paddingTop="@dimen/activity_horizontal_margin">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/number_of_hints"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="0"
android:id="@+id/numb_of_hints"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/number_of_games"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="0"
android:id="@+id/numb_of_total_games"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/total_of_time"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="0"
android:id="@+id/numb_of_total_time"
android:layout_weight="1"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1">
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_gravity="center_vertical"
android:foregroundGravity="center_vertical"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:background="@color/colorPrimary" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="4"
android:weightSum="3"
android:orientation="vertical">
<!-- ### first row -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:weightSum="3">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="center_vertical">
<RatingBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="3"
android:layout_gravity="center"
android:id="@+id/first_diff_bar"
android:layout_below="@+id/first_diff_text"
style="?android:attr/ratingBarStyleSmall"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="diffi"
android:id="@+id/first_diff_text"
android:gravity="center_vertical"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="center_vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/average_time"
android:id="@+id/first_av_text"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:id="@+id/first_ava_time"
android:gravity="center_vertical"
android:layout_below="@+id/first_av_text"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="center_vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/min_time"
android:id="@+id/first_min_text"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:id="@+id/first_min_time"
android:gravity="center_vertical"
android:layout_below="@+id/first_min_text"/>
</RelativeLayout>
</LinearLayout>
<!-- ### second row -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:weightSum="3">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="center_vertical">
<RatingBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="3"
android:layout_gravity="center"
android:id="@+id/second_diff_bar"
android:layout_below="@+id/second_diff_text"
style="?android:attr/ratingBarStyleSmall"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="diffi"
android:id="@+id/second_diff_text"
android:gravity="center_vertical"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="center_vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/average_time"
android:id="@+id/second_av_text"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:id="@+id/second_ava_time"
android:gravity="center_vertical"
android:layout_below="@+id/second_av_text"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="center_vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/min_time"
android:id="@+id/second_min_text"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:id="@+id/second_min_time"
android:gravity="center_vertical"
android:layout_below="@+id/second_min_text"/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="center_vertical">
<RatingBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="3"
android:layout_gravity="center"
android:id="@+id/third_diff_bar"
android:layout_below="@+id/third_diff_text"
style="?android:attr/ratingBarStyleSmall"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="diffi"
android:id="@+id/third_diff_text"
android:gravity="center_vertical"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="center_vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/average_time"
android:id="@+id/third_av_text"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:id="@+id/third_ava_time"
android:gravity="center_vertical"
android:layout_below="@+id/third_av_text"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="center_vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/min_time"
android:id="@+id/third_min_text"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:id="@+id/third_min_time"
android:gravity="center_vertical"
android:layout_below="@+id/third_min_text"/>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,146 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
android:orientation="horizontal"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".AboutActivity"
android:weightSum="2">
<LinearLayout
android:layout_width="0px"
android:layout_height="fill_parent"
android:orientation="vertical"
android:layout_weight="1">
<ImageView
android:id="@+id/barcodeLogo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/privacyfriendlyappslogo" />
<TextView
android:id="@+id/appName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:textSize="@dimen/text_size"
android:text="@string/app_name_long" />
<TextView
android:id="@+id/textFieldVersion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:textSize="@dimen/text_size"
android:text="@string/version_number" />
<TextView
android:id="@+id/textFieldAuthor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:textSize="@dimen/text_size"
android:text="@string/about_author" />
<TextView
android:id="@+id/textFieldAuthorNames"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="0dp"
android:textSize="@dimen/text_size"
android:text="@string/about_author_names" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:layout_gravity="center_horizontal"
android:textSize="@dimen/text_size"
android:text="@string/privacy_friendly"/>
</LinearLayout>
<LinearLayout
android:layout_width="0px"
android:layout_height="fill_parent"
android:orientation="vertical"
android:layout_weight="1">
<TextView
android:id="@+id/textFieldAffiliation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textSize="@dimen/text_size"
android:text="@string/about_affiliation"
android:textStyle="bold" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/secuso_logo_blau_blau" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textSize="@dimen/text_size"
android:layout_marginTop="20dp"
android:text="@string/more_info"/>
<TextView
android:id="@+id/linkID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/url"
android:textSize="@dimen/text_size"
android:textStyle="bold"
android:layout_gravity="center_horizontal"
android:autoLink="web"/>
<TextView
android:id="@+id/qqWing"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/text_size"
android:text="@string/about_qqwing"
android:layout_gravity="center_horizontal"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/text_size"
android:text="@string/about_qqwingLink"
android:layout_gravity="center_horizontal"
android:autoLink="web"/>
</LinearLayout>
<!--
-->
</LinearLayout>

View file

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".AboutActivity"
android:weightSum="1">
<ImageView
android:id="@+id/barcodeLogo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/privacyfriendlyappslogo" />
<TextView
android:id="@+id/appName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:text="@string/app_name_long" />
<TextView
android:id="@+id/textFieldVersion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:text="@string/version_number" />
<TextView
android:id="@+id/textFieldAuthor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:text="@string/about_author" />
<TextView
android:id="@+id/textFieldAuthorNames"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="0dp"
android:text="@string/about_author_names" />
<TextView
android:id="@+id/textFieldAffiliation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
android:text="@string/about_affiliation"
android:textStyle="bold" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/secuso_logo_blau_blau" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_gravity="center_horizontal"
android:text="@string/privacy_friendly"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:text="@string/more_info"/>
<TextView
android:id="@+id/linkID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/url"
android:textStyle="bold"
android:layout_gravity="center_horizontal"
android:autoLink="web"/>
<TextView
android:id="@+id/qqWing"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/about_qqwing"
android:layout_gravity="center_horizontal"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/about_qqwingLink"
android:layout_gravity="center_horizontal"
android:autoLink="web"/>
</LinearLayout>

View file

@ -56,7 +56,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="40dp"
android:layout_marginTop="30dp"
android:text="@string/about_affiliation"
android:textStyle="bold" />
@ -70,7 +70,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:layout_marginTop="10dp"
android:layout_gravity="center_horizontal"
android:text="@string/privacy_friendly"/>

View file

@ -62,9 +62,7 @@
android:text="00:00"
android:layout_weight="2"
android:id="@+id/timerView"
android:gravity="right"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"/>
android:gravity="end"/>
</LinearLayout>
</android.support.v7.widget.Toolbar>

View file

@ -44,6 +44,7 @@
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="4">
<android.support.v4.view.ViewPager
android:id="@+id/scroller"
@ -52,17 +53,29 @@
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<ImageView
android:id="@+id/arrow_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_keyboard_arrow_left_black_24dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"/>
android:layout_alignParentStart="true"
android:padding="@dimen/activity_horizontal_margin"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_centerVertical="true"
android:onClick="onClick"/>
<ImageView
android:id="@+id/arrow_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_keyboard_arrow_right_black_24dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"/>
android:layout_alignParentEnd="true"
android:padding="@dimen/activity_horizontal_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_centerVertical="true"
android:onClick="onClick"/>
</RelativeLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
@ -87,7 +100,7 @@
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/difficulty_easy"
android:textSize="25dp"/>
android:textSize="@dimen/main_text_difficulty"/>
<RatingBar
android:layout_width="wrap_content"
@ -97,16 +110,17 @@
android:clickable="true"
android:numStars="4"
android:rating="1"
android:stepSize="1" />
android:stepSize="1"/>
<Button
android:textColor="@color/white"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginLeft="@dimen/main_button_padding"
android:layout_marginRight="@dimen/main_button_padding"
android:text="@string/new_game"
android:textStyle="normal"
android:textSize="@dimen/text_size"
android:id="@+id/playButton"
android:layout_gravity="center_horizontal"
android:layout_weight="3"
@ -121,10 +135,11 @@
android:layout_marginTop="20dp"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginLeft="@dimen/main_button_padding"
android:layout_marginRight="@dimen/main_button_padding"
android:text="@string/menu_continue_game"
android:textStyle="normal"
android:textSize="@dimen/text_size"
android:id="@+id/continueButton"
android:layout_gravity="center_horizontal"
android:layout_weight="3"
@ -132,6 +147,7 @@
android:capitalize="none"
android:clickable="false"
android:background="@drawable/standalone_button"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View file

@ -9,7 +9,7 @@
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/app_bar_game_view" tools:context="tu_darmstadt.sudoku.activity.GameActivity">
tools:context="tu_darmstadt.sudoku.activity.GameActivity">
<org.secuso.privacyfriendlysudoku.ui.view.SudokuFieldLayout
android:id="@+id/sudokuLayout"
android:layout_width="match_parent"

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="text_size">25sp</dimen>
<dimen name="main_text_difficulty">40sp</dimen>
<dimen name="main_button_padding">200dp</dimen>
</resources>

View file

@ -2,7 +2,7 @@
<resources>
<color name="colorPrimary">#024265</color>
<color name="colorPrimaryDark">#024265</color>
<color name="colorAccent">#AA0000</color>
<color name="colorAccent">#0274B2</color>
<color name="transparent">#00000000</color>
<color name="lightblue">#0274B2</color>
<color name="middleblue">#8aa5ce</color>

View file

@ -9,4 +9,10 @@
<dimen name="appbar_padding_top">8dp</dimen>
<dimen name="app_bar_height">24dp</dimen>
<dimen name="text_margin">16dp</dimen>
<dimen name="text_size">14sp</dimen>
<dimen name="main_text_difficulty">35sp</dimen>
<dimen name="main_button_padding">30dp</dimen>
</resources>

View file

@ -103,5 +103,65 @@
<!--### Win Strings -->
<string name="win_text">Congratulations!</string>
<string name="win_button_text">continue</string>
<string name="title_activity_help">Help</string>
<!-- Strings related to Settings -->
<!-- Example General settings -->
<string name="pref_header_general">General</string>
<string name="pref_title_social_recommendations">Enable social recommendations</string>
<string name="pref_description_social_recommendations">Recommendations for people to contact
based on your message history
</string>
<string name="pref_title_display_name">Display name</string>
<string name="pref_default_display_name">John Smith</string>
<string name="pref_title_add_friends_to_messages">Add friends to messages</string>
<string-array name="pref_example_list_titles">
<item>Always</item>
<item>When possible</item>
<item>Never</item>
</string-array>
<string-array name="pref_example_list_values">
<item>1</item>
<item>0</item>
<item>-1</item>
</string-array>
<!-- Example settings for Data & Sync -->
<string name="pref_header_data_sync">Data &amp; sync</string>
<string name="pref_title_sync_frequency">Sync frequency</string>
<string-array name="pref_sync_frequency_titles">
<item>15 minutes</item>
<item>30 minutes</item>
<item>1 hour</item>
<item>3 hours</item>
<item>6 hours</item>
<item>Never</item>
</string-array>
<string-array name="pref_sync_frequency_values">
<item>15</item>
<item>30</item>
<item>60</item>
<item>180</item>
<item>360</item>
<item>-1</item>
</string-array>
<string name="pref_title_system_sync_settings">System sync settings</string>
<!-- Example settings for Notifications -->
<string name="pref_header_notifications">Notifications</string>
<string name="pref_title_new_message_notifications">New message notifications</string>
<string name="pref_title_ringtone">Ringtone</string>
<string name="pref_ringtone_silent">Silent</string>
<string name="pref_title_vibrate">Vibrate</string>
<string name="header_help">Help</string>
</resources>

View file

@ -7,12 +7,14 @@
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="WinDialog" parent="@android:style/Theme.Dialog">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@color/transparent</item>
@ -23,4 +25,12 @@
<item name="android:backgroundDimEnabled">false</item>
<item name="android:windowIsFloating">false</item>
</style>
<!-- <style name="FontStyle">
<item name="android:fontFamily"></item>
</style> -->
</resources>

View file

@ -0,0 +1,8 @@
<preference-headers xmlns:android="http://schemas.android.com/apk/res/android">
<!-- These settings headers are only used on tablets. -->
<header android:fragment="org.secuso.privacyfriendlysudoku.ui.HelpActivity$HelpFragment"
android:title="@string/header_help" android:icon="@drawable/ic_info_black_24dp" />
</preference-headers>

View file

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="@string/pref_group_highlight_selection">
<SwitchPreference android:id="@+id/pref_highlight_rows"
android:key="pref_highlight_rows"
android:title="@string/pref_highlight_rows"
android:summary=""
android:defaultValue="true"/>
<SwitchPreference android:id="@+id/pref_highlight_cols"
android:key="pref_highlight_cols"
android:title="@string/pref_highlight_cols"
android:summary=""
android:defaultValue="true"/>
<SwitchPreference android:id="@+id/pref_highlight_secs"
android:key="pref_highlight_secs"
android:title="@string/pref_highlight_secs"
android:summary=""
android:defaultValue="true"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_group_highlight_value">
<SwitchPreference android:id="@+id/pref_highlight_vals"
android:key="pref_highlight_vals"
android:title="@string/pref_highlight_vals"
android:summary="not implemented yet"
android:defaultValue="true"/>
<SwitchPreference android:id="@+id/pref_highlight_notes"
android:key="pref_highlight_notes"
android:title="@string/pref_highlight_notes"
android:summary=""
android:defaultValue="true"/>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,64 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="@string/pref_group_game">
<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"/>
<ListPreference
android:key="pref_symbols"
android:title="@string/pref_symbols"
android:defaultValue="Default"
android:entries="@array/pref_symbols_list_titles"
android:entryValues="@array/pref_symbols_list_values"
android:negativeButtonText="@null"
android:positiveButtonText="@null" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_group_highlight_selection">
<SwitchPreference android:id="@+id/pref_highlight_connected"
android:key="pref_highlight_connected"
android:title="@string/pref_highlight_connected"
android:summary=""
android:defaultValue="true"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_group_highlight_value">
<SwitchPreference android:id="@+id/pref_highlight_vals"
android:key="pref_highlight_vals"
android:title="@string/pref_highlight_vals"
android:summary=""
android:defaultValue="true"/>
<SwitchPreference android:id="@+id/pref_highlight_notes"
android:key="pref_highlight_notes"
android:title="@string/pref_highlight_notes"
android:summary=""
android:defaultValue="true"/>
</PreferenceCategory>
<!-- NOTE: EditTextPreference accepts EditText attributes. -->
<!-- NOTE: EditTextPreference's summary should be set to its value by the activity code. -->
<!-- <EditTextPreference
android:key="example_text"
android:title="@string/pref_title_display_name"
android:defaultValue="@string/pref_default_display_name"
android:selectAllOnFocus="true"
android:inputType="textCapWords"
android:capitalize="words"
android:singleLine="true"
android:maxLines="1" /> -->
<!-- NOTE: Hide buttons to simplify the UI. Users can touch outside the dialog to
dismiss it. -->
<!-- NOTE: ListPreference's summary should be set to its value by the activity code. -->
<!-- <ListPreference
android:key="example_list"
android:title="@string/pref_title_add_friends_to_messages"
android:defaultValue="-1"
android:entries="@array/pref_example_list_titles"
android:entryValues="@array/pref_example_list_values"
android:negativeButtonText="@null"
android:positiveButtonText="@null" /> -->
</PreferenceScreen>

View file

@ -5,9 +5,4 @@
<header android:fragment="org.secuso.privacyfriendlysudoku.ui.SettingsActivity$GamePreferenceFragment"
android:title="@string/pref_header_game" android:icon="@drawable/ic_info_black_24dp" />
<header
android:fragment="org.secuso.privacyfriendlysudoku.ui.SettingsActivity$HighlightingPreferenceFragment"
android:title="Highlighting"
android:icon="@drawable/ic_notifications_black_24dp" />
</preference-headers>

View file

@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files