Edit Buttons and slideshow with arrows
This commit is contained in:
parent
f28217bf46
commit
7242345a21
16 changed files with 152 additions and 28 deletions
|
@ -1,8 +0,0 @@
|
||||||
package tu_darmstadt.sudoku.game.listeners;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by TMZ_LToP on 25.11.2015.
|
|
||||||
*/
|
|
||||||
public interface IStatsListener {
|
|
||||||
public void refresh();
|
|
||||||
}
|
|
|
@ -98,8 +98,9 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
||||||
keyboard.setRowCount(2);
|
keyboard.setRowCount(2);
|
||||||
Point p = new Point();
|
Point p = new Point();
|
||||||
getWindowManager().getDefaultDisplay().getSize(p);
|
getWindowManager().getDefaultDisplay().getSize(p);
|
||||||
|
|
||||||
//int width = p.x;
|
//int width = p.x;
|
||||||
keyboard.setKeyBoard(gameController.getSize(), p.x);
|
keyboard.setKeyBoard(gameController.getSize(), p.x,layout.getHeight()-p.y);
|
||||||
|
|
||||||
|
|
||||||
//set Special keys
|
//set Special keys
|
||||||
|
|
|
@ -4,9 +4,9 @@ import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.Gravity;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.GridLayout;
|
import android.widget.GridLayout;
|
||||||
|
import android.support.v7.widget.GridLayoutManager;
|
||||||
|
|
||||||
import tu_darmstadt.sudoku.controller.GameController;
|
import tu_darmstadt.sudoku.controller.GameController;
|
||||||
import tu_darmstadt.sudoku.controller.Symbol;
|
import tu_darmstadt.sudoku.controller.Symbol;
|
||||||
|
@ -46,30 +46,43 @@ public class SudokuKeyboardLayout extends GridLayout {
|
||||||
public SudokuKeyboardLayout(Context context, AttributeSet attrs) {
|
public SudokuKeyboardLayout(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
this.attrs = attrs;
|
this.attrs = attrs;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setKeyBoard(int size,int width) {
|
public void setKeyBoard(int size,int width, int height) {
|
||||||
LayoutParams p ;
|
LayoutParams p ;
|
||||||
buttons = new SudokuButton[size];
|
buttons = new SudokuButton[size];
|
||||||
int number = 0;
|
int number = 0;
|
||||||
int torun = ((size)%2==0) ? (size)/2 :(size+1)/2 ;
|
int torun = ((size)%2==0) ? (size)/2 :(size+1)/2 ;
|
||||||
int realSize = torun;
|
int realSize = torun;
|
||||||
|
|
||||||
|
int width2 =(width-(realSize*30))/(realSize);
|
||||||
for (int k = 0; k<2;k++){
|
for (int k = 0; k<2;k++){
|
||||||
for (int i = 0; i< torun; i++){
|
for (int i = 0; i< torun; i++){
|
||||||
if (number == size) {
|
if (number == size) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
buttons[number] = new SudokuButton(getContext(),null);
|
buttons[number] = new SudokuButton(getContext(),null);
|
||||||
p = new LayoutParams(GridLayout.spec(k,1),GridLayout.spec(i, 1));
|
Spec rowSpec = spec(k,1);
|
||||||
p.setMargins(0,0,0,0);
|
Spec colSpec = spec(i,1);
|
||||||
int width2 =width/(realSize);
|
|
||||||
p.width= width2-15;
|
p = (new LayoutParams(rowSpec,colSpec));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//p = new LayoutParams(rowSpec,colSpec);
|
||||||
|
p.setMargins((i == 0)?0:5,5,5,5);
|
||||||
|
p.width= (width-(int)((getResources().getDimension(R.dimen.activity_horizontal_margin))*2))/realSize;
|
||||||
|
p.width= p.width-10;
|
||||||
|
p.setGravity(LayoutParams.WRAP_CONTENT);
|
||||||
|
|
||||||
|
|
||||||
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
|
// TODO settings: get SymbolEnum from settings
|
||||||
|
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);
|
||||||
buttons[number].setOnClickListener(listener);
|
buttons[number].setOnClickListener(listener);
|
||||||
|
@ -81,6 +94,7 @@ public class SudokuKeyboardLayout extends GridLayout {
|
||||||
|
|
||||||
public void setGameController(GameController gc){
|
public void setGameController(GameController gc){
|
||||||
gameController=gc;
|
gameController=gc;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void toggleNotesEnabled() {
|
public void toggleNotesEnabled() {
|
||||||
|
|
|
@ -81,14 +81,16 @@ public class SudokuSpecialButtonLayout extends LinearLayout {
|
||||||
for (SudokuButtonType t : SudokuButtonType.getSpecialButtons()){
|
for (SudokuButtonType t : SudokuButtonType.getSpecialButtons()){
|
||||||
fixedButtons[i] = new SudokuButton(getContext(),null);
|
fixedButtons[i] = new SudokuButton(getContext(),null);
|
||||||
p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT,1);
|
p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT,1);
|
||||||
p.setMargins(0,0,0,0);
|
p.setMargins(5,5,5,5);
|
||||||
int width2 =width/(fixedButtonsCount);
|
|
||||||
p.width= width2-15;
|
//int width2 =width/(fixedButtonsCount);
|
||||||
|
//p.width= width2-15;
|
||||||
fixedButtons[i].setLayoutParams(p);
|
fixedButtons[i].setLayoutParams(p);
|
||||||
fixedButtons[i].setGravity(Gravity.CENTER);
|
fixedButtons[i].setGravity(Gravity.CENTER);
|
||||||
fixedButtons[i].setType(t);
|
fixedButtons[i].setType(t);
|
||||||
fixedButtons[i].setText(SudokuButtonType.getName(t));
|
fixedButtons[i].setText(SudokuButtonType.getName(t));
|
||||||
fixedButtons[i].setOnClickListener(listener);
|
fixedButtons[i].setOnClickListener(listener);
|
||||||
|
fixedButtons[i].setBackgroundResource(R.drawable.numpad_highlighted_four);
|
||||||
addView(fixedButtons[i]);
|
addView(fixedButtons[i]);
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M15.41,16.09l-4.58,-4.59 4.58,-4.59L14,5.5l-6,6 6,6z"/>
|
||||||
|
</vector>
|
|
@ -0,0 +1,9 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M8.59,16.34l4.58,-4.59 -4.58,-4.59L10,5.75l6,6 -6,6z"/>
|
||||||
|
</vector>
|
6
app/src/main/res/drawable/delete_reset_button.xml
Normal file
6
app/src/main/res/drawable/delete_reset_button.xml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"
|
||||||
|
>
|
||||||
|
<gradient android:endColor="@color/middleblue" android:startColor="@color/middleblue" />
|
||||||
|
<corners android:radius="6dp" />
|
||||||
|
</shape>
|
9
app/src/main/res/drawable/hints_display.xml
Normal file
9
app/src/main/res/drawable/hints_display.xml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<gradient android:startColor="@color/transparent"
|
||||||
|
android:endColor="@color/transparent"
|
||||||
|
android:angle="270" />
|
||||||
|
<corners android:radius="3dp" />
|
||||||
|
<stroke android:width="10px" android:color="@color/colorPrimaryDark" />
|
||||||
|
</shape>
|
6
app/src/main/res/drawable/mnenomic_numpad_button.xml
Normal file
6
app/src/main/res/drawable/mnenomic_numpad_button.xml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"
|
||||||
|
>
|
||||||
|
<gradient android:endColor="@color/lightblue" android:startColor="@color/lightblue" />
|
||||||
|
<corners android:radius="6dp" />
|
||||||
|
</shape>
|
11
app/src/main/res/drawable/numpad_highlighted.xml
Normal file
11
app/src/main/res/drawable/numpad_highlighted.xml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<gradient
|
||||||
|
android:endColor="@color/lightblue"
|
||||||
|
android:startColor="@color/lightblue" />
|
||||||
|
<corners android:radius="6dp" />
|
||||||
|
<stroke
|
||||||
|
android:width="10px"
|
||||||
|
android:color="@color/colorPrimaryDark" />
|
||||||
|
</shape>
|
11
app/src/main/res/drawable/numpad_highlighted_four.xml
Normal file
11
app/src/main/res/drawable/numpad_highlighted_four.xml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<gradient
|
||||||
|
android:endColor="@color/lightblue"
|
||||||
|
android:startColor="@color/lightblue" />
|
||||||
|
<corners android:radius="6dp" />
|
||||||
|
<stroke
|
||||||
|
android:width="10px"
|
||||||
|
android:color="@color/black" />
|
||||||
|
</shape>
|
11
app/src/main/res/drawable/numpad_highlighted_three.xml
Normal file
11
app/src/main/res/drawable/numpad_highlighted_three.xml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<gradient
|
||||||
|
android:endColor="@color/lightblue"
|
||||||
|
android:startColor="@color/lightblue" />
|
||||||
|
<corners android:radius="6dp" />
|
||||||
|
<stroke
|
||||||
|
android:width="10px"
|
||||||
|
android:color="@color/yellow" />
|
||||||
|
</shape>
|
11
app/src/main/res/drawable/numpad_highlighted_two.xml
Normal file
11
app/src/main/res/drawable/numpad_highlighted_two.xml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<gradient
|
||||||
|
android:endColor="@color/lightblue"
|
||||||
|
android:startColor="@color/lightblue" />
|
||||||
|
<corners android:radius="6dp" />
|
||||||
|
<stroke
|
||||||
|
android:width="10px"
|
||||||
|
android:color="@color/middleblue" />
|
||||||
|
</shape>
|
|
@ -33,14 +33,30 @@
|
||||||
android:weightSum="10"
|
android:weightSum="10"
|
||||||
android:layout_marginTop="?attr/actionBarSize"
|
android:layout_marginTop="?attr/actionBarSize"
|
||||||
style="?android:buttonBarStyle">
|
style="?android:buttonBarStyle">
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="4">
|
||||||
<android.support.v4.view.ViewPager
|
<android.support.v4.view.ViewPager
|
||||||
android:id="@+id/scroller"
|
android:id="@+id/scroller"
|
||||||
android:layout_weight="4"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="match_parent"
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/ic_keyboard_arrow_left_black_24dp"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_centerVertical="true"/>
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/ic_keyboard_arrow_right_black_24dp"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_centerVertical="true"/>
|
||||||
|
</RelativeLayout>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -89,9 +105,11 @@
|
||||||
android:onClick="onClick"
|
android:onClick="onClick"
|
||||||
android:capitalize="none"
|
android:capitalize="none"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:elevation="10dp"/>
|
android:elevation="10dp"
|
||||||
|
android:background="@drawable/mnenomic_numpad_button"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_marginLeft="30dp"
|
android:layout_marginLeft="30dp"
|
||||||
|
@ -103,7 +121,8 @@
|
||||||
android:layout_weight="2"
|
android:layout_weight="2"
|
||||||
android:onClick="onClick"
|
android:onClick="onClick"
|
||||||
android:capitalize="none"
|
android:capitalize="none"
|
||||||
android:clickable="false"/>
|
android:clickable="false"
|
||||||
|
android:background="@drawable/mnenomic_numpad_button"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -16,8 +16,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:minHeight="200dp"
|
android:minHeight="200dp"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:gravity="center"/>
|
android:gravity="center" />
|
||||||
|
|
||||||
|
|
||||||
<tu_darmstadt.sudoku.ui.view.SudokuKeyboardLayout
|
<tu_darmstadt.sudoku.ui.view.SudokuKeyboardLayout
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
@ -25,7 +24,15 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/sudokuLayout"
|
android:layout_below="@+id/sudokuLayout"
|
||||||
android:id="@+id/sudokuKeyboardLayout"
|
android:id="@+id/sudokuKeyboardLayout"
|
||||||
android:layout_centerVertical="true">
|
android:layout_centerVertical="true"
|
||||||
|
android:useDefaultMargins="true"
|
||||||
|
android:alignmentMode="alignBounds"
|
||||||
|
android:columnOrderPreserved="false"
|
||||||
|
android:columnCount="6"
|
||||||
|
android:rowCount="2"
|
||||||
|
android:alwaysDrawnWithCache="true"
|
||||||
|
android:foregroundGravity="fill_horizontal"
|
||||||
|
android:layout_marginTop="5dp">
|
||||||
|
|
||||||
</tu_darmstadt.sudoku.ui.view.SudokuKeyboardLayout>
|
</tu_darmstadt.sudoku.ui.view.SudokuKeyboardLayout>
|
||||||
<tu_darmstadt.sudoku.ui.view.SudokuSpecialButtonLayout
|
<tu_darmstadt.sudoku.ui.view.SudokuSpecialButtonLayout
|
||||||
|
@ -36,5 +43,4 @@
|
||||||
|
|
||||||
</tu_darmstadt.sudoku.ui.view.SudokuSpecialButtonLayout>
|
</tu_darmstadt.sudoku.ui.view.SudokuSpecialButtonLayout>
|
||||||
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
|
@ -3,4 +3,11 @@
|
||||||
<color name="colorPrimary">#024265</color>
|
<color name="colorPrimary">#024265</color>
|
||||||
<color name="colorPrimaryDark">#024265</color>
|
<color name="colorPrimaryDark">#024265</color>
|
||||||
<color name="colorAccent">#AA0000</color>
|
<color name="colorAccent">#AA0000</color>
|
||||||
|
<color name="transparent">#00000000</color>
|
||||||
|
<color name="lightblue">#0274B2</color>
|
||||||
|
<color name="middleblue">#8aa5ce</color>
|
||||||
|
<color name="middlegrey">#A8A8A8</color>
|
||||||
|
<color name="yellow">#f6d126</color>
|
||||||
|
<color name="white">#ffffff</color>
|
||||||
|
<color name="black">#000000</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue