Merge branch 'Sudoku-v3.0' of https://github.com/SecUSo/privacy-friendly-sudoku into Sudoku-v3.0

This commit is contained in:
ErikWaegerle 2020-08-25 16:21:54 +02:00
commit c1688ea6a8
7 changed files with 78 additions and 42 deletions

View file

@ -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;

View file

@ -260,6 +260,7 @@ public class DailySudokuActivity<Database> 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<Database> 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();

View file

@ -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 ;

View file

@ -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();

View file

@ -1,53 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="16dp"
android:id="@+id/main_content"
android:weightSum="10"
android:orientation="horizontal">
android:weightSum="10">
<ImageView
android:id="@+id/loadgame_listentry_gametypeimage"
android:layout_height="match_parent"
android:layout_width="40dp"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
android:adjustViewBounds="true"
android:src="@drawable/icon_default_9x9" />
<RelativeLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/relativeLayout2"
android:layout_width="wrap_content"
android:layout_height="match_parent">
android:layout_height="wrap_content">
<ImageView
android:id="@+id/loadgame_listentry_custom_label"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
app:layout_constraintBottom_toBottomOf="@+id/loadgame_listentry_gametype"
app:layout_constraintEnd_toEndOf="@+id/loadgame_listentry_difficultytext"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="@+id/loadgame_listentry_gametype"
app:layout_constraintTop_toTopOf="@+id/loadgame_listentry_gametype"
app:srcCompat="@drawable/create_game_src" />
<TextView
android:text="GameType"
android:id="@+id/loadgame_listentry_gametype"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_below="@+id/loadgame_listentry_gametype">
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" />
<RatingBar
android:id="@+id/loadgame_listentry_difficultybar"
style="?android:attr/ratingBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/loadgame_listentry_difficultybar"
android:clickable="false"
android:numStars="3"
android:rating="3"
android:clickable="false"
style="?android:attr/ratingBarStyleSmall"/>
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" />
<TextView
android:text="Difficulty"
android:id="@+id/loadgame_listentry_difficultytext"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:text="Difficulty"
app:layout_constraintBottom_toBottomOf="@+id/loadgame_listentry_difficultybar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/loadgame_listentry_difficultybar"
app:layout_constraintTop_toTopOf="@+id/loadgame_listentry_difficultybar" />
</LinearLayout>
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<RelativeLayout
android:layout_width="wrap_content"
@ -56,20 +83,20 @@
android:gravity="right">
<TextView
android:text="00:00"
android:textStyle="bold"
android:id="@+id/loadgame_listentry_timeplayed"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"/>
android:gravity="end"
android:text="00:00"
android:textStyle="bold" />
<TextView
android:text="1 second ago"
android:gravity="end"
android:layout_below="@+id/loadgame_listentry_timeplayed"
android:id="@+id/loadgame_listentry_lasttimeplayed"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:layout_below="@+id/loadgame_listentry_timeplayed"
android:gravity="end"
android:text="1 second ago" />
</RelativeLayout>

View file

@ -36,10 +36,10 @@
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.Dialog" parent="Theme.AppCompat.Light.Dialog.Alert">
<style name="AppTheme.Dialog" parent="Theme.AppCompat.DayNight.Dialog.Alert">
<item name="colorAccent">@color/colorAccent</item>
<item name="android:textColorPrimary">@color/white</item>
<item name="android:background">@color/darkgrey</item>
<item name="android:windowBackground">@color/darkgrey</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

View file

@ -34,10 +34,10 @@
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.Dialog" parent="Theme.AppCompat.Light.Dialog.Alert">
<style name="AppTheme.Dialog" parent="Theme.AppCompat.DayNight.Dialog.Alert">
<item name="colorAccent">@color/colorPrimaryDark</item>
<item name="android:textColorPrimary">@color/black</item>
<item name="android:background">@color/white</item>
<item name="android:windowBackground">@color/white</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />