diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/database/model/DailySudoku.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/database/model/DailySudoku.java index 81a75b7..4228ec4 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/database/model/DailySudoku.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/database/model/DailySudoku.java @@ -65,7 +65,7 @@ public class DailySudoku extends Level { * does not have the right format) */ public int getTimeNeededInSeconds() { - if (timeNeeded.matches("/d/d:/d/d:/d/d")) { + if (timeNeeded.matches("[0-9]{2}:[0-5][0-9]:[0-5][0-9]")) { String[] timeInstances = timeNeeded.split(":"); int hourIndex = 0; int minuteIndex = 1; @@ -73,7 +73,7 @@ public class DailySudoku extends Level { int minutes = Integer.parseInt(timeInstances[hourIndex]) * 60 + Integer.parseInt(timeInstances[minuteIndex]); return minutes * 60 + Integer.parseInt(timeInstances[secondIndex]); - } + } return 0; } diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/DailySudokuActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/DailySudokuActivity.java index d143430..bc5d695 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/DailySudokuActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/DailySudokuActivity.java @@ -260,6 +260,7 @@ public class DailySudokuActivity extends AppCompatActivity { TextView playedTime = (TextView)convertView.findViewById(R.id.loadgame_listentry_timeplayed); TextView lastTimePlayed = (TextView)convertView.findViewById(R.id.loadgame_listentry_lasttimeplayed); ImageView image = (ImageView)convertView.findViewById(R.id.loadgame_listentry_gametypeimage); + ImageView customImage = (ImageView)convertView.findViewById(R.id.loadgame_listentry_custom_label); image.setImageResource(R.drawable.icon_default_9x9); @@ -269,6 +270,7 @@ public class DailySudokuActivity extends AppCompatActivity { difficultyBar.setNumStars(GameDifficulty.getValidDifficultyList().size()); difficultyBar.setMax(GameDifficulty.getValidDifficultyList().size()); difficultyBar.setRating(GameDifficulty.getValidDifficultyList().indexOf(sudoku.getDifficulty())+1); + customImage.setVisibility(View.INVISIBLE); Calendar currentDate = Calendar.getInstance(); diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/LoadGameActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/LoadGameActivity.java index 717f132..33935d4 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/LoadGameActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/LoadGameActivity.java @@ -229,6 +229,7 @@ public class LoadGameActivity extends BaseActivity implements IDeleteDialogFragm TextView playedTime = (TextView)convertView.findViewById(R.id.loadgame_listentry_timeplayed); TextView lastTimePlayed = (TextView)convertView.findViewById(R.id.loadgame_listentry_lasttimeplayed); ImageView image = (ImageView)convertView.findViewById(R.id.loadgame_listentry_gametypeimage); + ImageView customImage = (ImageView)convertView.findViewById(R.id.loadgame_listentry_custom_label); switch(gic.getGameType()) { case Default_6x6: @@ -249,6 +250,10 @@ public class LoadGameActivity extends BaseActivity implements IDeleteDialogFragm difficultyBar.setMax(GameDifficulty.getValidDifficultyList().size()); difficultyBar.setRating(GameDifficulty.getValidDifficultyList().indexOf(gic.getDifficulty())+1); + if(!gic.isCustom()) { + customImage.setVisibility(View.INVISIBLE); + } + int time = gic.getTimePlayed(); int seconds = time % 60; int minutes = ((time -seconds)/60)%60 ; diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java index 8a4f6fa..c3d1f18 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java @@ -474,7 +474,7 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig } public void onDialogNegativeClick() { - + mNavigationView.setCheckedItem(R.id.nav_newgame_main); } public static class ImportBoardDialog extends DialogFragment { @@ -505,7 +505,9 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig }) .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { - // User cancelled the dialog + for(IImportDialogFragmentListener l : listeners) { + l.onDialogNegativeClick(); + } } }); return builder.create(); diff --git a/app/src/main/res/layout/list_entry_layout.xml b/app/src/main/res/layout/list_entry_layout.xml index 800e726..a098bf0 100644 --- a/app/src/main/res/layout/list_entry_layout.xml +++ b/app/src/main/res/layout/list_entry_layout.xml @@ -1,53 +1,80 @@ + android:weightSum="10"> + android:src="@drawable/icon_default_9x9" /> - + android:layout_height="wrap_content"> + + + android:layout_height="wrap_content" + android:text="GameType" + app:layout_constraintBottom_toTopOf="@+id/loadgame_listentry_difficultybar" + app:layout_constraintEnd_toEndOf="@+id/loadgame_listentry_difficultytext" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="@+id/loadgame_listentry_difficultybar" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="1.0" /> - + android:clickable="false" + android:numStars="3" + android:rating="3" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.0" /> - + - - - + + android:gravity="end" + android:text="00:00" + android:textStyle="bold" /> + android:layout_height="wrap_content" + android:layout_below="@+id/loadgame_listentry_timeplayed" + android:gravity="end" + android:text="1 second ago" /> diff --git a/app/src/main/res/values-night/styles.xml b/app/src/main/res/values-night/styles.xml index b19b842..0988338 100644 --- a/app/src/main/res/values-night/styles.xml +++ b/app/src/main/res/values-night/styles.xml @@ -36,10 +36,10 @@ true - -