fixed some issues

This commit is contained in:
Gongxter 2016-02-18 14:46:39 +01:00
parent 763ea0b6e7
commit 4475d610b7
13 changed files with 119 additions and 33 deletions

View file

@ -67,11 +67,9 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/debug" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
@ -82,19 +80,15 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/mockable-android-23.jar" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" /> <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" /> <excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content> </content>

View file

@ -1,5 +1,6 @@
package org.secuso.privacyfriendlysudoku.ui; package org.secuso.privacyfriendlysudoku.ui;
import android.app.Dialog;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
@ -45,6 +46,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
RatingBar difficultyBar; RatingBar difficultyBar;
TextView difficultyText; TextView difficultyText;
SharedPreferences settings; SharedPreferences settings;
ImageView arrowLeft, arrowRight;
/** /**
* The {@link ViewPager} that will host the section contents. * The {@link ViewPager} that will host the section contents.
@ -88,7 +90,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
may be best to switch to a may be best to switch to a
{@link android.support.v4.app.FragmentStatePagerAdapter}. {@link android.support.v4.app.FragmentStatePagerAdapter}.
*/ */
SectionsPagerAdapter mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); final SectionsPagerAdapter mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
// Set up the ViewPager with the sections adapter. // Set up the ViewPager with the sections adapter.
@ -100,6 +102,31 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
String lastChosenGameType = settings.getString("lastChosenGameType", GameType.Default_9x9.name()); String lastChosenGameType = settings.getString("lastChosenGameType", GameType.Default_9x9.name());
int index = validGameTypes.indexOf(Enum.valueOf(GameType.class, lastChosenGameType)); int index = validGameTypes.indexOf(Enum.valueOf(GameType.class, lastChosenGameType));
mViewPager.setCurrentItem(index); mViewPager.setCurrentItem(index);
arrowLeft = (ImageView)findViewById(R.id.arrow_left);
arrowRight = (ImageView) findViewById(R.id.arrow_right);
//care for initial postiton of the ViewPager
arrowLeft.setVisibility((index==0)?View.INVISIBLE:View.VISIBLE);
arrowRight.setVisibility((index==mSectionsPagerAdapter.getCount()-1)?View.INVISIBLE:View.VISIBLE);
//Update ViewPager on change
mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
arrowLeft.setVisibility((position==0)?View.INVISIBLE:View.VISIBLE);
arrowRight.setVisibility((position==mSectionsPagerAdapter.getCount()-1)?View.INVISIBLE:View.VISIBLE);
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
// Set the difficulty Slider to whatever was chosen the last time // Set the difficulty Slider to whatever was chosen the last time
difficultyBar = (RatingBar)findViewById(R.id.difficultyBar); difficultyBar = (RatingBar)findViewById(R.id.difficultyBar);
@ -116,7 +143,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
difficultyText.setText(getString(difficultyList.get((int) ratingBar.getRating() - 1).getStringResID())); difficultyText.setText(getString(difficultyList.get((int) ratingBar.getRating() - 1).getStringResID()));
} }
}); });
GameDifficulty lastChosenDifficulty = GameDifficulty.valueOf(settings.getString("lastChosenDifficulty", "Easy")); GameDifficulty lastChosenDifficulty = GameDifficulty.valueOf(settings.getString("lastChosenDifficulty", "Moderate"));
difficultyBar.setRating(GameDifficulty.getValidDifficultyList().indexOf(lastChosenDifficulty) + 1); difficultyBar.setRating(GameDifficulty.getValidDifficultyList().indexOf(lastChosenDifficulty) + 1);
/*LayerDrawable stars = (LayerDrawable)difficultyBar.getProgressDrawable(); /*LayerDrawable stars = (LayerDrawable)difficultyBar.getProgressDrawable();
stars.getDrawable(2).setColorFilter(getResources().getColor(R.color.colorPrimary), PorterDuff.Mode.SRC_ATOP);//Color for Stars fully selected stars.getDrawable(2).setColorFilter(getResources().getColor(R.color.colorPrimary), PorterDuff.Mode.SRC_ATOP);//Color for Stars fully selected
@ -149,6 +176,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
} }
public void onClick(View view) { public void onClick(View view) {
Intent i = null; Intent i = null;
@ -280,6 +308,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
super(fm); super(fm);
} }
@Override @Override
public Fragment getItem(int position) { public Fragment getItem(int position) {
// getItem is called to instantiate the fragment for the given page. // getItem is called to instantiate the fragment for the given page.
@ -287,6 +316,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
return GameTypeFragment.newInstance(position); return GameTypeFragment.newInstance(position);
} }
@Override @Override
public int getCount() { public int getCount() {
// Show 3 total pages. // Show 3 total pages.
@ -294,6 +325,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
} }
} }
/** /**
* A placeholder fragment containing a simple view. * A placeholder fragment containing a simple view.
*/ */
@ -302,6 +334,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
* The fragment argument representing the section number for this * The fragment argument representing the section number for this
* fragment. * fragment.
*/ */
private static final String ARG_SECTION_NUMBER = "section_number"; private static final String ARG_SECTION_NUMBER = "section_number";
/** /**
@ -317,8 +351,10 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
} }
public GameTypeFragment() { public GameTypeFragment() {
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {

View file

@ -94,7 +94,7 @@ public class SudokuCellView extends View {
p.setColor(Color.WHITE); p.setColor(Color.WHITE);
break; break;
case Error: case Error:
p.setColor(Color.RED); p.setColor(Color.LTGRAY);
break; break;
case Selected: case Selected:
p.setColor(Color.GREEN); p.setColor(Color.GREEN);

View file

@ -211,22 +211,29 @@ public class SudokuFieldLayout extends RelativeLayout implements IHighlightChang
p.setStrokeWidth(4); p.setStrokeWidth(4);
p.setColor(Color.RED); p.setColor(Color.RED);
float offset1=0;
float offset2= 0;
int row;
int col;
int row2;
int col2;
float radius;
for(CellConflict conflict : gameController.getErrorList()) { for(CellConflict conflict : gameController.getErrorList()) {
//gamecells[conflict.getRowCell1()][conflict.getColCell1()]. //gamecells[conflict.getRowCell1()][conflict.getColCell1()].
int row = conflict.getRowCell1(); row = conflict.getRowCell1();
int col = conflict.getColCell1(); col = conflict.getColCell1();
canvas.drawCircle(gameCellWidth * col + gameCellWidth / 2, gameCellHeight * row + gameCellHeight / 2, gameCellWidth/2 - gameCellWidth / 8, p); radius = gameCellWidth/2 - gameCellWidth / 8;
canvas.drawCircle(gameCellWidth * col + gameCellWidth / 2, gameCellHeight * row + gameCellHeight / 2, radius, p);
row2 = conflict.getRowCell2();
col2 = conflict.getColCell2();
canvas.drawCircle(gameCellWidth * col2 + gameCellWidth / 2, gameCellHeight * row2 + gameCellHeight / 2, radius, p);
int row2 = conflict.getRowCell2();
int col2 = conflict.getColCell2();
canvas.drawCircle(gameCellWidth * col2 + gameCellWidth / 2, gameCellHeight * row2 + gameCellHeight / 2, gameCellWidth / 2 - gameCellWidth / 8, p);
float offset1=0;
float offset2= 0;
float radius = gameCellWidth/2 - gameCellWidth / 8;
if (col == col2 || row == row2) { if (col == col2 || row == row2) {
offset1 = (col > col2)? 0-radius:radius; offset1 = (col > col2)? 0-radius:radius;
offset2 = (row > row2)? 0-radius:radius; offset2 = (row > row2)? 0-radius:radius;

View file

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<bitmap
android:src="@drawable/ic_star_black_48dp"
android:tint="@color/middlegrey" />
</item>
<item android:id="@android:id/secondaryProgress">
<bitmap
android:src="@drawable/ic_star_half_black_48dp"
android:tint="@color/middlegrey" />
</item>
<item android:id="@android:id/progress">
<bitmap
android:src="@drawable/ic_star_black_48dp"
android:tint="@color/colorAccent" />
</item>
</layer-list>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -17,8 +17,7 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background"> <item android:id="@android:id/background">
<bitmap <bitmap
android:src="@drawable/ic_star_black_48dp" android:src="@drawable/ic_star_grey_48dp"/>
android:tint="@color/middlegrey" />
</item> </item>
<item android:id="@android:id/secondaryProgress"> <item android:id="@android:id/secondaryProgress">
<bitmap <bitmap
@ -27,8 +26,7 @@
</item> </item>
<item android:id="@android:id/progress"> <item android:id="@android:id/progress">
<bitmap <bitmap
android:src="@drawable/ic_star_black_48dp" android:src="@drawable/ic_star_blue_48dp" />
android:tint="@color/colorAccent" />
</item> </item>
</layer-list> </layer-list>

View file

@ -147,12 +147,12 @@
android:clickable="false" android:clickable="false"
android:background="@drawable/standalone_button"/> android:background="@drawable/standalone_button"/>
<Button <!-- <Button
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Win Debug" android:text="coachMark"
android:visibility="invisible" android:visibility="visible"
android:onClick="callFragment"/> android:onClick="coachMark"/> -->
<!-- <!--
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -6,12 +6,13 @@
android:layout_gravity="center"> android:layout_gravity="center">
<LinearLayout <LinearLayout
android:layout_width="250dp" android:layout_height="250dp" android:layout_width="275sp" android:layout_height="275sp"
android:background="@drawable/ic_trophy_black_48dp"
android:weightSum="5" android:weightSum="5"
android:background="@drawable/ic_trophy_black_48dp"
android:orientation="horizontal" android:orientation="horizontal"
android:layout_gravity="center"> android:layout_gravity="center">
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="fill_parent" android:layout_height="fill_parent"
@ -50,7 +51,9 @@
android:layout_weight="4" android:layout_weight="4"
android:layout_marginTop="46dp" android:layout_marginTop="46dp"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:orientation="vertical"> android:orientation="vertical"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -24,7 +24,7 @@
<string name="help_notes">Remarques</string> <string name="help_notes">Remarques</string>
<string name="help_notes_summary">Change si les numeros se montre étant des valeurs ou des remarques sur le champs</string> <string name="help_notes_summary">Change si les numeros se montre étant des valeurs ou des remarques sur le champs</string>
<string name="help_permissions">Droits</string> <string name="help_permissions">Droits</string>
<string name="help_permissions_summary">Privacy Friendly Sudonku n\'utilise pas d\'autorisations.</string> <string name="help_permissions_summary">Privacy Friendly Sudoku n\'utilise pas d\'autorisations.</string>
<string name="help_privacyInfo">Information de confidentialité</string> <string name="help_privacyInfo">Information de confidentialité</string>
<string name="help_undo">Défaire</string> <string name="help_undo">Défaire</string>
<string name="help_undo_summary">Défais la dernière action</string> <string name="help_undo_summary">Défais la dernière action</string>

View file

@ -110,7 +110,7 @@
<string name="header_help">Help</string> <string name="header_help">Help</string>
<string name="help_keyboard">Keyboard</string> <string name="help_keyboard">Keyboard</string>
<string name="help_gamefield">Game field</string> <string name="help_gamefield">Game field</string>
<string name="help_keyhighlighted_summary">Indicates that the value is selected and will be set in every clicked field</string> <string name="help_keyhighlighted_summary">Indicates that the value with the border is selected and will be set in every clicked cell</string>
<string name="help_keyhighlighted_yellow_summary">Indicates that the correct number of values for this number have been placed.</string> <string name="help_keyhighlighted_yellow_summary">Indicates that the correct number of values for this number have been placed.</string>
<!-- ### Special buttons description ###--> <!-- ### Special buttons description ###-->
@ -123,8 +123,8 @@
<string name="help_delete">Delete button</string> <string name="help_delete">Delete button</string>
<string name="help_delete_summary">Deletes a selected field</string> <string name="help_delete_summary">Deletes a selected field</string>
<string name="help_notes">Note toggle button</string> <string name="help_notes">Note toggle button</string>
<string name="help_notes_summary">toggles if numbers should be set as notes or as values in a field</string> <string name="help_notes_summary">Toggles if numbers should be set as notes or as values in a field</string>
<string name="help_privacyInfo">Privacy Info</string> <string name="help_privacyInfo">Privacy Info</string>
<string name="help_permissions">Permissions</string> <string name="help_permissions">Permissions</string>
<string name="help_permissions_summary">Privacy Friendly Sudonku does not use any permissions.</string> <string name="help_permissions_summary">Privacy Friendly Sudoku does not use any permissions.</string>
</resources> </resources>

View file

@ -29,6 +29,20 @@
<item name="android:windowSoftInputMode">adjustPan|stateUnspecified</item> <item name="android:windowSoftInputMode">adjustPan|stateUnspecified</item>
</style> </style>
<style name="CoachMark">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@color/transparent</item>
<item name="android:layout_height">fill_parent</item>
<item name="android:layout_width">fill_parent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">false</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
<item name="android:windowSoftInputMode">adjustPan|stateUnspecified</item>
</style>
<style name="RatingBarStyle" parent="@android:style/Widget.RatingBar"> <style name="RatingBarStyle" parent="@android:style/Widget.RatingBar">
<item name="android:progressDrawable">@drawable/ratingbar</item> <item name="android:progressDrawable">@drawable/ratingbar</item>