Added the LoadGame Activity.

Added a Symbol Map to solve issues with saving 2 digit values to file.
LoadGame Activity is now also working.
This commit is contained in:
Christopher Beckmann 2015-11-17 15:42:32 +01:00
parent 4bfdf01a9a
commit 328cc583cc
20 changed files with 348 additions and 271 deletions

View file

@ -31,6 +31,8 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="tu_darmstadt.sudoku.ui.LoadGameActivity" >
</activity>
</application>
</manifest>

View file

@ -242,7 +242,7 @@ public class GameController {
}
//gameID now has a value other than 0 and hopefully unique
FileManager fm = new FileManager(context, settings);
SaveLoadController fm = new SaveLoadController(context, settings);
fm.saveGameState(this);
}

View file

@ -16,7 +16,7 @@ import tu_darmstadt.sudoku.game.GameInfoContainer;
/**
* Created by Chris on 16.11.2015.
*/
public class FileManager {
public class SaveLoadController {
Context context;
private SharedPreferences settings;
@ -24,11 +24,10 @@ public class FileManager {
private static String FILE_EXTENSION = ".txt";
private static String SAVE_PREFIX = "save_";
private static String SAVES_DIR = "saves";
private static String highscoresDir = "highscores";
private static List<GameInfoContainer> list = new LinkedList<>();
public FileManager(Context context, SharedPreferences settings) {
public SaveLoadController(Context context, SharedPreferences settings) {
this.context = context;
this.settings = settings;
}
@ -70,7 +69,6 @@ public class FileManager {
String gameString = new String(bytes);
String[] values = gameString.split("/");
//String[] levels = saves.split("###");
try {
if(values.length < 4) {
throw new IllegalArgumentException("Can not load game info. File seems to be damaged or incomplete.");
@ -100,34 +98,6 @@ public class FileManager {
return result;
}
/*public String loadGameState(int index) {
File dir = context.getDir(SAVES_DIR, 0);
dir.listFiles();
File file = new File(dir, savesFile);
byte[] bytes = new byte[(int)file.length()];
try {
FileInputStream stream = new FileInputStream(file);
try {
stream.read(bytes);
} finally {
stream.close();
}
} catch(IOException e) {
Log.e("File Manager", "Could not load game. IOException occured.");
}
String saves = new String(bytes);
String[] levels = saves.split("###");
for(String level : levels) {
String[] values = level.split("|");
GameType type = Enum.valueOf(GameType.class, values[0]);
}
return saves;
}*/
public void saveGameState(GameController controller) {
String level = GameInfoContainer.getGameInfo(controller);

View file

@ -0,0 +1,28 @@
package tu_darmstadt.sudoku.controller;
/**
* Created by Chris on 17.11.2015.
*/
public enum Symbol {
Default(new char[] {'1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N'}),
Fancy(new char[] {'♪', '♫', '☼', '♥', '♦', '♣', '♠', '•', '○', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N' });
private char[] map;
Symbol(char[] map) {
this.map = map;
}
public static String getSymbol(Symbol type, int value) {
return String.valueOf(type.map[value]);
}
public static int getValue(Symbol type, char c) {
for(int i = 0; i < type.map.length; i++) {
if(type.map[i] == c) return i;
}
return -1;
}
}

View file

@ -3,6 +3,7 @@ package tu_darmstadt.sudoku.game;
import android.util.Log;
import tu_darmstadt.sudoku.controller.GameController;
import tu_darmstadt.sudoku.controller.Symbol;
/**
* Created by Chris on 17.11.2015.
@ -35,23 +36,52 @@ public class GameInfoContainer {
}
public void parseFixedValues(String s){
if(gameType != GameType.Unspecified && gameType != null) {
int size = GameType.getSize(gameType);
int sq = size*size;
if(s.length() != sq) {
throw new IllegalArgumentException("The string must be "+sq+" characters long.");
}
}
fixedValues = new int[s.length()];
for(int i = 0; i < s.length(); i++) {
fixedValues[i] = Integer.parseInt(s.charAt(i)+"");
fixedValues[i] = Symbol.getValue(Symbol.Default, s.charAt(i))+1;
}
}
public void parseSetValues(String s) {
if(gameType != GameType.Unspecified && gameType != null) {
int size = GameType.getSize(gameType);
int sq = size*size;
if(s.length() != sq) {
throw new IllegalArgumentException("The string must be "+sq+" characters long.");
}
}
setValues = new int[s.length()];
for(int i = 0; i < s.length(); i++) {
setValues[i] = Integer.parseInt(s.charAt(i)+"");
setValues[i] = Symbol.getValue(Symbol.Default, s.charAt(i))+1;
}
}
public void parseNotes(String s) {
String[] strings = s.split("-");
int size = GameType.getSize(gameType);
int sq = size*size;
if(gameType != GameType.Unspecified && gameType != null) {
if(strings.length != sq) {
throw new IllegalArgumentException("The string array must have "+sq+" entries.");
}
}
setNotes = new boolean[strings.length][strings[0].length()];
for(int i = 0; i < strings.length; i++) {
if(strings[i].length() != size) {
throw new IllegalArgumentException("The string must be "+size+" characters long.");
}
for(int k = 0; k < strings[i].length(); k++) {
setNotes[i][k] = (strings[i].charAt(k)) == '1' ? true : false;
}
@ -103,7 +133,7 @@ public class GameInfoContainer {
@Override
public StringBuilder action(GameCell gc, StringBuilder existing) {
if (gc.isFixed()) {
existing.append(gc.getValue());
existing.append(Symbol.getSymbol(Symbol.Default, gc.getValue() - 1));
} else {
existing.append(0);
}
@ -118,10 +148,10 @@ public class GameInfoContainer {
controller.actionOnCells(new ICellAction<StringBuilder>() {
@Override
public StringBuilder action(GameCell gc, StringBuilder existing) {
if (gc.isFixed()) {
if (gc.isFixed() || gc.getValue() == 0) {
existing.append(0);
} else {
existing.append(gc.getValue());
existing.append(Symbol.getSymbol(Symbol.Default, gc.getValue() - 1));
}
return existing;
}

View file

@ -15,13 +15,12 @@ import android.view.MenuItem;
import java.util.List;
import tu_darmstadt.sudoku.controller.FileManager;
import tu_darmstadt.sudoku.controller.SaveLoadController;
import tu_darmstadt.sudoku.controller.GameController;
import tu_darmstadt.sudoku.game.GameInfoContainer;
import tu_darmstadt.sudoku.game.GameType;
import tu_darmstadt.sudoku.ui.view.R;
import tu_darmstadt.sudoku.ui.view.SudokuFieldLayout;
import tu_darmstadt.sudoku.ui.view.SudokuButton;
import tu_darmstadt.sudoku.ui.view.SudokuKeyboardLayout;
import tu_darmstadt.sudoku.ui.view.SudokuSpecialButtonLayout;
@ -38,7 +37,8 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
GameType gameType = GameType.Unspecified;
int gameDifficulty = 0;
int loadLevel = 0;
int loadLevelID = 0;
boolean loadLevel = false;
Bundle extras = getIntent().getExtras();
if (extras != null) {
@ -47,7 +47,10 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
gameType = (GameType)extras.get("gameType");
}
gameDifficulty = extras.getInt("gameDifficulty");
loadLevel = extras.getInt("loadLevel");
loadLevel = extras.getBoolean("loadLevel");
if(loadLevel) {
loadLevelID = extras.getInt("loadLevelID");
}
}
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
@ -61,11 +64,11 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
layout = (SudokuFieldLayout)findViewById(R.id.sudokuLayout);
gameController = new GameController(sharedPref);
List<GameInfoContainer> loadableGames = FileManager.getLoadableGameList();
List<GameInfoContainer> loadableGames = SaveLoadController.getLoadableGameList();
if(loadLevel != 0 && loadableGames.size() >= loadLevel) {
// load level from FileManager
gameController.loadLevel(loadableGames.get(loadLevel-1));
if(loadLevel && loadableGames.size() > loadLevelID) {
// load level from SaveLoadController
gameController.loadLevel(loadableGames.get(loadLevelID));
} else {
// load a new level
gameController.loadNewLevel(gameType, gameDifficulty);
@ -133,35 +136,51 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
Intent intent;
if (id == R.id.nav_newgame) {
//create new game
intent = new Intent(this, MainActivity.class);
startActivity(intent);
switch(id) {
case R.id.nav_newgame:
//create new game
intent = new Intent(this, MainActivity.class);
gameController.saveGame(getBaseContext());
finish();
startActivity(intent);
break;
/*} else if (id == R.id.nav_mainmenu) {
//go to main menu
intent = new Intent(this, MainActivity.class);
startActivity(intent);*/
case R.id.nav_continue:
//create new game
intent = new Intent(this, LoadGameActivity.class);
gameController.saveGame(getBaseContext());
finish();
startActivity(intent);
break;
} else if (id == R.id.nav_settings) {
//open settings
intent = new Intent(this,SettingsActivity.class);
startActivity(intent);
case R.id.menu_settings:
//open settings
intent = new Intent(this,SettingsActivity.class);
gameController.saveGame(getBaseContext());
finish();
startActivity(intent);
break;
} else if (id == R.id.nav_highscore) {
// see highscore list
//intent = new Intent(this, HighscoreActivity.class);
//startActivity(intent);
case R.id.nav_highscore:
// see highscore list
//intent = new Intent(this, HighscoreActivity.class);
//startActivity(intent);
break;
} else if (id == R.id.nav_about) {
//open about page
intent = new Intent(this,AboutActivity.class);
startActivity(intent);
case R.id.menu_about:
//open about page
intent = new Intent(this,AboutActivity.class);
gameController.saveGame(getBaseContext());
finish();
startActivity(intent);
break;
} else if (id == R.id.nav_help) {
//open about page
//intent = new Intent(this,HelpActivity.class);
//startActivity(intent);
case R.id.menu_help:
//open about page
//intent = new Intent(this,HelpActivity.class);
//startActivity(intent);
break;
default:
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);

View file

@ -0,0 +1,124 @@
package tu_darmstadt.sudoku.ui;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import java.util.List;
import tu_darmstadt.sudoku.controller.SaveLoadController;
import tu_darmstadt.sudoku.game.GameInfoContainer;
import tu_darmstadt.sudoku.ui.view.R;
public class LoadGameActivity extends AppCompatActivity {
List<GameInfoContainer> loadableGameList;
SharedPreferences settings;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_load_game);
settings = PreferenceManager.getDefaultSharedPreferences(this);
SaveLoadController saveLoadController = new SaveLoadController(this, settings);
loadableGameList = saveLoadController.loadGameStateInfo();
AdapterView.OnItemClickListener clickListener = new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent i = new Intent(parent.getContext(), GameActivity.class);
i.putExtra("loadLevel", true);
i.putExtra("loadLevelID", position);
finish();
startActivity(i);
}
};
AdapterView.OnItemLongClickListener longClickListener = new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
return false;
}
};
ListView listView = (ListView)findViewById(R.id.load_game_list);
listView.setAdapter(new LoadGameAdapter(this, loadableGameList));
listView.setOnItemClickListener(clickListener);
listView.setOnItemLongClickListener(longClickListener);
}
private class LoadGameAdapter extends BaseAdapter {
private Context context;
private List<GameInfoContainer> loadableGameList;
public LoadGameAdapter(Context context, List<GameInfoContainer> loadableGameList) {
this.context = context;
this.loadableGameList = loadableGameList;
}
@Override
public int getCount() {
return loadableGameList.size();
}
@Override
public Object getItem(int position) {
return loadableGameList.get(position);
}
@Override
public long getItemId(int position) {
return loadableGameList.get(position).getID();
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = (View) inflater.inflate(R.layout.list_entry_layout, null);
}
GameInfoContainer gic = loadableGameList.get(position);
TextView name = (TextView)convertView.findViewById(R.id.loadgame_listentry_gametype);
TextView summary=(TextView)convertView.findViewById(R.id.loadgame_listentry_id);
ImageView image = (ImageView)convertView.findViewById(R.id.loadgame_listentry_gametypeimage);
switch(gic.getGameType()) {
case Default_6x6:
image.setImageResource(R.drawable.icon_default_6x6);
break;
case Default_12x12:
image.setImageResource(R.drawable.icon_default_12x12);
break;
case Default_9x9:
image.setImageResource(R.drawable.icon_default_9x9);
break;
default:
image.setImageResource(R.drawable.icon_default_9x9);
}
name.setText(gic.getGameType().name());
summary.setText(String.valueOf(gic.getID()));
return convertView;
}
}
}

View file

@ -23,7 +23,7 @@ import android.widget.TextView;
import java.util.List;
import tu_darmstadt.sudoku.controller.FileManager;
import tu_darmstadt.sudoku.controller.SaveLoadController;
import tu_darmstadt.sudoku.game.GameInfoContainer;
import tu_darmstadt.sudoku.game.GameType;
import tu_darmstadt.sudoku.ui.view.R;
@ -97,10 +97,7 @@ public class MainActivity extends AppCompatActivity {
i = new Intent(this, AboutActivity.class);
break;
case R.id.continueButton:
// TODO continue from file.
i = new Intent(this, GameActivity.class);
int levelNr = 1;
i.putExtra("loadLevel", levelNr);
i = new Intent(this, LoadGameActivity.class);
break;
case R.id.highscoreButton:
// TODO: create highscore screen
@ -144,7 +141,7 @@ public class MainActivity extends AppCompatActivity {
private void refreshContinueButton() {
// enable continue button if we have saved games.
Button continueButton = (Button)findViewById(R.id.continueButton);
FileManager fm = new FileManager(getBaseContext(), settings);
SaveLoadController fm = new SaveLoadController(getBaseContext(), settings);
List<GameInfoContainer> gic = fm.loadGameStateInfo();
if(gic.size() > 0) {
continueButton.setEnabled(true);

View file

@ -8,5 +8,8 @@ public enum CellHighlightTypes {
Selected,
Error,
Connected,
Highlighted // Same Numbers are not connected but might be highlighted.
Value_Highlighted,
Value_Highlighted_Selected,
// Same Numbers are not connected but might be highlighted.
}

View file

@ -11,6 +11,7 @@ import android.view.View;
import android.widget.RelativeLayout;
import tu_darmstadt.sudoku.game.GameCell;
import tu_darmstadt.sudoku.controller.Symbol;
/**
* Created by TMZ_LToP on 10.11.2015.
@ -26,6 +27,7 @@ public class SudokuCellView extends View {
int mCol;
boolean selected;
CellHighlightTypes highlightType = CellHighlightTypes.Default;
Symbol symbolsToUse = Symbol.Default;
public SudokuCellView(Context context) {
@ -97,7 +99,7 @@ public class SudokuCellView extends View {
p.setColor(Color.YELLOW);
p.setAlpha(100);
break;
case Highlighted:
case Value_Highlighted:
p.setColor(Color.YELLOW);
break;
default:
@ -125,9 +127,10 @@ public class SudokuCellView extends View {
for (int i = 0; i < mGameCell.getNotes().length; i++) {
if (mGameCell.getNotes()[i]) {
p.setTypeface(Typeface.SANS_SERIF);
p.setTextSize(mWidth/4);
p.setTextSize(mWidth / 4);
p.setTextAlign(Paint.Align.RIGHT);
canvas.drawText(String.valueOf(i+1),(mWidth*1/12)*k,(mWidth*1/12)*j,p);
// TODO settings: get SymbolEnum from settings
canvas.drawText(String.valueOf(Symbol.getSymbol(symbolsToUse, i)),(mWidth*1/12)*k,(mWidth*1/12)*j,p);
/*canvas.drawText(String.valueOf(1), (mWidth * 1 / 12)*3, (mWidth* 1 / 12)*3, p);
canvas.drawText(String.valueOf(2),(mWidth*1/12)*7, (mWidth* 1 / 12)*7,p );
canvas.drawText(String.valueOf(3),(mWidth*1/12)*11, (mWidth* 1 / 12)*11,p );*/
@ -148,7 +151,8 @@ public class SudokuCellView extends View {
p.setAntiAlias(true);
p.setTextSize(Math.min(mHeight * 3 / 4, mHeight * 3 / 4));
p.setTextAlign(Paint.Align.CENTER);
canvas.drawText(String.valueOf(mGameCell.getValue()), mHeight / 2, mHeight / 2 + mHeight / 4, p);
// TODO settings: get SymbolEnum from settings
canvas.drawText(String.valueOf(Symbol.getSymbol(symbolsToUse, mGameCell.getValue()-1)), mHeight / 2, mHeight / 2 + mHeight / 4, p);
}
public int getRow() {

View file

@ -9,7 +9,7 @@ import android.view.View;
import android.widget.GridLayout;
import tu_darmstadt.sudoku.controller.GameController;
import tu_darmstadt.sudoku.game.GameType;
import tu_darmstadt.sudoku.controller.Symbol;
/**
* Created by TMZ_LToP on 12.11.2015.
@ -22,20 +22,19 @@ public class SudokuKeyboardLayout extends GridLayout {
SudokuButton [] buttons;
GameController gameController;
boolean notesEnabled=false;
Symbol symbolsToUse = Symbol.Default;
OnClickListener listener = new OnClickListener() {
@Override
public void onClick(View v) {
if(v instanceof SudokuButton) {
SudokuButton btn = (SudokuButton)v;
if(notesEnabled) {
gameController.toggleSelectedNote(btn.getValue());
} else {
gameController.setSelectedValue(btn.getValue());
}
if(notesEnabled) {
gameController.toggleSelectedNote(btn.getValue());
} else {
gameController.setSelectedValue(btn.getValue());
}
}
}
};
@ -68,14 +67,12 @@ public class SudokuKeyboardLayout extends GridLayout {
buttons[number].setLayoutParams(p);
buttons[number].setGravity(Gravity.CENTER);
buttons[number].setType(SudokuButtonType.Value);
buttons[number].setText(String.valueOf(number + 1));
// TODO settings: get SymbolEnum from settings
buttons[number].setText(Symbol.getSymbol(symbolsToUse, number));
buttons[number].setValue(number + 1);
buttons[number].setOnClickListener(listener);
addView(buttons[number]);
number++;
}
}
}
@ -84,8 +81,8 @@ public class SudokuKeyboardLayout extends GridLayout {
gameController=gc;
}
public void setNotesEnabled(boolean b) {
notesEnabled = b;
public void toggleNotesEnabled() {
notesEnabled = !notesEnabled;
if(notesEnabled) {
setTextSize(buttons[0].getPaint().getTextSize()/2);
}else {

View file

@ -1,16 +1,12 @@
package tu_darmstadt.sudoku.ui.view;
import android.content.Context;
import android.text.style.TextAppearanceSpan;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.GridLayout;
import android.widget.LinearLayout;
import java.awt.font.TextAttribute;
import java.util.ArrayList;
import tu_darmstadt.sudoku.controller.GameController;
@ -23,7 +19,6 @@ public class SudokuSpecialButtonLayout extends LinearLayout {
SudokuButton [] fixedButtons;
public int fixedButtonsCount = SudokuButtonType.getSpecialButtons().size();
GameController gameController;
boolean notesEnabled=false;
SudokuKeyboardLayout keyboard;
@ -38,9 +33,8 @@ public class SudokuSpecialButtonLayout extends LinearLayout {
gameController.deleteSelectedValue();
break;
case NoteToggle:
notesEnabled = !notesEnabled;
btn.setText(notesEnabled ? "ON" : "OFF");
keyboard.setNotesEnabled(notesEnabled);
btn.setText(keyboard.notesEnabled ? "ON" : "OFF");
keyboard.toggleNotesEnabled();
break;
case Do:
// TODO: not implemented

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
tools:context="tu_darmstadt.sudoku.ui.LoadGameActivity">
<ListView
android:id="@+id/load_game_list"
android:layout_width="match_parent"
android:layout_height="match_parent">
</ListView>
</RelativeLayout>

View file

@ -85,8 +85,7 @@
android:onClick="onClick"
android:capitalize="none"
android:clickable="false"
android:elevation="10dp"
style="?android:attr/borderlessButtonStyle"/>
android:elevation="10dp"/>
<Button
android:layout_width="match_parent"
@ -100,15 +99,13 @@
android:layout_weight="2"
android:onClick="onClick"
android:capitalize="none"
android:clickable="false"
style="?android:attr/borderlessButtonStyle"/>
android:clickable="false"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:weightSum="2"
style="?android:buttonBarStyle">
android:weightSum="2">
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
@ -121,8 +118,7 @@
android:layout_weight="1"
android:onClick="onClick"
android:capitalize="none"
android:clickable="false"
style="?android:attr/borderlessButtonStyle"/>
android:clickable="false"/>
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
@ -135,15 +131,13 @@
android:layout_weight="1"
android:onClick="onClick"
android:capitalize="none"
android:clickable="false"
style="?android:attr/borderlessButtonStyle"/>
android:clickable="false"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:weightSum="2"
style="?android:buttonBarStyle">
android:weightSum="2">
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
@ -156,8 +150,7 @@
android:layout_weight="1"
android:onClick="onClick"
android:capitalize="none"
android:clickable="false"
style="?android:attr/borderlessButtonStyle"/>
android:clickable="false"/>
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
@ -170,8 +163,7 @@
android:layout_weight="1"
android:onClick="onClick"
android:capitalize="none"
android:clickable="false"
style="?android:attr/borderlessButtonStyle"/>
android:clickable="false"/>
</LinearLayout>
</LinearLayout>

View file

@ -32,8 +32,7 @@
android:id="@+id/sudokuSpecialLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/sudokuKeyboardLayout"
>
android:layout_below="@+id/sudokuKeyboardLayout">
</tu_darmstadt.sudoku.ui.view.SudokuSpecialButtonLayout>

View file

@ -8,21 +8,24 @@
android:paddingBottom="@dimen/activity_vertical_margin"
android:gravity="center_horizontal|center_vertical"
android:orientation="vertical"
android:weightSum="8"
tools:context="tu_darmstadt.sudoku.ui.MainActivity$GameTypeFragment">
<TextView android:id="@+id/section_label"
android:text="Label"
android:textStyle="bold"
android:textSize="20dp"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ImageView
android:layout_weight="5"
android:id="@+id/gameTypeImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:layout_centerInParent="true"
android:src="@drawable/icon_default_9x9"/>
android:src="@drawable/icon_default_9x9"
android:layout_height="0dp" />
</LinearLayout>

View file

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:weightSum="10"
android:orientation="horizontal">
<ImageView
android:id="@+id/loadgame_listentry_gametypeimage"
android:layout_height="match_parent"
android:layout_width="40dp"
android:layout_marginRight="10dp"
android:adjustViewBounds="true"
android:src="@drawable/icon_default_9x9"/>
<RelativeLayout
android:layout_width="0dp"
android:layout_weight="4"
android:layout_height="match_parent">
<TextView
android:text="ID"
android:id="@+id/loadgame_listentry_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:text="gametype"
android:layout_below="@+id/loadgame_listentry_id"
android:id="@+id/loadgame_listentry_gametype"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
</LinearLayout>

View file

@ -3,19 +3,19 @@
<group android:checkableBehavior="single">
<item android:id="@+id/nav_newgame" android:icon="@android:drawable/ic_menu_today"
android:title="@string/new_game" />
<item android:id="@+id/nav_mainmenu" android:icon="@android:drawable/ic_menu_gallery"
android:title="@string/menu_main" />
android:title="@string/menu_new_game" />
<item android:id="@+id/nav_continue" android:icon="@android:drawable/ic_menu_gallery"
android:title="@string/menu_continue_game" />
<item android:id="@+id/nav_highscore" android:icon="@android:drawable/ic_menu_myplaces"
android:title="@string/menu_highscore" />
</group>
<group android:menuCategory="container" android:title="">
<menu>
<item android:id="@+id/nav_settings" android:icon="@android:drawable/ic_menu_manage"
<item android:id="@+id/menu_settings" android:icon="@android:drawable/ic_menu_manage"
android:title="@string/menu_settings" />
<item android:id="@+id/nav_help" android:icon="@android:drawable/ic_menu_help"
<item android:id="@+id/menu_help" android:icon="@android:drawable/ic_menu_help"
android:title="@string/menu_help" />
<item android:id="@+id/nav_about" android:icon="@android:drawable/ic_menu_info_details"
<item android:id="@+id/menu_about" android:icon="@android:drawable/ic_menu_info_details"
android:title="@string/menu_about" />
</menu>
</group>

View file

@ -2,5 +2,5 @@
<resources>
<color name="colorPrimary">#024265</color>
<color name="colorPrimaryDark">#024265</color>
<color name="colorAccent">#FFFF00</color>
<color name="colorAccent">#AA0000</color>
</resources>

View file

@ -6,7 +6,6 @@
<string name="menu_new_game">New Game</string>
<string name="menu_settings">Settings</string>
<string name="menu_highscore">Highscore</string>
<string name="menu_main">Main Menu</string>
<string name="menu_group">Group</string>
<string name="menu_help">Help</string>
<string name="menu_about">About</string>
@ -17,25 +16,22 @@
<string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string>
<string name="title_activity_load_game">Load Game</string>
<!-- ###SETTINGS### -->
<string name="title_activity_settings">Settings</string>
<string name="action_settings">Settings</string>
<!-- #Highlight -->
<string name="pref_header_highlight">Highlighting</string>
<string name="pref_group_highlight_selection">Selection highlight</string>
<string name="pref_highlight_rows">Connected rows</string>
<string name="pref_highlight_cols">Connected columns</string>
<string name="pref_highlight_secs">Connected sections</string>
<string name="pref_group_highlight_value">Value highlight</string>
<string name="pref_highlight_vals">Same values</string>
<string name="pref_highlight_notes">Notes</string>
<!-- #Game -->
<string name="pref_header_game">Game</string>
<string name="pref_group_game">Game settings</string>
<string name="pref_automatic_note_deletion">Note deletion</string>
<string name="pref_automatic_note_deletion_summary">Automatically remove notes when setting values on connected cells</string>
@ -43,7 +39,7 @@
<!-- ###ABOUT### -->
<string name="app_name_long">Privacy friendly Sudoku</string>
<string name="version_number">v0.8</string>
<string name="version_number">v0.9</string>
<string name="about_author">Author:</string>
<string name="about_author_names">Christopher Beckmann, Timm Lippert</string>
<string name="about_affiliation">In affiliation with:</string>
@ -51,139 +47,4 @@
<string name="more_info">More information can be found on:</string>
<string name="url"><a href="https://www.secuso.informatik.tu-darmstadt.de/en/research/results/">https://www.secuso.org</a></string>
<string-array name="testarray">
<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 name="test">Test String</string>
<string name="title_activity_main_menu">MainMenuActivity</string>
<string name="section_format">Hello World from section: %1$d</string>
<string name="title_activity_test">testActivity</string>
<string name="title_activity_load_game">LoadGameActivity</string>
<string name="large_text">
"Material is the metaphor.\n\n"
"A material metaphor is the unifying theory of a rationalized space and a system of motion."
"The material is grounded in tactile reality, inspired by the study of paper and ink, yet "
"technologically advanced and open to imagination and magic.\n"
"Surfaces and edges of the material provide visual cues that are grounded in reality. The "
"use of familiar tactile attributes helps users quickly understand affordances. Yet the "
"flexibility of the material creates new affordances that supercede those in the physical "
"world, without breaking the rules of physics.\n"
"The fundamentals of light, surface, and movement are key to conveying how objects move, "
"interact, and exist in space and in relation to each other. Realistic lighting shows "
"seams, divides space, and indicates moving parts.\n\n"
"Bold, graphic, intentional.\n\n"
"The foundational elements of print based design typography, grids, space, scale, color, "
"and use of imagery guide visual treatments. These elements do far more than please the "
"eye. They create hierarchy, meaning, and focus. Deliberate color choices, edge to edge "
"imagery, large scale typography, and intentional white space create a bold and graphic "
"interface that immerse the user in the experience.\n"
"An emphasis on user actions makes core functionality immediately apparent and provides "
"waypoints for the user.\n\n"
"Motion provides meaning.\n\n"
"Motion respects and reinforces the user as the prime mover. Primary user actions are "
"inflection points that initiate motion, transforming the whole design.\n"
"All action takes place in a single environment. Objects are presented to the user without "
"breaking the continuity of experience even as they transform and reorganize.\n"
"Motion is meaningful and appropriate, serving to focus attention and maintain continuity. "
"Feedback is subtle yet clear. Transitions are efficient yet coherent.\n\n"
"3D world.\n\n"
"The material environment is a 3D space, which means all objects have x, y, and z "
"dimensions. The z-axis is perpendicularly aligned to the plane of the display, with the "
"positive z-axis extending towards the viewer. Every sheet of material occupies a single "
"position along the z-axis and has a standard 1dp thickness.\n"
"On the web, the z-axis is used for layering and not for perspective. The 3D world is "
"emulated by manipulating the y-axis.\n\n"
"Light and shadow.\n\n"
"Within the material environment, virtual lights illuminate the scene. Key lights create "
"directional shadows, while ambient light creates soft shadows from all angles.\n"
"Shadows in the material environment are cast by these two light sources. In Android "
"development, shadows occur when light sources are blocked by sheets of material at "
"various positions along the z-axis. On the web, shadows are depicted by manipulating the "
"y-axis only. The following example shows the card with a height of 6dp.\n\n"
"Resting elevation.\n\n"
"All material objects, regardless of size, have a resting elevation, or default elevation "
"that does not change. If an object changes elevation, it should return to its resting "
"elevation as soon as possible.\n\n"
"Component elevations.\n\n"
"The resting elevation for a component type is consistent across apps (e.g., FAB elevation "
"does not vary from 6dp in one app to 16dp in another app).\n"
"Components may have different resting elevations across platforms, depending on the depth "
"of the environment (e.g., TV has a greater depth than mobile or desktop).\n\n"
"Responsive elevation and dynamic elevation offsets.\n\n"
"Some component types have responsive elevation, meaning they change elevation in response "
"to user input (e.g., normal, focused, and pressed) or system events. These elevation "
"changes are consistently implemented using dynamic elevation offsets.\n"
"Dynamic elevation offsets are the goal elevation that a component moves towards, relative "
"to the components resting state. They ensure that elevation changes are consistent "
"across actions and component types. For example, all components that lift on press have "
"the same elevation change relative to their resting elevation.\n"
"Once the input event is completed or cancelled, the component will return to its resting "
"elevation.\n\n"
"Avoiding elevation interference.\n\n"
"Components with responsive elevations may encounter other components as they move between "
"their resting elevations and dynamic elevation offsets. Because material cannot pass "
"through other material, components avoid interfering with one another any number of ways, "
"whether on a per component basis or using the entire app layout.\n"
"On a component level, components can move or be removed before they cause interference. "
"For example, a floating action button (FAB) can disappear or move off screen before a "
"user picks up a card, or it can move if a snackbar appears.\n"
"On the layout level, design your app layout to minimize opportunities for interference. "
"For example, position the FAB to one side of stream of a cards so the FAB wont interfere "
"when a user tries to pick up one of cards.\n\n"
</string>
<!-- end of valid settings -->
<!-- <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>
<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> -->
</resources>