added DialogeFragment for WinScreen
This commit is contained in:
parent
97becd93e5
commit
f205532ed4
12 changed files with 146 additions and 9 deletions
|
@ -37,7 +37,7 @@
|
||||||
<ConfirmationsSetting value="0" id="Add" />
|
<ConfirmationsSetting value="0" id="Add" />
|
||||||
<ConfirmationsSetting value="0" id="Remove" />
|
<ConfirmationsSetting value="0" id="Remove" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
|
|
@ -6,6 +6,7 @@ import android.graphics.Point;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.design.widget.NavigationView;
|
import android.support.design.widget.NavigationView;
|
||||||
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.view.GravityCompat;
|
import android.support.v4.view.GravityCompat;
|
||||||
import android.support.v4.widget.DrawerLayout;
|
import android.support.v4.widget.DrawerLayout;
|
||||||
import android.support.v7.app.ActionBarDrawerToggle;
|
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.SaveLoadStatistics;
|
||||||
import tu_darmstadt.sudoku.controller.helper.GameInfoContainer;
|
import tu_darmstadt.sudoku.controller.helper.GameInfoContainer;
|
||||||
import tu_darmstadt.sudoku.game.GameDifficulty;
|
import tu_darmstadt.sudoku.game.GameDifficulty;
|
||||||
import tu_darmstadt.sudoku.game.GameStatus;
|
|
||||||
import tu_darmstadt.sudoku.game.GameType;
|
import tu_darmstadt.sudoku.game.GameType;
|
||||||
import tu_darmstadt.sudoku.game.listener.IGameSolvedListener;
|
import tu_darmstadt.sudoku.game.listener.IGameSolvedListener;
|
||||||
import tu_darmstadt.sudoku.game.listener.ITimerListener;
|
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.R;
|
||||||
import tu_darmstadt.sudoku.ui.view.SudokuFieldLayout;
|
import tu_darmstadt.sudoku.ui.view.SudokuFieldLayout;
|
||||||
import tu_darmstadt.sudoku.ui.view.SudokuKeyboardLayout;
|
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 = (RatingBar) findViewById(R.id.gameModeStar);
|
||||||
ratingBar.setMax(numberOfStarts);
|
ratingBar.setMax(numberOfStarts);
|
||||||
ratingBar.setNumStars(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()));
|
((TextView)findViewById(R.id.difficultyText)).setText(getString(gameController.getDifficulty().getStringResID()));
|
||||||
|
|
||||||
|
|
||||||
|
@ -231,7 +232,13 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
||||||
t.show();
|
t.show();
|
||||||
SaveLoadStatistics s = new SaveLoadStatistics(this);
|
SaveLoadStatistics s = new SaveLoadStatistics(this);
|
||||||
s.saveGameStats(gameController);
|
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 :)
|
// TODO: WE WON.. do something awesome :)
|
||||||
|
gameController.pauseTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -34,6 +34,7 @@ import tu_darmstadt.sudoku.controller.NewLevelManager;
|
||||||
import tu_darmstadt.sudoku.controller.helper.GameInfoContainer;
|
import tu_darmstadt.sudoku.controller.helper.GameInfoContainer;
|
||||||
import tu_darmstadt.sudoku.game.GameDifficulty;
|
import tu_darmstadt.sudoku.game.GameDifficulty;
|
||||||
import tu_darmstadt.sudoku.game.GameType;
|
import tu_darmstadt.sudoku.game.GameType;
|
||||||
|
import tu_darmstadt.sudoku.ui.view.DialogWinScreen;
|
||||||
import tu_darmstadt.sudoku.ui.view.R;
|
import tu_darmstadt.sudoku.ui.view.R;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener{
|
public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener{
|
||||||
|
@ -122,6 +123,11 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||||
navigationView.setNavigationItemSelectedListener(this);
|
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) {
|
public void onClick(View view) {
|
||||||
|
|
||||||
|
@ -133,9 +139,6 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||||
/**case R.id.aboutButton:
|
/**case R.id.aboutButton:
|
||||||
i = new Intent(this, AboutActivity.class);
|
i = new Intent(this, AboutActivity.class);
|
||||||
break;
|
break;
|
||||||
case R.id.continueButton:
|
|
||||||
i = new Intent(this, LoadGameActivity.class);
|
|
||||||
break;
|
|
||||||
case R.id.highscoreButton:
|
case R.id.highscoreButton:
|
||||||
i = new Intent(this,StatsActivity.class);
|
i = new Intent(this,StatsActivity.class);
|
||||||
break;
|
break;
|
||||||
|
@ -145,6 +148,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||||
case R.id.helpButton:
|
case R.id.helpButton:
|
||||||
// TODO: create help page.. what is supposed to be in there?!
|
// TODO: create help page.. what is supposed to be in there?!
|
||||||
break;*/
|
break;*/
|
||||||
|
case R.id.continueButton:
|
||||||
|
i = new Intent(this, LoadGameActivity.class);
|
||||||
|
break;
|
||||||
case R.id.playButton:
|
case R.id.playButton:
|
||||||
GameType gameType = GameType.getValidGameTypes().get(mViewPager.getCurrentItem());
|
GameType gameType = GameType.getValidGameTypes().get(mViewPager.getCurrentItem());
|
||||||
int index = difficultyBar.getProgress()-1;
|
int index = difficultyBar.getProgress()-1;
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -155,7 +155,6 @@ public class SudokuCellView extends View {
|
||||||
p.setAntiAlias(true);
|
p.setAntiAlias(true);
|
||||||
p.setTextSize(Math.min(mHeight * 3 / 4, mHeight * 3 / 4));
|
p.setTextSize(Math.min(mHeight * 3 / 4, mHeight * 3 / 4));
|
||||||
p.setTextAlign(Paint.Align.CENTER);
|
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);
|
canvas.drawText(Symbol.getSymbol(symbolsToUse, mGameCell.getValue()-1), mHeight / 2, mHeight / 2 + mHeight / 4, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,6 @@ public class SudokuKeyboardLayout extends GridLayout {
|
||||||
buttons[number].setLayoutParams(p);
|
buttons[number].setLayoutParams(p);
|
||||||
//buttons[number].setGravity(Gravity.CENTER);
|
//buttons[number].setGravity(Gravity.CENTER);
|
||||||
buttons[number].setType(SudokuButtonType.Value);
|
buttons[number].setType(SudokuButtonType.Value);
|
||||||
// TODO settings: get SymbolEnum from settings
|
|
||||||
buttons[number].setBackgroundResource(R.drawable.mnenomic_numpad_button);
|
buttons[number].setBackgroundResource(R.drawable.mnenomic_numpad_button);
|
||||||
buttons[number].setText(Symbol.getSymbol(symbolsToUse, number));
|
buttons[number].setText(Symbol.getSymbol(symbolsToUse, number));
|
||||||
buttons[number].setValue(number + 1);
|
buttons[number].setValue(number + 1);
|
||||||
|
|
BIN
app/src/main/res/drawable/ic_trophy_award_black_48dp.png
Normal file
BIN
app/src/main/res/drawable/ic_trophy_award_black_48dp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
BIN
app/src/main/res/drawable/ic_trophy_black_48dp.png
Normal file
BIN
app/src/main/res/drawable/ic_trophy_black_48dp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
|
@ -132,6 +132,11 @@
|
||||||
android:capitalize="none"
|
android:capitalize="none"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:background="@drawable/mnenomic_numpad_button"/>
|
android:background="@drawable/mnenomic_numpad_button"/>
|
||||||
|
<Button
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="testforwinshitz"
|
||||||
|
android:onClick="callFragment"/>
|
||||||
<!--
|
<!--
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
|
android:id="@+id/game_coordinate_layout"
|
||||||
tools:context="tu_darmstadt.sudoku.activity.GameActivity">
|
tools:context="tu_darmstadt.sudoku.activity.GameActivity">
|
||||||
|
|
||||||
<android.support.design.widget.AppBarLayout
|
<android.support.design.widget.AppBarLayout
|
||||||
|
|
69
app/src/main/res/layout/win_screen_layout.xml
Normal file
69
app/src/main/res/layout/win_screen_layout.xml
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="200dp" android:layout_height="250dp"
|
||||||
|
android:background="@drawable/ic_trophy_black_48dp"
|
||||||
|
android:weightSum="5"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@color/transparent"
|
||||||
|
android:gravity="center">
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
android:background="@color/transparent"
|
||||||
|
android:src="@drawable/ic_trophy_award_black_48dp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_weight="3"
|
||||||
|
android:gravity="center"
|
||||||
|
android:background="@color/transparent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/win_text"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:paddingLeft="5dp"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
android:textColor="@color/lightblue"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="test2"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:textColor="@color/lightblue"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="test1"
|
||||||
|
android:textColor="@color/lightblue"
|
||||||
|
android:layout_gravity="center"/>
|
||||||
|
<View
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="10dp"
|
||||||
|
android:background="@color/middleblue"
|
||||||
|
android:layout_gravity="bottom" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@color/transparent"
|
||||||
|
android:gravity="center">
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
android:src="@drawable/ic_trophy_award_black_48dp"
|
||||||
|
android:background="@color/transparent" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
|
@ -80,6 +80,7 @@
|
||||||
<string name="reset_stats">reset stats</string>
|
<string name="reset_stats">reset stats</string>
|
||||||
|
|
||||||
|
|
||||||
|
<!--### Win Strings -->
|
||||||
|
<string name="win_text">Congratz du depp du hast gewonnen oder so was</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue