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 96d42dc..a65c2b9 100644
--- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java
+++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java
@@ -1,39 +1,35 @@
package org.secuso.privacyfriendlysudoku.ui;
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.app.AlertDialog;
import android.app.Dialog;
+import android.app.DialogFragment;
import android.content.Intent;
import android.content.SharedPreferences;
-import android.graphics.PorterDuff;
-import android.graphics.drawable.LayerDrawable;
+import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.support.design.widget.NavigationView;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentManager;
+import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.GravityCompat;
+import android.support.v4.view.ViewPager;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
-
-import android.support.v4.app.Fragment;
-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.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
-
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.TextView;
import android.widget.Toast;
-import java.io.Serializable;
-import java.util.LinkedList;
-import java.util.List;
-
import org.secuso.privacyfriendlysudoku.controller.GameStateManager;
import org.secuso.privacyfriendlysudoku.controller.NewLevelManager;
import org.secuso.privacyfriendlysudoku.controller.helper.GameInfoContainer;
@@ -41,6 +37,10 @@ import org.secuso.privacyfriendlysudoku.game.GameDifficulty;
import org.secuso.privacyfriendlysudoku.game.GameType;
import org.secuso.privacyfriendlysudoku.ui.view.R;
+import java.io.Serializable;
+import java.util.LinkedList;
+import java.util.List;
+
public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener{
RatingBar difficultyBar;
@@ -67,11 +67,19 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
// preload some levels so we don't have to generate as many and we can start playing right away.
newLevelManager.loadFirstStartLevels();
+ WelcomeDialog welcomeDialog = new WelcomeDialog();
+ welcomeDialog.show(getFragmentManager(), "WelcomeDialog");
+
SharedPreferences.Editor editor = settings.edit();
editor.putBoolean("firstStart", false);
- editor.commit();
+ editor.apply();
}
+ // TODO: remove this after testing
+ WelcomeDialog welcomeDialog = new WelcomeDialog();
+ welcomeDialog.show(getFragmentManager(), "WelcomeDialog");
+
+
// check if we need to pre generate levels.
newLevelManager.checkAndRestock();
@@ -372,4 +380,27 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
return rootView;
}
}
+
+ @SuppressLint("ValidFragment")
+ public class WelcomeDialog extends DialogFragment {
+
+ @Override
+ public void onAttach(Activity activity) {
+ super.onAttach(activity);
+ }
+
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+
+ LayoutInflater i = getActivity().getLayoutInflater();
+ AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+
+ builder.setView(i.inflate(R.layout.welcome_dialog, null));
+ builder.setIcon(R.mipmap.ic_launcher);
+ builder.setTitle(getActivity().getString(R.string.app_name_long));
+ builder.setPositiveButton(getActivity().getString(R.string.win_button_text), null);
+
+ return builder.create();
+ }
+ }
}
diff --git a/app/src/main/res/layout/welcome_dialog.xml b/app/src/main/res/layout/welcome_dialog.xml
new file mode 100644
index 0000000..a4e6330
--- /dev/null
+++ b/app/src/main/res/layout/welcome_dialog.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index 899cd98..5cc262b 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -79,5 +79,7 @@
Löschen
Hilfe
Privatsphäre Information
+ Zeit zurücksetzen
+ Beim zurücksetzen des Spielfeldes wird die Zeit auch zurückgesetzt.
\ No newline at end of file
diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml
index 30d1d12..b3b257e 100644
--- a/app/src/main/res/values-ru/strings.xml
+++ b/app/src/main/res/values-ru/strings.xml
@@ -5,7 +5,6 @@
Данное приложение использует модифицированную версию QQWing v1.3.4.
Среднее время:
Отмена
-
Легкий
Сложный
Средний
diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml
index bb782d6..706e786 100644
--- a/app/src/main/res/values-zh/strings.xml
+++ b/app/src/main/res/values-zh/strings.xml
@@ -1,6 +1,5 @@
- 数独
时间:
继续
作者:
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index d54a269..5b4bd09 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -56,7 +56,7 @@
Also reset the timer, when resetting the game board.
- Privacy friendly Sudoku
+ Privacy Friendly Sudoku
v1.0
Author:
Christopher Beckmann, Timm Lippert
@@ -86,6 +86,9 @@
Are you sure you want to reset the game board?
Reset
+
+ Welcome to Privacy Friendly Sudoku.
+
Are you sure you want to delete this save?
Delete