diff --git a/app/build.gradle b/app/build.gradle
index dbf911e..a96291f 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -7,8 +7,8 @@ android {
applicationId "org.secuso.privacyfriendlydicer"
minSdkVersion 16
targetSdkVersion 28
- versionCode 6
- versionName "1.4.1"
+ versionCode 7
+ versionName "1.5.0"
}
buildTypes {
@@ -28,4 +28,5 @@ dependencies {
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
+ implementation 'com.android.support.constraint:constraint-layout:1.1.3'
}
diff --git a/app/src/main/java/org/secuso/privacyfriendlydicer/MainActivity.java b/app/src/main/java/org/secuso/privacyfriendlydicer/MainActivity.java
index c6b1e18..124b1f4 100644
--- a/app/src/main/java/org/secuso/privacyfriendlydicer/MainActivity.java
+++ b/app/src/main/java/org/secuso/privacyfriendlydicer/MainActivity.java
@@ -5,6 +5,7 @@
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
+import android.graphics.Point;
import android.hardware.Sensor;
import android.hardware.SensorManager;
import android.os.Bundle;
@@ -26,20 +27,20 @@
import android.widget.SeekBar;
import android.widget.TextView;
-public class MainActivity extends AppCompatActivity
- implements NavigationView.OnNavigationItemSelectedListener {
+public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
+
+ private static Dicer dicer = new Dicer();
private ImageView[] imageViews;
- boolean shakingEnabled;
- boolean vibrationEnabled;
- SharedPreferences sharedPreferences;
+ private boolean shakingEnabled;
+ private boolean vibrationEnabled;
+ private SharedPreferences sharedPreferences;
// for Shaking
private SensorManager sensorManager;
private Sensor accelerometer;
private ShakeListener shakeListener;
-
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -120,6 +121,7 @@ public void onShake(int count) {
});
displaySum(new int[]{0});
+ initResultDiceViews();
}
public void flashResult(ImageView imageView) {
@@ -152,7 +154,6 @@ public void initResultDiceViews() {
}
public void switchDice(ImageView imageView, int result) {
-
switch (result) {
case 1:
imageView.setImageResource(R.drawable.d1);
@@ -203,27 +204,22 @@ public void evaluate(Vibrator vibrator, int diceNumber, int faceNumber) {
applySettings();
- Dicer dicer = new Dicer();
int[] dice = dicer.rollDice(diceNumber, faceNumber);
+
displaySum(dice);
initResultDiceViews();
+ showDice(dice);
- Display display = getWindowManager().getDefaultDisplay();
+ if (vibrationEnabled) {
+ vibrator.vibrate(50);
+ }
+ }
+ private void showDice(int[] dice) {
for (int i = 0; i < dice.length; i++) {
switchDice(imageViews[i], dice[i]);
- android.view.ViewGroup.LayoutParams layoutParams = imageViews[i].getLayoutParams();
- layoutParams.width = display.getWidth() / 6;
- layoutParams.height = display.getWidth() / 6;
-
- imageViews[i].setLayoutParams(layoutParams);
flashResult(imageViews[i]);
- if (vibrationEnabled) {
- vibrator.vibrate(50);
- }
-
}
-
}
private void displaySum(int[] dice) {
diff --git a/app/src/main/res/drawable/ic_launcher_foreground_shadow.xml b/app/src/main/res/drawable/ic_launcher_foreground_shadow.xml
new file mode 100644
index 0000000..a44d4d2
--- /dev/null
+++ b/app/src/main/res/drawable/ic_launcher_foreground_shadow.xml
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout-land/content_main.xml b/app/src/main/res/layout-land/content_main.xml
new file mode 100644
index 0000000..531ec97
--- /dev/null
+++ b/app/src/main/res/layout-land/content_main.xml
@@ -0,0 +1,278 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/content_main.xml b/app/src/main/res/layout/content_main.xml
index 77d797f..689ca75 100644
--- a/app/src/main/res/layout/content_main.xml
+++ b/app/src/main/res/layout/content_main.xml
@@ -1,190 +1,263 @@
-
+ android:textSize="18sp"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+ android:layout_marginStart="8dp"
+ android:textSize="18sp"
+ app:layout_constraintBaseline_toBaselineOf="@id/chooseDiceHeading"
+ app:layout_constraintStart_toEndOf="@id/chooseDiceHeading"
+ android:layout_marginLeft="8dp" />
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/chooseDiceHeading" />
+ android:textSize="18sp"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/seekBar" />
+ android:layout_marginStart="8dp"
+ android:textSize="18sp"
+ app:layout_constraintBaseline_toBaselineOf="@id/chooseFacesHeading"
+ app:layout_constraintStart_toEndOf="@id/chooseFacesHeading"
+ android:layout_marginLeft="8dp" />
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/chooseFaceNumber" />
+ android:textSize="20sp"
+ android:layout_marginTop="16dp"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/seekBarFace" />
+ android:layout_height="wrap_content"
+ android:layout_below="@id/rollButton"
+ android:layout_centerHorizontal="true"
+ android:layout_marginTop="16dp"
+ android:layout_marginBottom="16dp"
+ android:text="@string/main_dice_sum"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/rollButton" />
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_below="@+id/rollButton"
+ android:layout_marginLeft="4dp"
+ android:layout_marginTop="8dp"
+ android:layout_marginRight="4dp"
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintEnd_toStartOf="@+id/resultTwo"
+ app:layout_constraintHorizontal_bias="0.5"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/sumTextView"
+ app:srcCompat="@drawable/d1" />
+ android:layout_marginLeft="4dp"
+ android:layout_marginTop="8dp"
+ android:layout_marginRight="4dp"
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintEnd_toStartOf="@+id/resultThree"
+ app:layout_constraintHorizontal_bias="0.5"
+ app:layout_constraintStart_toEndOf="@+id/resultOne"
+ app:layout_constraintTop_toBottomOf="@id/sumTextView"
+ app:srcCompat="@drawable/d1" />
+ android:layout_marginLeft="4dp"
+ android:layout_marginTop="8dp"
+ android:layout_marginRight="4dp"
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintEnd_toStartOf="@+id/resultFour"
+ app:layout_constraintHorizontal_bias="0.5"
+ app:layout_constraintStart_toEndOf="@+id/resultTwo"
+ app:layout_constraintTop_toBottomOf="@id/sumTextView"
+ app:srcCompat="@drawable/d1" />
+ android:layout_marginLeft="4dp"
+ android:layout_marginTop="8dp"
+ android:layout_marginRight="4dp"
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintEnd_toStartOf="@+id/resultFive"
+ app:layout_constraintHorizontal_bias="0.5"
+ app:layout_constraintStart_toEndOf="@+id/resultThree"
+ app:layout_constraintTop_toBottomOf="@id/sumTextView"
+ app:srcCompat="@drawable/d1" />
+ android:layout_marginLeft="4dp"
+ android:layout_marginTop="8dp"
+ android:layout_marginRight="4dp"
+ android:scaleType="fitXY"
+ android:visibility="visible"
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.5"
+ app:layout_constraintStart_toEndOf="@+id/resultFour"
+ app:layout_constraintTop_toBottomOf="@id/sumTextView"
+ app:srcCompat="@drawable/d1" />
+ android:id="@+id/resultSix"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_marginLeft="4dp"
+ android:layout_marginTop="8dp"
+ android:layout_marginRight="4dp"
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintEnd_toStartOf="@+id/resultSeven"
+ app:layout_constraintHorizontal_bias="0.5"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/resultOne"
+ app:srcCompat="@drawable/d1" />
+ android:id="@+id/resultSeven"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_marginLeft="4dp"
+ android:layout_marginTop="8dp"
+ android:layout_marginRight="4dp"
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintEnd_toStartOf="@+id/resultEight"
+ app:layout_constraintHorizontal_bias="0.5"
+ app:layout_constraintStart_toEndOf="@+id/resultSix"
+ app:layout_constraintTop_toBottomOf="@id/resultOne"
+ app:srcCompat="@drawable/d1" />
+ android:id="@+id/resultEight"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_marginLeft="4dp"
+ android:layout_marginTop="8dp"
+ android:layout_marginRight="4dp"
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintEnd_toStartOf="@+id/resultNine"
+ app:layout_constraintHorizontal_bias="0.5"
+ app:layout_constraintStart_toEndOf="@+id/resultSeven"
+ app:layout_constraintTop_toBottomOf="@id/resultOne"
+ app:srcCompat="@drawable/d1" />
+ android:id="@+id/resultNine"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_marginLeft="4dp"
+ android:layout_marginTop="8dp"
+ android:layout_marginRight="4dp"
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintEnd_toStartOf="@+id/resultTen"
+ app:layout_constraintHorizontal_bias="0.5"
+ app:layout_constraintStart_toEndOf="@+id/resultEight"
+ app:layout_constraintTop_toBottomOf="@id/resultOne"
+ app:srcCompat="@drawable/d1" />
+ android:id="@+id/resultTen"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_marginLeft="4dp"
+ android:layout_marginTop="8dp"
+ android:layout_marginRight="4dp"
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.5"
+ app:layout_constraintStart_toEndOf="@+id/resultNine"
+ app:layout_constraintTop_toBottomOf="@id/resultOne"
+ app:srcCompat="@drawable/d1" />
-
+
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 0000000..6a4bb23
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..a1b6327
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-hdpi/launcher_icon_dicer.png b/app/src/main/res/mipmap-hdpi/launcher_icon_dicer.png
deleted file mode 100644
index 733b5a4..0000000
Binary files a/app/src/main/res/mipmap-hdpi/launcher_icon_dicer.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..a26cde3
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/launcher_icon_dicer.png b/app/src/main/res/mipmap-mdpi/launcher_icon_dicer.png
deleted file mode 100644
index 18afff1..0000000
Binary files a/app/src/main/res/mipmap-mdpi/launcher_icon_dicer.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..a1a0516
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/launcher_icon_dicer.png b/app/src/main/res/mipmap-xhdpi/launcher_icon_dicer.png
deleted file mode 100644
index bb21d10..0000000
Binary files a/app/src/main/res/mipmap-xhdpi/launcher_icon_dicer.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..89df495
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/launcher_icon_dicer.png b/app/src/main/res/mipmap-xxhdpi/launcher_icon_dicer.png
deleted file mode 100644
index dd014a7..0000000
Binary files a/app/src/main/res/mipmap-xxhdpi/launcher_icon_dicer.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..a60700e
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/launcher_icon_dicer.png b/app/src/main/res/mipmap-xxxhdpi/launcher_icon_dicer.png
deleted file mode 100644
index 2dcf6e3..0000000
Binary files a/app/src/main/res/mipmap-xxxhdpi/launcher_icon_dicer.png and /dev/null differ
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 9454479..d8c7227 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -6,4 +6,6 @@
#00000000
#A8A8A8
#ffffff
+
+ #3680BB
diff --git a/fastlane/metadata/android/de-DE/images/icon.png b/fastlane/metadata/android/de-DE/images/icon.png
index 867bb3d..34dba78 100644
Binary files a/fastlane/metadata/android/de-DE/images/icon.png and b/fastlane/metadata/android/de-DE/images/icon.png differ
diff --git a/fastlane/metadata/android/en-US/images/icon.png b/fastlane/metadata/android/en-US/images/icon.png
index 867bb3d..34dba78 100644
Binary files a/fastlane/metadata/android/en-US/images/icon.png and b/fastlane/metadata/android/en-US/images/icon.png differ