small changes
This commit is contained in:
parent
29028c39f5
commit
48535eedd6
7 changed files with 156 additions and 74 deletions
|
@ -1,5 +1,6 @@
|
|||
package tu_darmstadt.sudoku.ui;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
|
@ -15,11 +16,13 @@ import android.support.v4.app.FragmentManager;
|
|||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RatingBar;
|
||||
|
@ -124,9 +127,18 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
|||
|
||||
}
|
||||
public void callFragment(View view){
|
||||
FragmentManager fm = getSupportFragmentManager();
|
||||
/*FragmentManager fm = getSupportFragmentManager();
|
||||
DialogWinScreen winScreen = new DialogWinScreen();
|
||||
winScreen.show(fm,"win_screen_layout");
|
||||
|
||||
winScreen.show(fm,"win_screen_layout");*/
|
||||
Dialog dialog = new Dialog(this);
|
||||
//dialog.setContentView(getLayoutInflater().inflate(R.layout.win_screen_layout,null));
|
||||
dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
|
||||
//dialog.setContentView(R.layout.win_screen_layout);
|
||||
dialog.getWindow().setGravity(Gravity.CENTER_HORIZONTAL);
|
||||
dialog.getWindow().setContentView(R.layout.win_screen_layout);
|
||||
dialog.getWindow().setBackgroundDrawableResource(R.color.transparent);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
public void onClick(View view) {
|
||||
|
|
|
@ -145,6 +145,7 @@ public class StatsActivity extends AppCompatActivity {
|
|||
private TextView difficultyView,averageTimeView,minTimeView;
|
||||
private RatingBar difficultyBarView;
|
||||
private String s;
|
||||
private int t;
|
||||
private int totalTime =0;
|
||||
private int totalGames =0;
|
||||
private int totalHints =0;
|
||||
|
@ -185,6 +186,7 @@ public class StatsActivity extends AppCompatActivity {
|
|||
|
||||
|
||||
private String formatTime(int totalTime){
|
||||
if (totalTime==0) return "/";
|
||||
int seconds = totalTime % 60;
|
||||
int minutes = ((totalTime -seconds)/60)%60 ;
|
||||
int hours = (totalTime - minutes - seconds)/(3600);
|
||||
|
@ -196,9 +198,9 @@ public class StatsActivity extends AppCompatActivity {
|
|||
|
||||
}
|
||||
private void updateGeneralIfo(int time, int games, int hints){
|
||||
totalHints +=hints;
|
||||
totalGames +=games;
|
||||
totalTime +=time;
|
||||
totalHints =hints;
|
||||
totalGames =games;
|
||||
totalTime =time;
|
||||
}
|
||||
private void setGeneralInfo(){
|
||||
TextView generalInfoView;
|
||||
|
@ -237,10 +239,10 @@ public class StatsActivity extends AppCompatActivity {
|
|||
}
|
||||
difficultyBarView.setRating(pos+1);
|
||||
difficultyView.setText(rootView.getResources().getString(infos.getDifficulty().getStringResID()));
|
||||
s= (infos.getTimeNoHints() == 0)?"/":String.valueOf(infos.getTimeNoHints() / infos.getNumberOfGamesNoHints());
|
||||
averageTimeView.setText(s);
|
||||
s = (infos.getMinTime()==Integer.MAX_VALUE)? "/":String.valueOf(infos.getMinTime());
|
||||
minTimeView.setText(s);
|
||||
t= (infos.getTimeNoHints() == 0)?0:(infos.getTimeNoHints() / infos.getNumberOfGamesNoHints());
|
||||
averageTimeView.setText(formatTime(t));
|
||||
t = (infos.getMinTime()==Integer.MAX_VALUE)? 0:(infos.getMinTime());
|
||||
minTimeView.setText(formatTime(t));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -6,11 +6,13 @@ import android.support.annotation.Nullable;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
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.GridLayout;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import tu_darmstadt.sudoku.controller.GameController;
|
||||
|
@ -47,8 +49,12 @@ public class DialogWinScreen extends android.support.v4.app.DialogFragment {
|
|||
@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);
|
||||
View view = inflater.inflate(R.layout.win_screen_layout,null);
|
||||
|
||||
// set background for the dialog window maybe just set the background to the drawable or to transparent
|
||||
|
||||
//getDialog().getWindow().setWindowAnimations();
|
||||
//getDialog().getWindow().setAttributes(new WindowManager.LayoutParams(250,250,getDialog().getWindow().getAttributes().type,getDialog().getWindow().getAttributes().flags,getDialog().getWindow().getAttributes().format ));
|
||||
//getDialog().getWindow().setLayout(200,250);
|
||||
//Maybe creat real animation
|
||||
//Animation ani = AnimationUtils.loadAnimation(this,R.anim...);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<android.support.v7.widget.Toolbar android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent" android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay"
|
||||
app:layout_scrollFlags="scroll|enterAlways">
|
||||
app:layout_scrollFlags="enterAlways">
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
|||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
<android.support.v4.view.ViewPager android:id="@+id/container"
|
||||
android:layout_width="match_parent" android:layout_height="match_parent"
|
||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||
|
||||
|
||||
|
|
|
@ -1,69 +1,121 @@
|
|||
<?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>
|
||||
android:layout_width="250dp" android:layout_height="350dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_gravity="center">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="3"
|
||||
android:gravity="center"
|
||||
android:background="@color/transparent"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="250dp" android:layout_height="250dp"
|
||||
android:background="@drawable/ic_trophy_black_48dp"
|
||||
android:weightSum="5"
|
||||
android:orientation="horizontal"
|
||||
android:layout_gravity="center"
|
||||
>
|
||||
<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
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/transparent"
|
||||
android:gravity="bottom"
|
||||
android:orientation="vertical"
|
||||
android:layout_gravity="bottom">
|
||||
<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" />
|
||||
<View
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="10dp"
|
||||
android:background="@color/middleblue"
|
||||
android:layout_gravity="bottom"
|
||||
android:foregroundGravity="bottom"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/win_middle_linear"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="3"
|
||||
android:gravity="center"
|
||||
android:background="@color/transparent"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="5"
|
||||
>
|
||||
<LinearLayout
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="4"
|
||||
android:layout_marginTop="50dp"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/win_text"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/white"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="test2"
|
||||
android:layout_gravity="center"
|
||||
android:textColor="@color/white"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="test1"
|
||||
android:textColor="@color/white"
|
||||
android:layout_gravity="center"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
<View
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="20dp"
|
||||
android:background="@color/middleblue"
|
||||
android:layout_gravity="bottom"
|
||||
android:foregroundGravity="bottom"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/transparent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="bottom">
|
||||
<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" />
|
||||
<View
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="10dp"
|
||||
android:background="@color/middleblue"
|
||||
android:layout_gravity="bottom"
|
||||
android:foregroundGravity="bottom"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</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" />
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="20dp">
|
||||
<Button
|
||||
android:id="@+id/win_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/colorPrimaryDark"
|
||||
android:text="@string/win_button_text"/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
|
@ -99,5 +99,6 @@
|
|||
|
||||
<!--### Win Strings -->
|
||||
<string name="win_text">Congratulations, you have solved the puzzle.</string>
|
||||
<string name="win_button_text">OK!</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -13,5 +13,14 @@
|
|||
</style>
|
||||
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
||||
|
||||
<style name="WinDialog" parent="@android:style/Theme.Dialog">
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
<item name="android:windowBackground">@color/transparent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:backgroundDimEnabled">false</item>
|
||||
<item name="android:windowIsFloating">false</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue