winscreen and helppage created fixed text size
This commit is contained in:
parent
06dd3fa9fa
commit
9c3579d4af
8 changed files with 37 additions and 102 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
android:clickable="true"
|
||||
android:numStars="4"
|
||||
android:rating="1"
|
||||
android:stepSize="1"/>
|
||||
android:stepSize="1" />
|
||||
|
||||
<Button
|
||||
android:textColor="@color/white"
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<dimen name="text_margin">16dp</dimen>
|
||||
|
||||
|
||||
<dimen name="text_size">14sp</dimen>
|
||||
<dimen name="text_size">20sp</dimen>
|
||||
<dimen name="main_text_difficulty">35sp</dimen>
|
||||
<dimen name="main_button_padding">30dp</dimen>
|
||||
|
||||
|
|
|
@ -1,32 +1,32 @@
|
|||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<PreferenceCategory android:title="@string/pref_help_keyboard">
|
||||
<ListPreference android:title="@string/pref_help_keyheighlited"
|
||||
<Preference android:title="@string/pref_help_keyheighlited"
|
||||
android:selectable="false"
|
||||
android:icon="@drawable/numpad_highlighted"
|
||||
android:summary="@string/pref_help_keyheighlited_summary"/>
|
||||
<ListPreference android:title="@string/pref_help_keyheighlited_yellow"
|
||||
<Preference android:title="@string/pref_help_keyheighlited_yellow"
|
||||
android:selectable="false"
|
||||
android:icon="@drawable/numpad_highlighted_three"
|
||||
android:summary="@string/pref_help_keyheighlited_yellow_summary"/>
|
||||
|
||||
<ListPreference android:title="@string/pref_help_do"
|
||||
<Preference android:title="@string/pref_help_do"
|
||||
android:selectable="false"
|
||||
android:icon="@drawable/ic_redo_black_48dp"
|
||||
android:summary="@string/pref_help_do_summary"/>
|
||||
<ListPreference android:title="@string/pref_help_undo"
|
||||
<Preference android:title="@string/pref_help_undo"
|
||||
android:selectable="false"
|
||||
android:icon="@drawable/ic_undo_black_48dp"
|
||||
android:summary="@string/pref_help_undo_summary"/>
|
||||
<ListPreference android:title="@string/pref_help_hint"
|
||||
<Preference android:title="@string/pref_help_hint"
|
||||
android:selectable="false"
|
||||
android:icon="@drawable/ic_lightbulb_outline_black_48dp"
|
||||
android:summary="@string/pref_help_hint_summary"/>
|
||||
<ListPreference android:title="@string/pref_help_delete"
|
||||
<Preference android:title="@string/pref_help_delete"
|
||||
android:selectable="false"
|
||||
android:icon="@drawable/ic_delete_black_24dp"
|
||||
android:icon="@drawable/ic_delete_black_48dp"
|
||||
android:summary="@string/pref_help_delete_summary"/>
|
||||
<ListPreference android:title="@string/pref_help_notes"
|
||||
<Preference android:title="@string/pref_help_notes"
|
||||
android:selectable="false"
|
||||
android:icon="@drawable/ic_create_black_48dp"
|
||||
android:summary="@string/pref_help_notes_summary"/>
|
||||
|
@ -38,6 +38,14 @@
|
|||
<PreferenceCategory android:title="@string/pref_help_statusbar">
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory android:title="Privacy Info">
|
||||
|
||||
<Preference android:title="Privacy Friendly Sudoku" android:summary=""/>
|
||||
|
||||
<Preference android:title="Permissions" android:summary="Privacy Friendly Sudoku app whiche does not need any permission."/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<!-- NOTE: EditTextPreference accepts EditText attributes. -->
|
||||
<!-- NOTE: EditTextPreference's summary should be set to its value by the activity code. -->
|
||||
<!-- <EditTextPreference
|
||||
|
|
Loading…
Reference in a new issue