parent
21c2f567ee
commit
e5561a6d41
3 changed files with 19 additions and 2 deletions
|
@ -76,6 +76,19 @@ public class DailySudoku extends Level {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getOrderingDateID(){
|
||||||
|
int year = id%10000;
|
||||||
|
int month = ((id/10000) -1) % 100;
|
||||||
|
int day = id/1000000;
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
sb.append(year);
|
||||||
|
if(month<10) sb.append(0);
|
||||||
|
sb.append(month);
|
||||||
|
if(day<10) sb.append(0);
|
||||||
|
sb.append(day);
|
||||||
|
return Integer.valueOf(sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a new value for the timeNeeded attribute of this daily sudoku
|
* Set a new value for the timeNeeded attribute of this daily sudoku
|
||||||
* @param timeNeeded the new value for the timeNeeded attribute
|
* @param timeNeeded the new value for the timeNeeded attribute
|
||||||
|
|
|
@ -21,7 +21,7 @@ import org.secuso.privacyfriendlysudoku.game.GameDifficulty;
|
||||||
import org.secuso.privacyfriendlysudoku.game.GameType;
|
import org.secuso.privacyfriendlysudoku.game.GameType;
|
||||||
|
|
||||||
public class Level {
|
public class Level {
|
||||||
private int id = -1;
|
protected int id = -1;
|
||||||
private GameDifficulty difficulty = GameDifficulty.Unspecified;
|
private GameDifficulty difficulty = GameDifficulty.Unspecified;
|
||||||
private GameType gameType = GameType.Unspecified;
|
private GameType gameType = GameType.Unspecified;
|
||||||
private int[] puzzle;
|
private int[] puzzle;
|
||||||
|
|
|
@ -47,6 +47,7 @@ import org.secuso.privacyfriendlysudoku.ui.view.R;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
@ -75,6 +76,8 @@ public class DailySudokuActivity extends AppCompatActivity {
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
sudokuList = dbHelper.getDailySudokus();
|
sudokuList = dbHelper.getDailySudokus();
|
||||||
|
Collections.sort(sudokuList, (o1, o2) -> o2.getOrderingDateID() - o1.getOrderingDateID());
|
||||||
|
|
||||||
TextView totalGamesTextView = findViewById(R.id.numb_of_total_games);
|
TextView totalGamesTextView = findViewById(R.id.numb_of_total_games);
|
||||||
TextView hintsTextView = findViewById(R.id.numb_of_hints);
|
TextView hintsTextView = findViewById(R.id.numb_of_hints);
|
||||||
TextView totalTimeTextView = findViewById(R.id.numb_of_total_time);
|
TextView totalTimeTextView = findViewById(R.id.numb_of_total_time);
|
||||||
|
@ -257,7 +260,8 @@ public class DailySudokuActivity extends AppCompatActivity {
|
||||||
|
|
||||||
int id = sudoku.getId();
|
int id = sudoku.getId();
|
||||||
Calendar cal = Calendar.getInstance();
|
Calendar cal = Calendar.getInstance();
|
||||||
cal.set(id%10000, (id/10000) % 100, id/1000000, 0, 0, 0 );
|
//-1 at month because for some reason, it is added by 1 when saving the dailySudoku
|
||||||
|
cal.set(id%10000, ((id/10000) -1) % 100, id/1000000, 0, 0, 0 );
|
||||||
|
|
||||||
|
|
||||||
DateFormat format = DateFormat.getDateInstance();
|
DateFormat format = DateFormat.getDateInstance();
|
||||||
|
|
Loading…
Reference in a new issue