diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/DailySudokuActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/DailySudokuActivity.java index 96aeba9..aa86113 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/DailySudokuActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/DailySudokuActivity.java @@ -1,16 +1,22 @@ package org.secuso.privacyfriendlysudoku.ui.view; + import android.content.SharedPreferences; import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; +import org.secuso.privacyfriendlysudoku.controller.SaveLoadStatistics; import org.secuso.privacyfriendlysudoku.controller.helper.GameInfoContainer; +import org.secuso.privacyfriendlysudoku.ui.StatsActivity; import java.util.List; public class DailySudokuActivity extends AppCompatActivity { List loadableGameList; SharedPreferences settings; + private StatsActivity.SectionsPagerAdapter mSectionsPagerAdapter; @Override @@ -29,4 +35,32 @@ public class DailySudokuActivity extends AppCompatActivity { } + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.menu_stats, menu); + //getMenuInflater().inflate(R.menu.menu_stats, menu); + return true; + //return false; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + + //noinspection SimplifiableIfStatement + switch(item.getItemId()) { + case R.id.action_reset: + SaveLoadStatistics.resetStats(this); + mSectionsPagerAdapter.refresh(this); + return true; + case android.R.id.home: + finish(); + return true; + } + + return super.onOptionsItemSelected(item); + } + } \ No newline at end of file