diff --git a/.idea/misc.xml b/.idea/misc.xml index fbb6828..5d19981 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -37,7 +37,7 @@ - + diff --git a/app/src/main/java/tu_darmstadt/sudoku/ui/GameActivity.java b/app/src/main/java/tu_darmstadt/sudoku/ui/GameActivity.java index 36dfaaa..e27363d 100644 --- a/app/src/main/java/tu_darmstadt/sudoku/ui/GameActivity.java +++ b/app/src/main/java/tu_darmstadt/sudoku/ui/GameActivity.java @@ -6,6 +6,7 @@ import android.graphics.Point; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.design.widget.NavigationView; +import android.support.v4.app.FragmentManager; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; @@ -23,10 +24,10 @@ import tu_darmstadt.sudoku.controller.GameController; import tu_darmstadt.sudoku.controller.SaveLoadStatistics; import tu_darmstadt.sudoku.controller.helper.GameInfoContainer; import tu_darmstadt.sudoku.game.GameDifficulty; -import tu_darmstadt.sudoku.game.GameStatus; import tu_darmstadt.sudoku.game.GameType; import tu_darmstadt.sudoku.game.listener.IGameSolvedListener; import tu_darmstadt.sudoku.game.listener.ITimerListener; +import tu_darmstadt.sudoku.ui.view.DialogWinScreen; import tu_darmstadt.sudoku.ui.view.R; import tu_darmstadt.sudoku.ui.view.SudokuFieldLayout; import tu_darmstadt.sudoku.ui.view.SudokuKeyboardLayout; @@ -122,7 +123,7 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On ratingBar = (RatingBar) findViewById(R.id.gameModeStar); ratingBar.setMax(numberOfStarts); ratingBar.setNumStars(numberOfStarts); - ratingBar.setRating(difficutyList.indexOf(gameController.getDifficulty())+1); + ratingBar.setRating(difficutyList.indexOf(gameController.getDifficulty()) + 1); ((TextView)findViewById(R.id.difficultyText)).setText(getString(gameController.getDifficulty().getStringResID())); @@ -231,7 +232,13 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On t.show(); SaveLoadStatistics s = new SaveLoadStatistics(this); s.saveGameStats(gameController); + DialogWinScreen win = new DialogWinScreen(); + win.setProps(gameController); + FragmentManager fr = getSupportFragmentManager(); + win.show(fr, "win_screen_layout"); + // TODO: WE WON.. do something awesome :) + gameController.pauseTimer(); } @Override 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 f9a3722..71dc5da 100644 --- a/app/src/main/java/tu_darmstadt/sudoku/ui/MainActivity.java +++ b/app/src/main/java/tu_darmstadt/sudoku/ui/MainActivity.java @@ -34,6 +34,7 @@ import tu_darmstadt.sudoku.controller.NewLevelManager; import tu_darmstadt.sudoku.controller.helper.GameInfoContainer; import tu_darmstadt.sudoku.game.GameDifficulty; import tu_darmstadt.sudoku.game.GameType; +import tu_darmstadt.sudoku.ui.view.DialogWinScreen; import tu_darmstadt.sudoku.ui.view.R; public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener{ @@ -122,6 +123,11 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On navigationView.setNavigationItemSelectedListener(this); } + public void callFragment(View view){ + FragmentManager fm = getSupportFragmentManager(); + DialogWinScreen winScreen = new DialogWinScreen(); + winScreen.show(fm,"win_screen_layout"); + } public void onClick(View view) { @@ -133,9 +139,6 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On /**case R.id.aboutButton: i = new Intent(this, AboutActivity.class); break; - case R.id.continueButton: - i = new Intent(this, LoadGameActivity.class); - break; case R.id.highscoreButton: i = new Intent(this,StatsActivity.class); break; @@ -145,6 +148,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On case R.id.helpButton: // TODO: create help page.. what is supposed to be in there?! break;*/ + case R.id.continueButton: + i = new Intent(this, LoadGameActivity.class); + break; case R.id.playButton: GameType gameType = GameType.getValidGameTypes().get(mViewPager.getCurrentItem()); int index = difficultyBar.getProgress()-1; 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 new file mode 100644 index 0000000..91f595d --- /dev/null +++ b/app/src/main/java/tu_darmstadt/sudoku/ui/view/DialogWinScreen.java @@ -0,0 +1,50 @@ +package tu_darmstadt.sudoku.ui.view; + +import android.app.DialogFragment; +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +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.ImageView; + +import tu_darmstadt.sudoku.controller.GameController; + +/** + * Created by TMZ_LToP on 11.12.2015. + */ +public class DialogWinScreen extends android.support.v4.app.DialogFragment { + + + ImageView upperView, lowerView; + + public DialogWinScreen(){ + + } + public void setProps(GameController gc){ + + //no second Conjstrutor with argument allowed + //save everything that should be sown in winscreeen and set in the text etc + + } + @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); + //getDialog().getWindow().setLayout(200,250); + //Maybe creat real animation + //Animation ani = AnimationUtils.loadAnimation(this,R.anim...); + /*RotateAnimation anim = new RotateAnimation(0.0f,350.0f,60f,60f); + anim.setInterpolator(new LinearInterpolator()); + anim.setRepeatCount(Animation.INFINITE); + anim.setDuration(700); + */ + return view; + } +} diff --git a/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuCellView.java b/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuCellView.java index 60859d6..d47b777 100644 --- a/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuCellView.java +++ b/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuCellView.java @@ -155,7 +155,6 @@ public class SudokuCellView extends View { p.setAntiAlias(true); p.setTextSize(Math.min(mHeight * 3 / 4, mHeight * 3 / 4)); p.setTextAlign(Paint.Align.CENTER); - // TODO settings: get SymbolEnum from settings canvas.drawText(Symbol.getSymbol(symbolsToUse, mGameCell.getValue()-1), mHeight / 2, mHeight / 2 + mHeight / 4, p); } diff --git a/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuKeyboardLayout.java b/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuKeyboardLayout.java index 6962ad1..93b79d5 100644 --- a/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuKeyboardLayout.java +++ b/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuKeyboardLayout.java @@ -81,7 +81,6 @@ public class SudokuKeyboardLayout extends GridLayout { buttons[number].setLayoutParams(p); //buttons[number].setGravity(Gravity.CENTER); buttons[number].setType(SudokuButtonType.Value); - // TODO settings: get SymbolEnum from settings buttons[number].setBackgroundResource(R.drawable.mnenomic_numpad_button); buttons[number].setText(Symbol.getSymbol(symbolsToUse, number)); buttons[number].setValue(number + 1); diff --git a/app/src/main/res/drawable/ic_trophy_award_black_48dp.png b/app/src/main/res/drawable/ic_trophy_award_black_48dp.png new file mode 100644 index 0000000..e85ed53 Binary files /dev/null and b/app/src/main/res/drawable/ic_trophy_award_black_48dp.png differ diff --git a/app/src/main/res/drawable/ic_trophy_black_48dp.png b/app/src/main/res/drawable/ic_trophy_black_48dp.png new file mode 100644 index 0000000..7d1620f Binary files /dev/null and b/app/src/main/res/drawable/ic_trophy_black_48dp.png differ diff --git a/app/src/main/res/layout/activity_main_menu.xml b/app/src/main/res/layout/activity_main_menu.xml index 4a0bc96..d574b2a 100644 --- a/app/src/main/res/layout/activity_main_menu.xml +++ b/app/src/main/res/layout/activity_main_menu.xml @@ -132,6 +132,11 @@ android:capitalize="none" android:clickable="false" android:background="@drawable/mnenomic_numpad_button"/> +