parent
838c5c8675
commit
7cc9c8538c
6 changed files with 111 additions and 20 deletions
|
@ -29,6 +29,7 @@ public class SudokuCellView extends View {
|
|||
boolean selected;
|
||||
CellHighlightTypes highlightType = CellHighlightTypes.Default;
|
||||
Symbol symbolsToUse = Symbol.Default;
|
||||
RelativeLayout.LayoutParams params;
|
||||
|
||||
|
||||
public SudokuCellView(Context context) {
|
||||
|
@ -77,8 +78,13 @@ public class SudokuCellView extends View {
|
|||
public void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
|
||||
if(this.params == null) {
|
||||
params = new RelativeLayout.LayoutParams(mWidth, mHeight);
|
||||
}
|
||||
|
||||
// Set Layout
|
||||
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(mWidth, mHeight);
|
||||
params.width = mWidth;
|
||||
params.height = mHeight;
|
||||
params.topMargin = mRow*mHeight;
|
||||
params.leftMargin = mCol*mWidth;
|
||||
this.setLayoutParams(params);
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.content.SharedPreferences;
|
|||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
@ -50,6 +51,7 @@ public class SudokuFieldLayout extends RelativeLayout implements IHighlightChang
|
|||
|
||||
public SudokuCellView [][] gamecells;
|
||||
AttributeSet attrs;
|
||||
private boolean isWidthLimiting;
|
||||
|
||||
public SudokuFieldLayout(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
@ -89,7 +91,6 @@ public class SudokuFieldLayout extends RelativeLayout implements IHighlightChang
|
|||
gamecells[i][j].setOnTouchListener(null);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -99,19 +100,26 @@ public class SudokuFieldLayout extends RelativeLayout implements IHighlightChang
|
|||
if(gameController == null) return;
|
||||
|
||||
p.setColor(Color.BLACK);
|
||||
p.setStrokeWidth(2);
|
||||
p.setStrokeWidth(5);
|
||||
|
||||
int horizontalSections = gameController.getSize() / sectionWidth;
|
||||
for(int i = 0; i <= horizontalSections; i++) {
|
||||
for(int j = -2; j < 2; j++) {
|
||||
canvas.drawLine((i * getWidth() / horizontalSections) + j, 0, (i * getWidth() / horizontalSections) + j, getHeight(), p);
|
||||
int offset = 0;
|
||||
if(!isWidthLimiting) {
|
||||
offset = (-2 + Math.round(i * 4f / (float)horizontalSections)) * -1;
|
||||
}
|
||||
int w = (i * getWidth() / horizontalSections) + offset;
|
||||
canvas.drawLine(w, 0, w, getHeight(), p);
|
||||
}
|
||||
|
||||
int verticalSections = (gameController.getSize()/sectionHeight);
|
||||
for(int i = 0; i <= verticalSections; i++) {
|
||||
for(int j = -2; j < 2; j++) {
|
||||
canvas.drawLine(0, (i * getHeight() / verticalSections) + j, getHeight(), (i * getHeight() / verticalSections) + j, p);
|
||||
int offset = 0;
|
||||
if(isWidthLimiting) {
|
||||
offset = (-2 + Math.round(i * 4f / (float)verticalSections)) * -1;
|
||||
}
|
||||
int h = (i * getHeight() / verticalSections) + offset;
|
||||
canvas.drawLine(0, h, getWidth(), h, p);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,6 +135,8 @@ public class SudokuFieldLayout extends RelativeLayout implements IHighlightChang
|
|||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||
super.onLayout(changed,l,t,r,b);
|
||||
|
||||
isWidthLimiting = r-l == Math.min(r-l, b-t);
|
||||
|
||||
if(changed && gameController != null) {
|
||||
gameCellWidth = (Math.min(r-l, b-t)) / gameController.getSize();
|
||||
gameCellHeight = (Math.min(r-l, b-t)) / gameController.getSize();
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:paddingEnd="50dp"
|
||||
android:paddingStart="50dp"
|
||||
android:src="@drawable/privacyfriendlyappslogo" />
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -42,14 +44,33 @@
|
|||
android:layout_marginTop="15dp"
|
||||
android:text="@string/app_name_long" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textFieldVersion"
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="center">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textFieldVersion"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/version_number" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textFieldVersionName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_toRightOf="@+id/textFieldVersion"
|
||||
android:layout_toEndOf="@+id/textFieldVersion" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textFieldAuthor"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -86,6 +107,8 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:paddingEnd="50dp"
|
||||
android:paddingStart="50dp"
|
||||
android:src="@drawable/secuso_logo_blau_blau" />
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.36">
|
||||
|
||||
<ImageView
|
||||
|
@ -30,6 +30,8 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:paddingEnd="100dp"
|
||||
android:paddingStart="100dp"
|
||||
android:src="@drawable/privacyfriendlyappslogo" />
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -42,14 +44,33 @@
|
|||
android:layout_marginTop="15dp"
|
||||
android:text="@string/app_name_long" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textFieldVersion"
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="center">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textFieldVersion"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/version_number" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textFieldVersionName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_toRightOf="@+id/textFieldVersion"
|
||||
android:layout_toEndOf="@+id/textFieldVersion" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textFieldAuthor"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -86,6 +107,8 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:paddingEnd="200dp"
|
||||
android:paddingStart="200dp"
|
||||
android:src="@drawable/secuso_logo_blau_blau" />
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
android:id="@+id/barcodeLogo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:layout_marginStart="100dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/privacyfriendlyappslogo" />
|
||||
|
||||
|
@ -42,14 +45,33 @@
|
|||
android:layout_marginTop="15dp"
|
||||
android:text="@string/app_name_long" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textFieldVersion"
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="center">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textFieldVersion"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/version_number" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textFieldVersionName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_toRightOf="@+id/textFieldVersion"
|
||||
android:layout_toEndOf="@+id/textFieldVersion" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textFieldAuthor"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -85,6 +107,8 @@
|
|||
android:id="@+id/imageView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:layout_marginStart="100dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/secuso_logo_blau_blau" />
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:openDrawer="start">
|
||||
android:fitsSystemWindows="true">
|
||||
<!-- tools:openDrawer="start" -->
|
||||
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
@ -20,17 +20,20 @@
|
|||
<android.support.design.widget.AppBarLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:clipChildren="false"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<android.support.v7.widget.Toolbar android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:clipChildren="false"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay" >
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:weightSum="14"
|
||||
android:clipChildren="false"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginLeft="@dimen/activity_horizontal_margin"
|
||||
android:layout_marginRight="@dimen/activity_horizontal_margin"
|
||||
|
@ -44,6 +47,7 @@
|
|||
<RelativeLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="5"
|
||||
android:clipChildren="false"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -55,10 +59,11 @@
|
|||
<RatingBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:numStars="3"
|
||||
android:numStars="4"
|
||||
android:clickable="false"
|
||||
android:id="@+id/gameModeStar"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_below="@+id/difficultyText"
|
||||
style="?android:attr/ratingBarStyleSmall"/>
|
||||
</RelativeLayout>
|
||||
|
|
Loading…
Reference in a new issue