Merge remote-tracking branch 'origin/master'
# Conflicts: # app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java
This commit is contained in:
commit
06dd3fa9fa
15 changed files with 1206 additions and 205 deletions
|
@ -3,11 +3,15 @@ package org.secuso.privacyfriendlysudoku.controller;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
import org.secuso.privacyfriendlysudoku.controller.helper.GameInfoContainer;
|
import org.secuso.privacyfriendlysudoku.controller.helper.GameInfoContainer;
|
||||||
import org.secuso.privacyfriendlysudoku.game.CellConflict;
|
import org.secuso.privacyfriendlysudoku.game.CellConflict;
|
||||||
|
@ -26,7 +30,7 @@ import org.secuso.privacyfriendlysudoku.game.listener.ITimerListener;
|
||||||
/**
|
/**
|
||||||
* Created by Chris on 06.11.2015.
|
* Created by Chris on 06.11.2015.
|
||||||
*/
|
*/
|
||||||
public class GameController implements IModelChangedListener {
|
public class GameController implements IModelChangedListener, Parcelable {
|
||||||
|
|
||||||
// General
|
// General
|
||||||
private SharedPreferences settings;
|
private SharedPreferences settings;
|
||||||
|
@ -50,7 +54,7 @@ public class GameController implements IModelChangedListener {
|
||||||
private int sectionWidth;
|
private int sectionWidth;
|
||||||
private int usedHints = 0;
|
private int usedHints = 0;
|
||||||
private GameBoard gameBoard;
|
private GameBoard gameBoard;
|
||||||
private int[] solution;
|
private int[] solution = new int[0];
|
||||||
private GameType gameType;
|
private GameType gameType;
|
||||||
private GameDifficulty difficulty;
|
private GameDifficulty difficulty;
|
||||||
private CellConflictList errorList = new CellConflictList();
|
private CellConflictList errorList = new CellConflictList();
|
||||||
|
@ -63,11 +67,12 @@ public class GameController implements IModelChangedListener {
|
||||||
|
|
||||||
// Timer
|
// Timer
|
||||||
private int time = 0;
|
private int time = 0;
|
||||||
private boolean timerRunning = false;
|
private AtomicBoolean timerRunning = new AtomicBoolean(false);
|
||||||
private LinkedList<ITimerListener> timerListeners = new LinkedList<>();
|
private LinkedList<ITimerListener> timerListeners = new LinkedList<>();
|
||||||
private Handler timerHandler = new Handler();
|
private Handler timerHandler = new Handler();
|
||||||
private Timer timer = new Timer();
|
private Timer timer = new Timer();
|
||||||
private TimerTask timerTask;
|
private TimerTask timerTask;
|
||||||
|
|
||||||
private boolean noteStatus = false;
|
private boolean noteStatus = false;
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
@ -155,7 +160,7 @@ public class GameController implements IModelChangedListener {
|
||||||
|
|
||||||
public int[] solve() {
|
public int[] solve() {
|
||||||
|
|
||||||
if(solution == null) {
|
if(solution == null || solution.length == 0) {
|
||||||
solution = qqWingController.solve(gameBoard);
|
solution = qqWingController.solve(gameBoard);
|
||||||
}
|
}
|
||||||
return solution;
|
return solution;
|
||||||
|
@ -464,7 +469,7 @@ public class GameController implements IModelChangedListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteSelectedCellsValue() {
|
public void deleteSelectedCellsValue() {
|
||||||
if(isValidCellSelected() && getSelectedCellsValue() != 0) {
|
if(isValidCellSelected()) {
|
||||||
deleteValue(selectedRow, selectedCol);
|
deleteValue(selectedRow, selectedCol);
|
||||||
// add state to undo
|
// add state to undo
|
||||||
undoRedoManager.addState(gameBoard);
|
undoRedoManager.addState(gameBoard);
|
||||||
|
@ -584,31 +589,40 @@ public class GameController implements IModelChangedListener {
|
||||||
return usedHints;
|
return usedHints;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initTimer() {
|
public void initTimer() {
|
||||||
|
deleteTimer();
|
||||||
|
|
||||||
timerTask = new TimerTask() {
|
timerTask = new TimerTask() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
timerHandler.post(new Runnable() {
|
timerHandler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if(timerRunning) {
|
if(timerRunning.get()) {
|
||||||
notifyTimerListener(time++);
|
notifyTimerListener(time++);
|
||||||
|
//Log.d("Timer", "calling notifyTimerListener(" + time + ");");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
timer = new Timer();
|
timer = new Timer();
|
||||||
timer.scheduleAtFixedRate(timerTask,0,1000);
|
timer.scheduleAtFixedRate(timerTask, 0, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteTimer() {
|
||||||
|
pauseTimer();
|
||||||
|
timer.cancel();
|
||||||
|
timer.purge();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startTimer() {
|
public void startTimer() {
|
||||||
timerRunning = true;
|
timerRunning.set(true);
|
||||||
notifyHighlightChangedListeners();
|
notifyHighlightChangedListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pauseTimer(){
|
public void pauseTimer(){
|
||||||
timerRunning = false;
|
timerRunning.set(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReDo() {
|
public void ReDo() {
|
||||||
|
@ -665,4 +679,92 @@ public class GameController implements IModelChangedListener {
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(Parcel out, int flags) {
|
||||||
|
|
||||||
|
// get the gamecontroller a new context
|
||||||
|
out.writeInt(selectedRow);
|
||||||
|
out.writeInt(selectedCol);
|
||||||
|
out.writeInt(selectedValue);
|
||||||
|
out.writeInt(highlightValue);
|
||||||
|
out.writeInt(gameID);
|
||||||
|
out.writeInt(size);
|
||||||
|
out.writeInt(sectionHeight);
|
||||||
|
out.writeInt(sectionWidth);
|
||||||
|
out.writeInt(usedHints);
|
||||||
|
out.writeInt(time);
|
||||||
|
|
||||||
|
out.writeInt(solution.length);
|
||||||
|
out.writeIntArray(solution);
|
||||||
|
|
||||||
|
out.writeInt(noteStatus ? 1 : 0);
|
||||||
|
out.writeInt(notifiedOnSolvedListeners ? 1 : 0);
|
||||||
|
|
||||||
|
out.writeParcelable(gameType, 0);
|
||||||
|
out.writeParcelable(difficulty, 0);
|
||||||
|
out.writeParcelable(gameBoard, 0);
|
||||||
|
out.writeParcelable(undoRedoManager, 0);
|
||||||
|
|
||||||
|
// delete lists, in case we get the same object back from Parcel
|
||||||
|
removeAllListeners();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final Parcelable.Creator<GameController> CREATOR = new Parcelable.Creator<GameController>() {
|
||||||
|
public GameController createFromParcel(Parcel in) {
|
||||||
|
return new GameController(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GameController[] newArray(int size) {
|
||||||
|
return new GameController[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/** recreate object from parcel */
|
||||||
|
private GameController(Parcel in) {
|
||||||
|
|
||||||
|
selectedRow = in.readInt();
|
||||||
|
selectedCol = in.readInt();
|
||||||
|
selectedValue = in.readInt();
|
||||||
|
highlightValue = in.readInt();
|
||||||
|
gameID = in.readInt();
|
||||||
|
size = in.readInt();
|
||||||
|
sectionHeight = in.readInt();
|
||||||
|
sectionWidth = in.readInt();
|
||||||
|
usedHints = in.readInt();
|
||||||
|
time = in.readInt();
|
||||||
|
|
||||||
|
solution = new int[in.readInt()];
|
||||||
|
in.readIntArray(solution);
|
||||||
|
|
||||||
|
noteStatus = in.readInt() == 1;
|
||||||
|
notifiedOnSolvedListeners = in.readInt() == 1;
|
||||||
|
|
||||||
|
gameType = in.readParcelable(GameType.class.getClassLoader());
|
||||||
|
difficulty = in.readParcelable(GameDifficulty.class.getClassLoader());
|
||||||
|
gameBoard = in.readParcelable(GameBoard.class.getClassLoader());
|
||||||
|
undoRedoManager = in.readParcelable(UndoRedoManager.class.getClassLoader());
|
||||||
|
|
||||||
|
removeAllListeners();
|
||||||
|
|
||||||
|
gameBoard.removeAllListeners();
|
||||||
|
gameBoard.registerOnModelChangeListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeAllListeners() {
|
||||||
|
highlightListeners = new LinkedList<>();
|
||||||
|
solvedListeners = new LinkedList<>();
|
||||||
|
hintListener = new LinkedList<>();
|
||||||
|
timerListeners = new LinkedList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContextAndSettings(Context applicationContext, SharedPreferences sharedPref) {
|
||||||
|
context = applicationContext;
|
||||||
|
setSettings(sharedPref);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.secuso.privacyfriendlysudoku.controller;
|
package org.secuso.privacyfriendlysudoku.controller;
|
||||||
|
|
||||||
|
import android.os.Parcelable;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package org.secuso.privacyfriendlysudoku.controller;
|
package org.secuso.privacyfriendlysudoku.controller;
|
||||||
|
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
import org.secuso.privacyfriendlysudoku.game.GameBoard;
|
import org.secuso.privacyfriendlysudoku.game.GameBoard;
|
||||||
|
@ -7,7 +10,7 @@ import org.secuso.privacyfriendlysudoku.game.GameBoard;
|
||||||
/**
|
/**
|
||||||
* Created by Chris on 24.11.2015.
|
* Created by Chris on 24.11.2015.
|
||||||
*/
|
*/
|
||||||
public class UndoRedoManager {
|
public class UndoRedoManager implements Parcelable {
|
||||||
|
|
||||||
private int activeState;
|
private int activeState;
|
||||||
private LinkedList<GameBoard> states = new LinkedList<>();
|
private LinkedList<GameBoard> states = new LinkedList<>();
|
||||||
|
@ -78,4 +81,33 @@ public class UndoRedoManager {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(Parcel out, int flags) {
|
||||||
|
out.writeInt(activeState);
|
||||||
|
out.writeTypedList(states);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final Parcelable.Creator<UndoRedoManager> CREATOR
|
||||||
|
= new Parcelable.Creator<UndoRedoManager>() {
|
||||||
|
public UndoRedoManager createFromParcel(Parcel in) {
|
||||||
|
return new UndoRedoManager(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
public UndoRedoManager[] newArray(int size) {
|
||||||
|
return new UndoRedoManager[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/** recreate object from parcel */
|
||||||
|
private UndoRedoManager(Parcel in) {
|
||||||
|
activeState = in.readInt();
|
||||||
|
in.readTypedList(states, GameBoard.CREATOR);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package org.secuso.privacyfriendlysudoku.game;
|
package org.secuso.privacyfriendlysudoku.game;
|
||||||
|
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -8,7 +11,7 @@ import org.secuso.privacyfriendlysudoku.game.listener.IModelChangedListener;
|
||||||
/**
|
/**
|
||||||
* Created by Christopher Beckmann on 06.11.2015.
|
* Created by Christopher Beckmann on 06.11.2015.
|
||||||
*/
|
*/
|
||||||
public class GameBoard implements Cloneable {
|
public class GameBoard implements Cloneable, Parcelable {
|
||||||
|
|
||||||
//private int id;
|
//private int id;
|
||||||
private GameType gameType;
|
private GameType gameType;
|
||||||
|
@ -17,7 +20,6 @@ public class GameBoard implements Cloneable {
|
||||||
//private List additionalSections
|
//private List additionalSections
|
||||||
private int size;
|
private int size;
|
||||||
private GameCell[][] field;
|
private GameCell[][] field;
|
||||||
private List<IModelChangedListener> modelChangedListeners = new LinkedList<>();
|
|
||||||
|
|
||||||
public GameBoard(GameType gameType) {
|
public GameBoard(GameType gameType) {
|
||||||
this.gameType = gameType;
|
this.gameType = gameType;
|
||||||
|
@ -220,7 +222,6 @@ public class GameBoard implements Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerOnModelChangeListener(final IModelChangedListener listener) {
|
public void registerOnModelChangeListener(final IModelChangedListener listener) {
|
||||||
if(!modelChangedListeners.contains(listener)) {
|
|
||||||
actionOnCells(new ICellAction<Boolean>() {
|
actionOnCells(new ICellAction<Boolean>() {
|
||||||
@Override
|
@Override
|
||||||
public Boolean action(GameCell gc, Boolean existing) {
|
public Boolean action(GameCell gc, Boolean existing) {
|
||||||
|
@ -228,22 +229,6 @@ public class GameBoard implements Cloneable {
|
||||||
return existing;
|
return existing;
|
||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
modelChangedListeners.add(listener);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deleteOnModelChangeListener(final IModelChangedListener listener) {
|
|
||||||
if(modelChangedListeners.contains(listener)) {
|
|
||||||
actionOnCells(new ICellAction<Boolean>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean action(GameCell gc, Boolean existing) {
|
|
||||||
gc.removeOnModelChangeListener(listener);
|
|
||||||
return existing;
|
|
||||||
}
|
|
||||||
}, false);
|
|
||||||
modelChangedListeners.remove(listener);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -272,4 +257,58 @@ public class GameBoard implements Cloneable {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
|
||||||
|
dest.writeParcelable(gameType, 0);
|
||||||
|
dest.writeInt(sectionHeight);
|
||||||
|
dest.writeInt(sectionWidth);
|
||||||
|
dest.writeInt(size);
|
||||||
|
|
||||||
|
for(int i = 0; i < field.length; i++) {
|
||||||
|
dest.writeTypedArray(field[i], 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public static final Parcelable.Creator<GameBoard> CREATOR
|
||||||
|
= new Parcelable.Creator<GameBoard>() {
|
||||||
|
public GameBoard createFromParcel(Parcel in) {
|
||||||
|
return new GameBoard(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GameBoard[] newArray(int size) {
|
||||||
|
return new GameBoard[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/** recreate object from parcel */
|
||||||
|
private GameBoard(Parcel in) {
|
||||||
|
//private int id;
|
||||||
|
gameType = in.readParcelable(GameType.class.getClassLoader());
|
||||||
|
sectionHeight = in.readInt();
|
||||||
|
sectionWidth = in.readInt();
|
||||||
|
size = in.readInt();
|
||||||
|
|
||||||
|
field = new GameCell[size][size];
|
||||||
|
|
||||||
|
for(int i = 0; i < field.length; i++) {
|
||||||
|
field[i] = in.createTypedArray(GameCell.CREATOR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeAllListeners() {
|
||||||
|
actionOnCells(new ICellAction<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public Boolean action(GameCell gc, Boolean existing) {
|
||||||
|
gc.removeAllListeners();
|
||||||
|
return existing;
|
||||||
|
}
|
||||||
|
}, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,22 @@
|
||||||
package org.secuso.privacyfriendlysudoku.game;
|
package org.secuso.privacyfriendlysudoku.game;
|
||||||
|
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.ListIterator;
|
||||||
|
|
||||||
import org.secuso.privacyfriendlysudoku.game.listener.IModelChangedListener;
|
import org.secuso.privacyfriendlysudoku.game.listener.IModelChangedListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Chris on 06.11.2015.
|
* Created by Chris on 06.11.2015.
|
||||||
*/
|
*/
|
||||||
public class GameCell implements Cloneable {
|
public class GameCell implements Cloneable, Parcelable {
|
||||||
|
|
||||||
private int row = 0;
|
private int row = 0;
|
||||||
private int col = 0;
|
private int col = 0;
|
||||||
|
@ -199,4 +206,49 @@ public class GameCell implements Cloneable {
|
||||||
m.onModelChange(this);
|
m.onModelChange(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
dest.writeInt(row);
|
||||||
|
dest.writeInt(col);
|
||||||
|
dest.writeInt(value);
|
||||||
|
dest.writeInt(size);
|
||||||
|
dest.writeInt(fixed ? 1 : 0);
|
||||||
|
dest.writeInt(noteCount);
|
||||||
|
dest.writeBooleanArray(notes);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final Parcelable.Creator<GameCell> CREATOR
|
||||||
|
= new Parcelable.Creator<GameCell>() {
|
||||||
|
public GameCell createFromParcel(Parcel in) {
|
||||||
|
return new GameCell(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GameCell[] newArray(int size) {
|
||||||
|
return new GameCell[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/** recreate object from parcel */
|
||||||
|
private GameCell(Parcel in) {
|
||||||
|
row = in.readInt();
|
||||||
|
col = in.readInt();
|
||||||
|
value = in.readInt();
|
||||||
|
size = in.readInt();
|
||||||
|
fixed = in.readInt() == 1;
|
||||||
|
noteCount = in.readInt();
|
||||||
|
notes = new boolean[size];
|
||||||
|
in.readBooleanArray(notes);
|
||||||
|
|
||||||
|
removeAllListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeAllListeners() {
|
||||||
|
modelChangedListeners = new LinkedList<>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package org.secuso.privacyfriendlysudoku.game;
|
package org.secuso.privacyfriendlysudoku.game;
|
||||||
|
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
import android.support.annotation.StringRes;
|
import android.support.annotation.StringRes;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
@ -9,7 +11,7 @@ import org.secuso.privacyfriendlysudoku.ui.view.R;
|
||||||
/**
|
/**
|
||||||
* Created by Chris on 18.11.2015.
|
* Created by Chris on 18.11.2015.
|
||||||
*/
|
*/
|
||||||
public enum GameDifficulty {
|
public enum GameDifficulty implements Parcelable {
|
||||||
|
|
||||||
Unspecified(R.string.gametype_unspecified),
|
Unspecified(R.string.gametype_unspecified),
|
||||||
Easy(R.string.difficulty_easy),
|
Easy(R.string.difficulty_easy),
|
||||||
|
@ -35,4 +37,28 @@ public enum GameDifficulty {
|
||||||
return validList;
|
return validList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
dest.writeInt(ordinal());
|
||||||
|
dest.writeInt(resID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final Parcelable.Creator<GameDifficulty> CREATOR
|
||||||
|
= new Parcelable.Creator<GameDifficulty>() {
|
||||||
|
public GameDifficulty createFromParcel(Parcel in) {
|
||||||
|
GameDifficulty g = GameDifficulty.values()[in.readInt()];
|
||||||
|
g.resID = in.readInt();
|
||||||
|
return g;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GameDifficulty[] newArray(int size) {
|
||||||
|
return new GameDifficulty[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package org.secuso.privacyfriendlysudoku.game;
|
package org.secuso.privacyfriendlysudoku.game;
|
||||||
|
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
import org.secuso.privacyfriendlysudoku.ui.view.R;
|
import org.secuso.privacyfriendlysudoku.ui.view.R;
|
||||||
|
@ -7,14 +10,15 @@ import org.secuso.privacyfriendlysudoku.ui.view.R;
|
||||||
/**
|
/**
|
||||||
* Created by Chris on 09.11.2015.
|
* Created by Chris on 09.11.2015.
|
||||||
*/
|
*/
|
||||||
public enum GameType {
|
public enum GameType implements Parcelable{
|
||||||
Unspecified(1,1,1,R.string.gametype_unspecified,R.drawable.icon_default_6x6),
|
Unspecified(1,1,1,R.string.gametype_unspecified,R.drawable.icon_default_6x6),
|
||||||
Default_9x9(9,3,3,R.string.gametype_default_9x9,R.drawable.icon_default_9x9),
|
Default_9x9(9,3,3,R.string.gametype_default_9x9,R.drawable.icon_default_9x9),
|
||||||
Default_12x12(12,3,4,R.string.gametype_default_12x12,R.drawable.icon_default_12x12),
|
Default_12x12(12,3,4,R.string.gametype_default_12x12,R.drawable.icon_default_12x12),
|
||||||
Default_6x6(6,2,3,R.string.gametype_default_6x6,R.drawable.icon_default_6x6),
|
Default_6x6(6,2,3,R.string.gametype_default_6x6,R.drawable.icon_default_6x6),
|
||||||
X_9x9(9,3,3,R.string.gametype_x_9x9,R.drawable.icon_default_9x9),
|
X_9x9(9,3,3,R.string.gametype_x_9x9,R.drawable.icon_default_9x9),
|
||||||
Hyper_9x9(9,3,3,R.string.gametype_hyper_9x9,R.drawable.icon_default_9x9);
|
Hyper_9x9(9,3,3,R.string.gametype_hyper_9x9,R.drawable.icon_default_9x9);
|
||||||
//TODO: change pictures for unsepc x9x9 and hyper 9x9 as soon as available
|
|
||||||
|
// change pictures for unsepc x9x9 and hyper 9x9 as soon as available
|
||||||
int resIDString;
|
int resIDString;
|
||||||
int sectionWidth;
|
int sectionWidth;
|
||||||
int sectionHeight;
|
int sectionHeight;
|
||||||
|
@ -53,4 +57,34 @@ public enum GameType {
|
||||||
return resIDString;
|
return resIDString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
dest.writeInt(ordinal());
|
||||||
|
dest.writeInt(resIDString);
|
||||||
|
dest.writeInt(sectionWidth);
|
||||||
|
dest.writeInt(sectionHeight);
|
||||||
|
dest.writeInt(size);
|
||||||
|
dest.writeInt(resIDImage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final Parcelable.Creator<GameType> CREATOR = new Parcelable.Creator<GameType>() {
|
||||||
|
public GameType createFromParcel(Parcel in) {
|
||||||
|
GameType g = GameType.values()[in.readInt()];
|
||||||
|
g.resIDString = in.readInt();
|
||||||
|
g.sectionWidth = in.readInt();
|
||||||
|
g.sectionHeight = in.readInt();
|
||||||
|
g.size = in.readInt();
|
||||||
|
g.resIDImage = in.readInt();
|
||||||
|
return g;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GameType[] newArray(int size) {
|
||||||
|
return new GameType[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,10 @@ import android.app.DialogFragment;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.res.Configuration;
|
||||||
import android.graphics.Point;
|
import android.graphics.Point;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Parcelable;
|
||||||
import android.preference.PreferenceActivity;
|
import android.preference.PreferenceActivity;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.design.widget.NavigationView;
|
import android.support.design.widget.NavigationView;
|
||||||
|
@ -24,6 +26,7 @@ import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.RatingBar;
|
import android.widget.RatingBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
@ -66,25 +69,48 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
|
||||||
|
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
GameType gameType = GameType.Unspecified;
|
GameType gameType = GameType.Unspecified;
|
||||||
GameDifficulty gameDifficulty = GameDifficulty.Unspecified;
|
GameDifficulty gameDifficulty = GameDifficulty.Unspecified;
|
||||||
int loadLevelID = 0;
|
int loadLevelID = 0;
|
||||||
boolean loadLevel = false;
|
boolean loadLevel = false;
|
||||||
|
|
||||||
Bundle extras = getIntent().getExtras();
|
if(savedInstanceState == null) {
|
||||||
if (extras != null) {
|
|
||||||
Object o = extras.get("gameType");
|
Bundle extras = getIntent().getExtras();
|
||||||
if(o instanceof GameType) {
|
if (extras != null) {
|
||||||
gameType = (GameType)extras.get("gameType");
|
Object o = extras.get("gameType");
|
||||||
|
if (o instanceof GameType) {
|
||||||
|
gameType = (GameType) extras.get("gameType");
|
||||||
|
}
|
||||||
|
gameDifficulty = (GameDifficulty) (extras.get("gameDifficulty"));
|
||||||
|
loadLevel = extras.getBoolean("loadLevel", false);
|
||||||
|
if (loadLevel) {
|
||||||
|
loadLevelID = extras.getInt("loadLevelID");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
gameDifficulty = (GameDifficulty)(extras.get("gameDifficulty"));
|
|
||||||
loadLevel = extras.getBoolean("loadLevel", false);
|
gameController = new GameController(sharedPref, getApplicationContext());
|
||||||
if(loadLevel) {
|
|
||||||
loadLevelID = extras.getInt("loadLevelID");
|
List<GameInfoContainer> loadableGames = GameStateManager.getLoadableGameList();
|
||||||
|
|
||||||
|
if (loadLevel && loadableGames.size() > loadLevelID) {
|
||||||
|
// load level from GameStateManager
|
||||||
|
gameController.loadLevel(loadableGames.get(loadLevelID));
|
||||||
|
} else {
|
||||||
|
// load a new level
|
||||||
|
gameController.loadNewLevel(gameType, gameDifficulty);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
gameController = savedInstanceState.getParcelable("gameController");
|
||||||
|
// in case we get the same object back
|
||||||
|
// because parceling the Object does not always parcel it. Only if needed.
|
||||||
|
gameController.removeAllListeners();
|
||||||
|
gameController.setContextAndSettings(getApplicationContext(), sharedPref);
|
||||||
|
gameSolved = savedInstanceState.getInt("gameSolved") == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
|
||||||
|
|
||||||
setContentView(R.layout.activity_game_view);
|
setContentView(R.layout.activity_game_view);
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
|
@ -93,19 +119,9 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
||||||
|
|
||||||
//Create new GameField
|
//Create new GameField
|
||||||
layout = (SudokuFieldLayout)findViewById(R.id.sudokuLayout);
|
layout = (SudokuFieldLayout)findViewById(R.id.sudokuLayout);
|
||||||
gameController = new GameController(sharedPref, getApplicationContext());
|
|
||||||
gameController.registerGameSolvedListener(this);
|
gameController.registerGameSolvedListener(this);
|
||||||
gameController.registerTimerListener(this);
|
gameController.registerTimerListener(this);
|
||||||
statistics.setGameController(gameController);
|
statistics.setGameController(gameController);
|
||||||
List<GameInfoContainer> loadableGames = GameStateManager.getLoadableGameList();
|
|
||||||
|
|
||||||
if(loadLevel && loadableGames.size() > loadLevelID) {
|
|
||||||
// load level from GameStateManager
|
|
||||||
gameController.loadLevel(loadableGames.get(loadLevelID));
|
|
||||||
} else {
|
|
||||||
// load a new level
|
|
||||||
gameController.loadNewLevel(gameType, gameDifficulty);
|
|
||||||
}
|
|
||||||
|
|
||||||
layout.setSettingsAndGame(sharedPref, gameController);
|
layout.setSettingsAndGame(sharedPref, gameController);
|
||||||
|
|
||||||
|
@ -118,13 +134,16 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
||||||
Point p = new Point();
|
Point p = new Point();
|
||||||
getWindowManager().getDefaultDisplay().getSize(p);
|
getWindowManager().getDefaultDisplay().getSize(p);
|
||||||
|
|
||||||
//int width = p.x;
|
// set keyboard orientation
|
||||||
keyboard.setKeyBoard(gameController.getSize(), p.x,layout.getHeight()-p.y);
|
int orientation = getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT ?
|
||||||
|
LinearLayout.HORIZONTAL : LinearLayout.VERTICAL;
|
||||||
|
|
||||||
|
keyboard.setKeyBoard(gameController.getSize(), p.x,layout.getHeight()-p.y, orientation);
|
||||||
|
|
||||||
|
|
||||||
//set Special keys
|
//set Special keys
|
||||||
specialButtonLayout = (SudokuSpecialButtonLayout) findViewById(R.id.sudokuSpecialLayout);
|
specialButtonLayout = (SudokuSpecialButtonLayout) findViewById(R.id.sudokuSpecialLayout);
|
||||||
specialButtonLayout.setButtons(p.x, gameController, keyboard, getFragmentManager());
|
specialButtonLayout.setButtons(p.x, gameController, keyboard, getFragmentManager(), orientation);
|
||||||
|
|
||||||
//set TimerView
|
//set TimerView
|
||||||
timerView = (TextView)findViewById(R.id.timerView);
|
timerView = (TextView)findViewById(R.id.timerView);
|
||||||
|
@ -134,7 +153,6 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
||||||
viewName = (TextView) findViewById(R.id.gameModeText);
|
viewName = (TextView) findViewById(R.id.gameModeText);
|
||||||
viewName.setText(getString(gameController.getGameType().getStringResID()));
|
viewName.setText(getString(gameController.getGameType().getStringResID()));
|
||||||
|
|
||||||
|
|
||||||
//set Rating bar
|
//set Rating bar
|
||||||
List<GameDifficulty> difficutyList = GameDifficulty.getValidDifficultyList();
|
List<GameDifficulty> difficutyList = GameDifficulty.getValidDifficultyList();
|
||||||
int numberOfStarts = difficutyList.size();
|
int numberOfStarts = difficutyList.size();
|
||||||
|
@ -154,8 +172,16 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
||||||
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
|
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
|
||||||
navigationView.setNavigationItemSelectedListener(this);
|
navigationView.setNavigationItemSelectedListener(this);
|
||||||
|
|
||||||
// start the game
|
if(gameSolved) {
|
||||||
gameController.startTimer();
|
layout.setEnabled(false);
|
||||||
|
keyboard.setButtonsEnabled(false);
|
||||||
|
specialButtonLayout.setButtonsEnabled(false);
|
||||||
|
gameController.pauseTimer();
|
||||||
|
} else {
|
||||||
|
// start the game
|
||||||
|
gameController.startTimer();
|
||||||
|
}
|
||||||
|
onTick(gameController.getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -163,12 +189,14 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
||||||
super.onPause();
|
super.onPause();
|
||||||
if(!gameSolved) {
|
if(!gameSolved) {
|
||||||
gameController.saveGame(this);
|
gameController.saveGame(this);
|
||||||
gameController.pauseTimer();
|
|
||||||
}
|
}
|
||||||
|
gameController.deleteTimer();
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void onResume(){
|
public void onResume(){
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
gameController.initTimer();
|
||||||
|
|
||||||
if(!gameSolved) {
|
if(!gameSolved) {
|
||||||
gameController.startTimer();
|
gameController.startTimer();
|
||||||
}
|
}
|
||||||
|
@ -308,6 +336,10 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
||||||
specialButtonLayout.setButtonsEnabled(false);
|
specialButtonLayout.setButtonsEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTick(int time) {
|
||||||
|
|
||||||
|
//do something not so awesome
|
||||||
public String timeToString(int time) {
|
public String timeToString(int time) {
|
||||||
int seconds = time % 60;
|
int seconds = time % 60;
|
||||||
int minutes = ((time -seconds)/60)%60 ;
|
int minutes = ((time -seconds)/60)%60 ;
|
||||||
|
@ -326,6 +358,7 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
||||||
//do something not so awesome
|
//do something not so awesome
|
||||||
timerView.setText(timeToString(time));
|
timerView.setText(timeToString(time));
|
||||||
|
|
||||||
|
if(gameSolved) return;
|
||||||
// save time
|
// save time
|
||||||
gameController.saveGame(this);
|
gameController.saveGame(this);
|
||||||
}
|
}
|
||||||
|
@ -378,4 +411,21 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
||||||
return builder.create();
|
return builder.create();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSaveInstanceState(Bundle savedInstanceState) {
|
||||||
|
// Save the user's current game state
|
||||||
|
|
||||||
|
savedInstanceState.putParcelable("gameController", gameController);
|
||||||
|
savedInstanceState.putInt("gameSolved", gameSolved ? 1 : 0);
|
||||||
|
|
||||||
|
// Always call the superclass so it can save the view hierarchy state
|
||||||
|
super.onSaveInstanceState(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRestoreInstanceState(Bundle savedInstanceState) {
|
||||||
|
//super.onRestoreInstanceState(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ import android.widget.RatingBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -176,8 +177,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||||
|
|
||||||
// send everything to game activity
|
// send everything to game activity
|
||||||
i = new Intent(this, GameActivity.class);
|
i = new Intent(this, GameActivity.class);
|
||||||
i.putExtra("gameType", gameType);
|
i.putExtra("gameType", (Serializable)gameType);
|
||||||
i.putExtra("gameDifficulty", gameDifficulty);
|
i.putExtra("gameDifficulty", (Serializable)gameDifficulty);
|
||||||
} else {
|
} else {
|
||||||
newLevelManager.checkAndRestock();
|
newLevelManager.checkAndRestock();
|
||||||
Toast t = Toast.makeText(getApplicationContext(), R.string.generating, Toast.LENGTH_SHORT);
|
Toast t = Toast.makeText(getApplicationContext(), R.string.generating, Toast.LENGTH_SHORT);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.secuso.privacyfriendlysudoku.ui.view;
|
package org.secuso.privacyfriendlysudoku.ui.view;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
@ -52,7 +53,7 @@ public class SudokuKeyboardLayout extends LinearLayout implements IHighlightChan
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKeyBoard(int size,int width, int height) {
|
public void setKeyBoard(int size,int width, int height, int orientation) {
|
||||||
LayoutParams p;
|
LayoutParams p;
|
||||||
int number = 0;
|
int number = 0;
|
||||||
int numberOfButtonsPerRow = (size % 2 == 0) ? size/2 :(size+1)/2;
|
int numberOfButtonsPerRow = (size % 2 == 0) ? size/2 :(size+1)/2;
|
||||||
|
@ -60,16 +61,19 @@ public class SudokuKeyboardLayout extends LinearLayout implements IHighlightChan
|
||||||
|
|
||||||
buttons = new SudokuButton[numberOfButtons];
|
buttons = new SudokuButton[numberOfButtons];
|
||||||
|
|
||||||
|
|
||||||
//set layout parameters and init Layouts
|
//set layout parameters and init Layouts
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
p = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,0,1);
|
if(orientation == LinearLayout.HORIZONTAL) {
|
||||||
|
p = new LayoutParams(LayoutParams.MATCH_PARENT, 0, 1);
|
||||||
|
} else {
|
||||||
|
p = new LayoutParams(0, LayoutParams.MATCH_PARENT, 1);
|
||||||
|
}
|
||||||
//if (i == 0) p.bottomMargin=10; else p.topMargin=10;
|
//if (i == 0) p.bottomMargin=10; else p.topMargin=10;
|
||||||
p.setMargins(0,5,0,5);
|
p.setMargins(0,5,0,5);
|
||||||
layouts[i] = new LinearLayout(getContext(),null);
|
layouts[i] = new LinearLayout(getContext(),null);
|
||||||
layouts[i].setLayoutParams(p);
|
layouts[i].setLayoutParams(p);
|
||||||
layouts[i].setWeightSum(numberOfButtonsPerRow);
|
layouts[i].setWeightSum(numberOfButtonsPerRow);
|
||||||
layouts[i].setOrientation(LinearLayout.HORIZONTAL);
|
layouts[i].setOrientation(orientation);
|
||||||
addView(layouts[i]);
|
addView(layouts[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +85,11 @@ public class SudokuKeyboardLayout extends LinearLayout implements IHighlightChan
|
||||||
for (int i = 0; i < numberOfButtonsPerRow; i++){
|
for (int i = 0; i < numberOfButtonsPerRow; i++){
|
||||||
int buttonIndex = i + layoutNumber * numberOfButtonsPerRow;
|
int buttonIndex = i + layoutNumber * numberOfButtonsPerRow;
|
||||||
buttons[buttonIndex] = new SudokuButton(getContext(),null);
|
buttons[buttonIndex] = new SudokuButton(getContext(),null);
|
||||||
p = new LayoutParams(0, LayoutParams.MATCH_PARENT,1);
|
if(orientation == LinearLayout.HORIZONTAL) {
|
||||||
|
p = new LayoutParams(0, LayoutParams.MATCH_PARENT, 1);
|
||||||
|
} else {
|
||||||
|
p = new LayoutParams(LayoutParams.MATCH_PARENT, 0, 1);
|
||||||
|
}
|
||||||
p.setMargins(5,5,5,5);
|
p.setMargins(5,5,5,5);
|
||||||
buttons[buttonIndex].setLayoutParams(p);
|
buttons[buttonIndex].setLayoutParams(p);
|
||||||
/* removed GridLayout because of bad scaling will use now a Linearlayout
|
/* removed GridLayout because of bad scaling will use now a Linearlayout
|
||||||
|
|
|
@ -58,17 +58,7 @@ public class SudokuSpecialButtonLayout extends LinearLayout implements IHighligh
|
||||||
// rotates the Drawable
|
// rotates the Drawable
|
||||||
gameController.setNoteStatus(!gameController.getNoteStatus());
|
gameController.setNoteStatus(!gameController.getNoteStatus());
|
||||||
keyboard.updateNotesEnabled();
|
keyboard.updateNotesEnabled();
|
||||||
|
onHighlightChanged();
|
||||||
bitMap = BitmapFactory.decodeResource(getResources(), btn.getType().getResID());
|
|
||||||
bitResult = Bitmap.createBitmap(bitMap.getWidth(), bitMap.getHeight(), Bitmap.Config.ARGB_8888);
|
|
||||||
|
|
||||||
canvas = new Canvas(bitResult);
|
|
||||||
canvas.rotate(gameController.getNoteStatus() ? 45.0f : 0.0f, bitMap.getWidth()/2, bitMap.getHeight()/2);
|
|
||||||
canvas.drawBitmap(bitMap, 0, 0, null);
|
|
||||||
|
|
||||||
btn.setImageBitmap(bitResult);
|
|
||||||
btn.setBackgroundResource(gameController.getNoteStatus() ? R.drawable.numpad_highlighted_three : R.drawable.numpad_highlighted_four);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Do:
|
case Do:
|
||||||
gameController.ReDo();
|
gameController.ReDo();
|
||||||
|
@ -113,12 +103,12 @@ public class SudokuSpecialButtonLayout extends LinearLayout implements IHighligh
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setButtons(int width, GameController gc, SudokuKeyboardLayout key, FragmentManager fm) {
|
public void setButtons(int width, GameController gc, SudokuKeyboardLayout key, FragmentManager fm, int orientation) {
|
||||||
fragmentManager = fm;
|
fragmentManager = fm;
|
||||||
keyboard=key;
|
keyboard=key;
|
||||||
gameController = gc;
|
gameController = gc;
|
||||||
if(gc != null) {
|
if(gameController != null) {
|
||||||
gc.registerHighlightChangedListener(this);
|
gameController.registerHighlightChangedListener(this);
|
||||||
}
|
}
|
||||||
fixedButtons = new SudokuSpecialButton[fixedButtonsCount];
|
fixedButtons = new SudokuSpecialButton[fixedButtonsCount];
|
||||||
LayoutParams p;
|
LayoutParams p;
|
||||||
|
@ -126,7 +116,12 @@ public class SudokuSpecialButtonLayout extends LinearLayout implements IHighligh
|
||||||
//ArrayList<SudokuButtonType> type = (ArrayList<SudokuButtonType>) SudokuButtonType.getSpecialButtons();
|
//ArrayList<SudokuButtonType> type = (ArrayList<SudokuButtonType>) SudokuButtonType.getSpecialButtons();
|
||||||
for (SudokuButtonType t : getSpecialButtons()){
|
for (SudokuButtonType t : getSpecialButtons()){
|
||||||
fixedButtons[i] = new SudokuSpecialButton(getContext(),null);
|
fixedButtons[i] = new SudokuSpecialButton(getContext(),null);
|
||||||
p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT,1);
|
if(orientation == LinearLayout.HORIZONTAL) {
|
||||||
|
p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, 1);
|
||||||
|
} else {
|
||||||
|
p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, 1);
|
||||||
|
fixedButtons[i].setPadding(25, 0, 25, 0);
|
||||||
|
}
|
||||||
p.setMargins(5, 5, 5, 5);
|
p.setMargins(5, 5, 5, 5);
|
||||||
|
|
||||||
//int width2 =width/(fixedButtonsCount);
|
//int width2 =width/(fixedButtonsCount);
|
||||||
|
@ -166,6 +161,17 @@ public class SudokuSpecialButtonLayout extends LinearLayout implements IHighligh
|
||||||
fixedButtons[i].setBackgroundResource(gameController.isRedoAvailable() ?
|
fixedButtons[i].setBackgroundResource(gameController.isRedoAvailable() ?
|
||||||
R.drawable.numpad_highlighted_four : R.drawable.inactive_button);
|
R.drawable.numpad_highlighted_four : R.drawable.inactive_button);
|
||||||
break;
|
break;
|
||||||
|
case NoteToggle:
|
||||||
|
bitMap = BitmapFactory.decodeResource(getResources(), fixedButtons[i].getType().getResID());
|
||||||
|
bitResult = Bitmap.createBitmap(bitMap.getWidth(), bitMap.getHeight(), Bitmap.Config.ARGB_8888);
|
||||||
|
|
||||||
|
canvas = new Canvas(bitResult);
|
||||||
|
canvas.rotate(gameController.getNoteStatus() ? 45.0f : 0.0f, bitMap.getWidth()/2, bitMap.getHeight()/2);
|
||||||
|
canvas.drawBitmap(bitMap, 0, 0, null);
|
||||||
|
|
||||||
|
fixedButtons[i].setImageBitmap(bitResult);
|
||||||
|
fixedButtons[i].setBackgroundResource(gameController.getNoteStatus() ? R.drawable.numpad_highlighted_three : R.drawable.numpad_highlighted_four);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,40 +11,42 @@
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
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="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
|
<org.secuso.privacyfriendlysudoku.ui.view.SudokuSpecialButtonLayout
|
||||||
android:id="@+id/sudokuSpecialLayout"
|
android:id="@+id/sudokuSpecialLayout"
|
||||||
android:layout_width="0dp"
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_marginLeft="15dp"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
android:layout_marginRight="30dp"
|
||||||
|
android:layout_marginEnd="30dp"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1">
|
android:gravity="center"/>
|
||||||
|
|
||||||
</org.secuso.privacyfriendlysudoku.ui.view.SudokuSpecialButtonLayout>
|
<org.secuso.privacyfriendlysudoku.ui.view.SudokuFieldLayout
|
||||||
|
android:id="@+id/sudokuLayout"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_toRightOf="@+id/sudokuSpecialLayout"
|
||||||
|
android:layout_toEndOf="@+id/sudokuSpecialLayout"
|
||||||
|
android:minWidth="100dp"
|
||||||
|
android:clickable="true"
|
||||||
|
android:gravity="center" />
|
||||||
|
|
||||||
</LinearLayout>
|
<org.secuso.privacyfriendlysudoku.ui.view.SudokuKeyboardLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginLeft="30dp"
|
||||||
|
android:layout_marginStart="30dp"
|
||||||
|
android:layout_marginRight="15dp"
|
||||||
|
android:layout_marginEnd="15dp"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_toRightOf="@+id/sudokuLayout"
|
||||||
|
android:layout_toEndOf="@+id/sudokuLayout"
|
||||||
|
android:id="@+id/sudokuKeyboardLayout"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:weightSum="2"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
|
@ -1,20 +1,104 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
|
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
|
android:layout_height="match_parent"
|
||||||
|
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||||
android:weightSum="10"
|
android:weightSum="5"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
tools:context="tu_darmstadt.sudoku.ui.StatsActivity$PlaceholderFragment">
|
tools:context="tu_darmstadt.sudoku.ui.StatsActivity$PlaceholderFragment">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="0px"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center"
|
||||||
|
android:weightSum="3">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0px"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<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"/>
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0px"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<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"/>
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0px"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<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
|
<LinearLayout
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="4"
|
android:layout_weight="0.5">
|
||||||
android:weightSum="5">
|
<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="match_parent"
|
||||||
|
android:layout_height="0px"
|
||||||
|
android:layout_weight="3.5"
|
||||||
|
android:weightSum="9"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_weight="2"
|
android:layout_weight="3"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
|
@ -37,82 +121,20 @@
|
||||||
android:layout_marginBottom="@dimen/activity_horizontal_margin"/>
|
android:layout_marginBottom="@dimen/activity_horizontal_margin"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0px"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="match_parent"
|
||||||
android:weightSum="6"
|
|
||||||
android:layout_weight="2"
|
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingTop="@dimen/activity_horizontal_margin">
|
android:layout_weight="5.5"
|
||||||
<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">
|
android:weightSum="3">
|
||||||
|
<!-- ### first row -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:weightSum="3">
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
|
@ -173,8 +195,8 @@
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<!-- ### second row -->
|
<!-- ### second row -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
@ -238,16 +260,11 @@
|
||||||
android:layout_below="@+id/second_min_text"/>
|
android:layout_below="@+id/second_min_text"/>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
<!-- ### third row -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1">
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="1">
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -306,11 +323,10 @@
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:layout_below="@+id/third_min_text"/>
|
android:layout_below="@+id/third_min_text"/>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
316
app/src/main/res/layout-xlarge-land/fragment_stats.xml
Normal file
316
app/src/main/res/layout-xlarge-land/fragment_stats.xml
Normal 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>
|
316
app/src/main/res/layout-xlarge/fragment_stats.xml
Normal file
316
app/src/main/res/layout-xlarge/fragment_stats.xml
Normal 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>
|
Loading…
Reference in a new issue