diff --git a/.idea/misc.xml b/.idea/misc.xml
index 5d19981..fbb6828 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -37,7 +37,7 @@
-
+
diff --git a/app/src/main/java/tu_darmstadt/sudoku/controller/SaveLoadStatistics.java b/app/src/main/java/tu_darmstadt/sudoku/controller/SaveLoadStatistics.java
index 3d35999..897f704 100644
--- a/app/src/main/java/tu_darmstadt/sudoku/controller/SaveLoadStatistics.java
+++ b/app/src/main/java/tu_darmstadt/sudoku/controller/SaveLoadStatistics.java
@@ -57,8 +57,12 @@ public class SaveLoadStatistics {
Log.e("Failed to read file","File could not be read");
}
infos = new HighscoreInfoContainer(t,dif);
+ try {
infos.setInfosFromFile(new String(bytes));
- result.add(infos);
+ } catch (IllegalArgumentException e){
+ file.delete();
+ }
+ result.add(infos);
}
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 be15ffe..58beb21 100644
--- a/app/src/main/java/tu_darmstadt/sudoku/ui/MainActivity.java
+++ b/app/src/main/java/tu_darmstadt/sudoku/ui/MainActivity.java
@@ -3,6 +3,10 @@ package tu_darmstadt.sudoku.ui;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
+import android.support.design.widget.NavigationView;
+import android.support.v4.view.GravityCompat;
+import android.support.v4.widget.DrawerLayout;
+import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
@@ -12,6 +16,7 @@ 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;
@@ -31,7 +36,7 @@ import tu_darmstadt.sudoku.game.GameDifficulty;
import tu_darmstadt.sudoku.game.GameType;
import tu_darmstadt.sudoku.ui.view.R;
-public class MainActivity extends AppCompatActivity {
+public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener{
RatingBar difficultyBar;
TextView difficultyText;
@@ -104,6 +109,18 @@ public class MainActivity extends AppCompatActivity {
editor.putBoolean("savesChanged", true);
editor.apply();
refreshContinueButton();
+
+
+ // set Nav_Bar
+ DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout_main);
+ ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
+ this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
+ drawer.setDrawerListener(toggle);
+ toggle.syncState();
+
+ NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view_main);
+ navigationView.setNavigationItemSelectedListener(this);
+
}
public void onClick(View view) {
@@ -179,6 +196,46 @@ public class MainActivity extends AppCompatActivity {
}
}
+ @Override
+ public boolean onNavigationItemSelected(MenuItem item) {
+ // Handle navigation view item clicks here.
+ int id = item.getItemId();
+
+ Intent intent;
+
+ switch(id) {
+ case R.id.menu_settings_main:
+ //open settings
+ intent = new Intent(this,SettingsActivity.class);
+ startActivity(intent);
+ break;
+
+ case R.id.nav_highscore_main:
+ // see highscore list
+
+ intent = new Intent(this, StatsActivity.class);
+ startActivity(intent);
+ break;
+
+ case R.id.menu_about_main:
+ //open about page
+ intent = new Intent(this,AboutActivity.class);
+ startActivity(intent);
+ break;
+
+ case R.id.menu_help_main:
+ //open about page
+ //intent = new Intent(this,HelpActivity.class);
+ //startActivity(intent);
+ break;
+ default:
+ }
+
+ DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout_main);
+ drawer.closeDrawer(GravityCompat.START);
+ return true;
+ }
+
/*@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
diff --git a/app/src/main/res/layout/activity_game_view.xml b/app/src/main/res/layout/activity_game_view.xml
index 5066a4f..64bd721 100644
--- a/app/src/main/res/layout/activity_game_view.xml
+++ b/app/src/main/res/layout/activity_game_view.xml
@@ -9,9 +9,11 @@
android:layout_height="match_parent" />
+
diff --git a/app/src/main/res/layout/activity_main_menu.xml b/app/src/main/res/layout/activity_main_menu.xml
index a2ab1b5..719e01e 100644
--- a/app/src/main/res/layout/activity_main_menu.xml
+++ b/app/src/main/res/layout/activity_main_menu.xml
@@ -1,14 +1,21 @@
-
+
+
+ android:id="@+id/toolbar"
+ android:layout_width="match_parent"
+ android:layout_height="?attr/actionBarSize"
+ android:background="?attr/colorPrimary"
+ app:popupTheme="@style/AppTheme.PopupOverlay">
+
+
-
\ No newline at end of file
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/menu_drawer_main.xml b/app/src/main/res/menu/menu_drawer_main.xml
new file mode 100644
index 0000000..5c5732b
--- /dev/null
+++ b/app/src/main/res/menu/menu_drawer_main.xml
@@ -0,0 +1,19 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml
index 63fc816..4facc4e 100644
--- a/app/src/main/res/values-w820dp/dimens.xml
+++ b/app/src/main/res/values-w820dp/dimens.xml
@@ -3,4 +3,5 @@
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
64dp
+ 0dp