Bordeless Style added and Still not figured out how to set Text Size correct
This commit is contained in:
parent
d3abad12a2
commit
4bfdf01a9a
4 changed files with 34 additions and 19 deletions
|
@ -17,7 +17,7 @@ public class SudokuButton extends Button {
|
|||
private SudokuButtonType type = SudokuButtonType.Unspecified;
|
||||
|
||||
public SudokuButton(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
super(context, attrs,R.attr.borderlessButtonStyle);
|
||||
}
|
||||
|
||||
public void setValue(int value) { this.value = value; }
|
||||
|
|
|
@ -2,6 +2,7 @@ package tu_darmstadt.sudoku.ui.view;
|
|||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
|
@ -85,14 +86,21 @@ public class SudokuKeyboardLayout extends GridLayout {
|
|||
|
||||
public void setNotesEnabled(boolean b) {
|
||||
notesEnabled = b;
|
||||
}
|
||||
|
||||
public void setValueSize (float size){
|
||||
for (int i = 0; i< buttons.length;i++){
|
||||
buttons[i].setTextSize(size);
|
||||
if(notesEnabled) {
|
||||
setTextSize(buttons[0].getPaint().getTextSize()/2);
|
||||
}else {
|
||||
setTextSize(buttons[0].getPaint().getTextSize()*2);
|
||||
}
|
||||
}
|
||||
|
||||
private void setTextSize(float size){
|
||||
for (SudokuButton b : buttons){
|
||||
//b.setTextSize(size);
|
||||
b.getPaint().setTextSize(size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas canvas) {
|
||||
|
|
|
@ -22,7 +22,6 @@ public class SudokuSpecialButtonLayout extends LinearLayout {
|
|||
|
||||
SudokuButton [] fixedButtons;
|
||||
public int fixedButtonsCount = SudokuButtonType.getSpecialButtons().size();
|
||||
String [] s = {"Do","Un","off","Del","Sh**","Hi"};
|
||||
GameController gameController;
|
||||
boolean notesEnabled=false;
|
||||
SudokuKeyboardLayout keyboard;
|
||||
|
@ -42,7 +41,6 @@ public class SudokuSpecialButtonLayout extends LinearLayout {
|
|||
notesEnabled = !notesEnabled;
|
||||
btn.setText(notesEnabled ? "ON" : "OFF");
|
||||
keyboard.setNotesEnabled(notesEnabled);
|
||||
keyboard.setValueSize(notesEnabled ?btn.getTextSize()/4: btn.getTextSize()/2 );
|
||||
break;
|
||||
case Do:
|
||||
// TODO: not implemented
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
android:id="@+id/appbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/appbar_padding_top"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
|
@ -32,7 +31,8 @@
|
|||
android:layout_width="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="10"
|
||||
android:layout_marginTop="?attr/actionBarSize">
|
||||
android:layout_marginTop="?attr/actionBarSize"
|
||||
style="?android:buttonBarStyle">
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/scroller"
|
||||
|
@ -58,7 +58,8 @@
|
|||
android:weightSum="8"
|
||||
android:divider="#000"
|
||||
android:baselineAligned="false"
|
||||
android:gravity="center_horizontal">
|
||||
android:gravity="center_horizontal"
|
||||
style="?android:buttonBarStyle">
|
||||
|
||||
|
||||
<RatingBar
|
||||
|
@ -84,7 +85,8 @@
|
|||
android:onClick="onClick"
|
||||
android:capitalize="none"
|
||||
android:clickable="false"
|
||||
android:elevation="10dp"/>
|
||||
android:elevation="10dp"
|
||||
style="?android:attr/borderlessButtonStyle"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="match_parent"
|
||||
|
@ -98,13 +100,15 @@
|
|||
android:layout_weight="2"
|
||||
android:onClick="onClick"
|
||||
android:capitalize="none"
|
||||
android:clickable="false" />
|
||||
android:clickable="false"
|
||||
style="?android:attr/borderlessButtonStyle"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="2"
|
||||
android:weightSum="2">
|
||||
android:weightSum="2"
|
||||
style="?android:buttonBarStyle">
|
||||
<Button
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -117,7 +121,8 @@
|
|||
android:layout_weight="1"
|
||||
android:onClick="onClick"
|
||||
android:capitalize="none"
|
||||
android:clickable="false" />
|
||||
android:clickable="false"
|
||||
style="?android:attr/borderlessButtonStyle"/>
|
||||
<Button
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -130,13 +135,15 @@
|
|||
android:layout_weight="1"
|
||||
android:onClick="onClick"
|
||||
android:capitalize="none"
|
||||
android:clickable="false" />
|
||||
android:clickable="false"
|
||||
style="?android:attr/borderlessButtonStyle"/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="2"
|
||||
android:weightSum="2">
|
||||
android:weightSum="2"
|
||||
style="?android:buttonBarStyle">
|
||||
<Button
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -149,7 +156,8 @@
|
|||
android:layout_weight="1"
|
||||
android:onClick="onClick"
|
||||
android:capitalize="none"
|
||||
android:clickable="false" />
|
||||
android:clickable="false"
|
||||
style="?android:attr/borderlessButtonStyle"/>
|
||||
<Button
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -162,7 +170,8 @@
|
|||
android:layout_weight="1"
|
||||
android:onClick="onClick"
|
||||
android:capitalize="none"
|
||||
android:clickable="false" />
|
||||
android:clickable="false"
|
||||
style="?android:attr/borderlessButtonStyle"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
|
Loading…
Reference in a new issue