diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java index f78cbef..402a652 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java @@ -27,6 +27,7 @@ import android.widget.Button; import android.widget.LinearLayout; import android.widget.RatingBar; import android.widget.TextView; +import android.widget.Toast; import org.secuso.privacyfriendlysudoku.controller.GameController; import org.secuso.privacyfriendlysudoku.controller.GameStateManager; @@ -45,6 +46,7 @@ import org.secuso.privacyfriendlysudoku.ui.view.SudokuKeyboardLayout; import org.secuso.privacyfriendlysudoku.ui.view.SudokuSpecialButtonLayout; import org.secuso.privacyfriendlysudoku.ui.view.WinDialog; +import java.util.IllegalFormatCodePointException; import java.util.LinkedList; import java.util.List; import java.util.concurrent.RunnableFuture; @@ -244,7 +246,12 @@ public class GameActivity extends BaseActivity implements NavigationView.OnNavig } SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); - Symbol s = Symbol.valueOf(Symbol.class, sharedPref.getString("pref_symbols", "Default")); + Symbol s; + try { + s = Symbol.valueOf(sharedPref.getString("pref_symbols", Symbol.Default.name())); + } catch(IllegalArgumentException e) { + s = Symbol.Default; + } layout.setSymbols(s); keyboard.setSymbols(s); } 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 e1d7c43..6aa6527 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java @@ -41,6 +41,8 @@ import java.io.Serializable; import java.util.LinkedList; import java.util.List; +import static org.secuso.privacyfriendlysudoku.ui.TutorialActivity.ACTION_SHOW_ANYWAYS; + public class MainActivity extends BaseActivity implements NavigationView.OnNavigationItemSelectedListener{ RatingBar difficultyBar; @@ -326,6 +328,14 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig startActivity(intent); overridePendingTransition(0, 0); break; + + case R.id.menu_tutorial_main: + intent = new Intent(this, TutorialActivity.class); + intent.setAction(ACTION_SHOW_ANYWAYS); + startActivity(intent); + overridePendingTransition(0, 0); + break; + default: } return true; diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/TutorialActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/TutorialActivity.java index bf96fdf..9516aea 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/TutorialActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/TutorialActivity.java @@ -29,6 +29,9 @@ import org.secuso.privacyfriendlysudoku.ui.view.R; public class TutorialActivity extends AppCompatActivity { + private static final String TAG = TutorialActivity.class.getSimpleName(); + public static final String ACTION_SHOW_ANYWAYS = TAG + ".ACTION_SHOW_ANYWAYS"; + private ViewPager viewPager; private MyViewPagerAdapter myViewPagerAdapter; private LinearLayout dotsLayout; @@ -41,11 +44,15 @@ public class TutorialActivity extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - // Checking for first time launch - before calling setContentView() prefManager = new PrefManager(this); - if (!prefManager.isFirstTimeLaunch()) { - launchHomeScreen(); - finish(); + + Intent i = getIntent(); + if(i == null || !ACTION_SHOW_ANYWAYS.equals(i.getAction())) { + // Checking for first time launch - before calling setContentView() + if (!prefManager.isFirstTimeLaunch()) { + launchHomeScreen(); + return; + } } // Making notification bar transparent @@ -126,7 +133,10 @@ public class TutorialActivity extends AppCompatActivity { private void launchHomeScreen() { prefManager.setFirstTimeLaunch(false); - startActivity(new Intent(TutorialActivity.this, MainActivity.class)); + Intent intent = new Intent(TutorialActivity.this, MainActivity.class); + intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + //intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); + startActivity(intent); finish(); } diff --git a/app/src/main/res/drawable/ic_school_black_24dp.xml b/app/src/main/res/drawable/ic_school_black_24dp.xml new file mode 100644 index 0000000..f8d18b2 --- /dev/null +++ b/app/src/main/res/drawable/ic_school_black_24dp.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/menu/menu_drawer.xml b/app/src/main/res/menu/menu_drawer.xml index 6be2dc6..8c32e04 100644 --- a/app/src/main/res/menu/menu_drawer.xml +++ b/app/src/main/res/menu/menu_drawer.xml @@ -4,7 +4,7 @@ android:title="@string/menu_reset" /> - diff --git a/app/src/main/res/menu/menu_drawer_main.xml b/app/src/main/res/menu/menu_drawer_main.xml index 8c6b68e..2b93d53 100644 --- a/app/src/main/res/menu/menu_drawer_main.xml +++ b/app/src/main/res/menu/menu_drawer_main.xml @@ -13,6 +13,8 @@ android:checkableBehavior="all"> + Weiter Skip + Tutorial \ 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 8222d56..f9ca9b5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -145,4 +145,5 @@ Next Skip + Tutorial