diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java index bee0702..8b04ac4 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java @@ -15,7 +15,6 @@ import android.os.Parcelable; import android.preference.PreferenceActivity; 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; @@ -24,12 +23,10 @@ import android.support.v7.widget.Toolbar; import android.view.Gravity; import android.view.MenuItem; import android.view.View; -import android.view.WindowManager; import android.widget.Button; import android.widget.LinearLayout; import android.widget.RatingBar; import android.widget.TextView; -import android.widget.Toast; import java.util.LinkedList; import java.util.List; @@ -46,7 +43,6 @@ import org.secuso.privacyfriendlysudoku.game.listener.ITimerListener; import org.secuso.privacyfriendlysudoku.ui.listener.IHintDialogFragmentListener; import org.secuso.privacyfriendlysudoku.ui.listener.IResetDialogFragmentListener; import org.secuso.privacyfriendlysudoku.ui.view.DialogActivity; -import org.secuso.privacyfriendlysudoku.ui.view.DialogWinScreen; import org.secuso.privacyfriendlysudoku.ui.view.R; import org.secuso.privacyfriendlysudoku.ui.view.SudokuFieldLayout; import org.secuso.privacyfriendlysudoku.ui.view.SudokuKeyboardLayout; @@ -336,18 +332,14 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On specialButtonLayout.setButtonsEnabled(false); } - @Override - public void onTick(int time) { - - //do something not so awesome public String timeToString(int time) { int seconds = time % 60; - int minutes = ((time -seconds)/60)%60 ; - int hours = (time - minutes - seconds)/(3600); - String h,m,s; - s = (seconds< 10)? "0"+String.valueOf(seconds):String.valueOf(seconds); - m = (minutes< 10)? "0"+String.valueOf(minutes):String.valueOf(minutes); - h = (hours< 10)? "0"+String.valueOf(hours):String.valueOf(hours); + int minutes = ((time - seconds) / 60) % 60; + int hours = (time - minutes - seconds) / (3600); + String h, m, s; + s = (seconds < 10) ? "0" + String.valueOf(seconds) : String.valueOf(seconds); + m = (minutes < 10) ? "0" + String.valueOf(minutes) : String.valueOf(minutes); + h = (hours < 10) ? "0" + String.valueOf(hours) : String.valueOf(hours); return h + ":" + m + ":" + s; } diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java index 95611ac..4a4de9c 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java @@ -1,9 +1,7 @@ package org.secuso.privacyfriendlysudoku.ui; -import android.app.Dialog; import android.content.Intent; import android.content.SharedPreferences; -import android.graphics.Color; import android.preference.PreferenceActivity; import android.preference.PreferenceManager; import android.support.design.widget.NavigationView; @@ -18,13 +16,11 @@ 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; @@ -40,7 +36,6 @@ import org.secuso.privacyfriendlysudoku.controller.NewLevelManager; import org.secuso.privacyfriendlysudoku.controller.helper.GameInfoContainer; import org.secuso.privacyfriendlysudoku.game.GameDifficulty; import org.secuso.privacyfriendlysudoku.game.GameType; -import org.secuso.privacyfriendlysudoku.ui.view.DialogWinScreen; import org.secuso.privacyfriendlysudoku.ui.view.R; public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener{ diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/DialogWinScreen.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/DialogWinScreen.java deleted file mode 100644 index 1a05a3f..0000000 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/DialogWinScreen.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.secuso.privacyfriendlysudoku.ui.view; - -import android.os.Bundle; -import android.support.annotation.Nullable; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; - -import org.secuso.privacyfriendlysudoku.controller.GameController; -import org.secuso.privacyfriendlysudoku.game.GameDifficulty; -import org.secuso.privacyfriendlysudoku.game.GameType; -import org.secuso.privacyfriendlysudoku.ui.GameActivity; - -/** - * Created by TMZ_LToP on 11.12.2015. - */ -public class DialogWinScreen extends android.support.v4.app.DialogFragment { - - - private ImageView upperView, lowerView; - private int time = 0; - private int hints = 0; - private GameDifficulty difficulty = GameDifficulty.Unspecified; - private GameType gameType = GameType.Unspecified; - private GameController gameController = null; - private GameActivity gameActivity = null; - - public DialogWinScreen(){ - - } - public void setProps(GameController gc, GameActivity a){ - gameActivity = a; - gameController = gc; - gameType = gc.getGameType(); - difficulty = gc.getDifficulty(); - hints = gc.getUsedHints(); - time = gc.getTime(); - } - - @Override - public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, - @Nullable Bundle savedInstanceState) { - 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...); - /*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/org/secuso/privacyfriendlysudoku/ui/view/SudokuButton.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/SudokuButton.java index 399445e..4391125 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/SudokuButton.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/SudokuButton.java @@ -1,7 +1,9 @@ package org.secuso.privacyfriendlysudoku.ui.view; import android.content.Context; +import android.graphics.Canvas; import android.util.AttributeSet; +import android.view.ContextMenu; import android.widget.Button; /** @@ -23,6 +25,8 @@ public class SudokuButton extends Button { public void setType(SudokuButtonType type) { this.type = type; } public int getValue () { return value; } public SudokuButtonType getType() { return type; } + + } diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/SudokuKeyboardLayout.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/SudokuKeyboardLayout.java index 884a539..1ee3023 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/SudokuKeyboardLayout.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/SudokuKeyboardLayout.java @@ -3,6 +3,7 @@ package org.secuso.privacyfriendlysudoku.ui.view; import android.app.Activity; import android.content.Context; import android.graphics.Canvas; +import android.graphics.Paint; import android.util.AttributeSet; import android.util.TypedValue; import android.view.View; @@ -12,6 +13,7 @@ import android.widget.LinearLayout; import org.secuso.privacyfriendlysudoku.controller.GameController; import org.secuso.privacyfriendlysudoku.controller.Symbol; import org.secuso.privacyfriendlysudoku.game.listener.IHighlightChangedListener; +import org.w3c.dom.Text; /** * Created by TMZ_LToP on 12.11.2015. @@ -24,7 +26,7 @@ public class SudokuKeyboardLayout extends LinearLayout implements IHighlightChan SudokuButton [] buttons; GameController gameController; Symbol symbolsToUse = Symbol.Default; - float normalTextSize = 0; + float normalTextSize = 30; // in dp LinearLayout [] layouts = new LinearLayout[2]; OnClickListener listener = new OnClickListener() { @@ -113,6 +115,7 @@ public class SudokuKeyboardLayout extends LinearLayout implements IHighlightChan buttons[buttonIndex].setTextColor(getResources().getColor(R.color.white)); buttons[buttonIndex].setBackgroundResource(R.drawable.mnenomic_numpad_button); buttons[buttonIndex].setText(Symbol.getSymbol(symbolsToUse, buttonIndex)); + buttons[buttonIndex].setTextSize(TypedValue.COMPLEX_UNIT_DIP,normalTextSize); buttons[buttonIndex].setValue(buttonIndex + 1); buttons[buttonIndex].setOnClickListener(listener); @@ -141,21 +144,18 @@ public class SudokuKeyboardLayout extends LinearLayout implements IHighlightChan } public void updateNotesEnabled() { - if (normalTextSize == 0) { - normalTextSize = buttons[0].getTextSize(); - } if(gameController.getNoteStatus()) { - setTextSize(normalTextSize*0.6f); + setTextSize(TypedValue.COMPLEX_UNIT_DIP,normalTextSize*0.55f); } else { - setTextSize(normalTextSize); + setTextSize(TypedValue.COMPLEX_UNIT_DIP,normalTextSize); } } - private void setTextSize(float size){ + private void setTextSize(int unit,float size){ for (SudokuButton b : buttons){ //b.setTextSize(size); - b.setTextSize(TypedValue.COMPLEX_UNIT_PX,size); + b.setTextSize(unit,size); } } @@ -183,9 +183,5 @@ public class SudokuKeyboardLayout extends LinearLayout implements IHighlightChan } } - public void fixHeight (){ - int i = getHeight(); - i = buttons[0].getHeight(); - i = buttons[5].getHeight(); - } + } diff --git a/app/src/main/res/layout/activity_main_menu.xml b/app/src/main/res/layout/activity_main_menu.xml index 51f1f84..9962430 100644 --- a/app/src/main/res/layout/activity_main_menu.xml +++ b/app/src/main/res/layout/activity_main_menu.xml @@ -110,7 +110,7 @@ android:clickable="true" android:numStars="4" android:rating="1" - android:stepSize="1"/> + android:stepSize="1" />