diff --git a/app/src/main/java/tu_darmstadt/sudoku/ui/MainActivity.java b/app/src/main/java/tu_darmstadt/sudoku/ui/MainActivity.java
index 71dc5da..4b92dfd 100644
--- a/app/src/main/java/tu_darmstadt/sudoku/ui/MainActivity.java
+++ b/app/src/main/java/tu_darmstadt/sudoku/ui/MainActivity.java
@@ -1,5 +1,6 @@
package tu_darmstadt.sudoku.ui;
+import android.app.Dialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
@@ -15,11 +16,13 @@ import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.os.Bundle;
+import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
+import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RatingBar;
@@ -124,9 +127,18 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
}
public void callFragment(View view){
- FragmentManager fm = getSupportFragmentManager();
+ /*FragmentManager fm = getSupportFragmentManager();
DialogWinScreen winScreen = new DialogWinScreen();
- winScreen.show(fm,"win_screen_layout");
+
+ winScreen.show(fm,"win_screen_layout");*/
+ Dialog dialog = new Dialog(this);
+ //dialog.setContentView(getLayoutInflater().inflate(R.layout.win_screen_layout,null));
+ dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
+ //dialog.setContentView(R.layout.win_screen_layout);
+ dialog.getWindow().setGravity(Gravity.CENTER_HORIZONTAL);
+ dialog.getWindow().setContentView(R.layout.win_screen_layout);
+ dialog.getWindow().setBackgroundDrawableResource(R.color.transparent);
+ dialog.show();
}
public void onClick(View view) {
diff --git a/app/src/main/java/tu_darmstadt/sudoku/ui/StatsActivity.java b/app/src/main/java/tu_darmstadt/sudoku/ui/StatsActivity.java
index 24e3e33..603f51d 100644
--- a/app/src/main/java/tu_darmstadt/sudoku/ui/StatsActivity.java
+++ b/app/src/main/java/tu_darmstadt/sudoku/ui/StatsActivity.java
@@ -145,6 +145,7 @@ public class StatsActivity extends AppCompatActivity {
private TextView difficultyView,averageTimeView,minTimeView;
private RatingBar difficultyBarView;
private String s;
+ private int t;
private int totalTime =0;
private int totalGames =0;
private int totalHints =0;
@@ -185,6 +186,7 @@ public class StatsActivity extends AppCompatActivity {
private String formatTime(int totalTime){
+ if (totalTime==0) return "/";
int seconds = totalTime % 60;
int minutes = ((totalTime -seconds)/60)%60 ;
int hours = (totalTime - minutes - seconds)/(3600);
@@ -196,9 +198,9 @@ public class StatsActivity extends AppCompatActivity {
}
private void updateGeneralIfo(int time, int games, int hints){
- totalHints +=hints;
- totalGames +=games;
- totalTime +=time;
+ totalHints =hints;
+ totalGames =games;
+ totalTime =time;
}
private void setGeneralInfo(){
TextView generalInfoView;
@@ -237,10 +239,10 @@ public class StatsActivity extends AppCompatActivity {
}
difficultyBarView.setRating(pos+1);
difficultyView.setText(rootView.getResources().getString(infos.getDifficulty().getStringResID()));
- s= (infos.getTimeNoHints() == 0)?"/":String.valueOf(infos.getTimeNoHints() / infos.getNumberOfGamesNoHints());
- averageTimeView.setText(s);
- s = (infos.getMinTime()==Integer.MAX_VALUE)? "/":String.valueOf(infos.getMinTime());
- minTimeView.setText(s);
+ t= (infos.getTimeNoHints() == 0)?0:(infos.getTimeNoHints() / infos.getNumberOfGamesNoHints());
+ averageTimeView.setText(formatTime(t));
+ t = (infos.getMinTime()==Integer.MAX_VALUE)? 0:(infos.getMinTime());
+ minTimeView.setText(formatTime(t));
}
diff --git a/app/src/main/java/tu_darmstadt/sudoku/ui/view/DialogWinScreen.java b/app/src/main/java/tu_darmstadt/sudoku/ui/view/DialogWinScreen.java
index a112854..da8cadb 100644
--- a/app/src/main/java/tu_darmstadt/sudoku/ui/view/DialogWinScreen.java
+++ b/app/src/main/java/tu_darmstadt/sudoku/ui/view/DialogWinScreen.java
@@ -6,11 +6,13 @@ import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.AnimationUtils;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;
+import android.widget.GridLayout;
import android.widget.ImageView;
import tu_darmstadt.sudoku.controller.GameController;
@@ -47,8 +49,12 @@ public class DialogWinScreen extends android.support.v4.app.DialogFragment {
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
- View view = inflater.inflate(R.layout.win_screen_layout,container);
- getDialog().getWindow().setBackgroundDrawableResource(R.drawable.ic_trophy_black_48dp);
+ View view = inflater.inflate(R.layout.win_screen_layout,null);
+
+ // set background for the dialog window maybe just set the background to the drawable or to transparent
+
+ //getDialog().getWindow().setWindowAnimations();
+ //getDialog().getWindow().setAttributes(new WindowManager.LayoutParams(250,250,getDialog().getWindow().getAttributes().type,getDialog().getWindow().getAttributes().flags,getDialog().getWindow().getAttributes().format ));
//getDialog().getWindow().setLayout(200,250);
//Maybe creat real animation
//Animation ani = AnimationUtils.loadAnimation(this,R.anim...);
diff --git a/app/src/main/res/layout/activity_stats.xml b/app/src/main/res/layout/activity_stats.xml
index 9cfec92..2fa5432 100644
--- a/app/src/main/res/layout/activity_stats.xml
+++ b/app/src/main/res/layout/activity_stats.xml
@@ -14,7 +14,7 @@
+ app:layout_scrollFlags="enterAlways">
@@ -24,7 +24,7 @@
diff --git a/app/src/main/res/layout/win_screen_layout.xml b/app/src/main/res/layout/win_screen_layout.xml
index a814861..360f5bc 100644
--- a/app/src/main/res/layout/win_screen_layout.xml
+++ b/app/src/main/res/layout/win_screen_layout.xml
@@ -1,69 +1,121 @@
-
-
-
+ android:layout_width="250dp" android:layout_height="350dp"
+ android:orientation="vertical"
+ android:layout_gravity="center">
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:layout_marginTop="20dp">
+
+
-
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 4e01c61..3b01464 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -99,5 +99,6 @@
Congratulations, you have solved the puzzle.
+ OK!
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 5d08429..a7b8295 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -13,5 +13,14 @@
-
+