~hokiegeek/qwingo-roller

b8d026134b4b20083312fe4ad3a6cd74c25e941e — HokieGeek 6 months ago 09584e5
got the basic die colors and initial faces in
33 files changed, 66 insertions(+), 196 deletions(-)

M app/build.gradle
A app/src/main/ic_launcher-playstore.png
M app/src/main/java/net/hokiegeek/qwingoroller/MainActivity.kt
A app/src/main/res/drawable/banana.png
A app/src/main/res/drawable/cone.png
A app/src/main/res/drawable/cup.png
D app/src/main/res/drawable/ic_launcher_background.xml
A app/src/main/res/drawable/lightning.png
A app/src/main/res/drawable/tomato.png
A app/src/main/res/drawable/watermelon.png
M app/src/main/res/layout/activity_main.xml
M app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
M app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
D app/src/main/res/mipmap-hdpi/ic_launcher.png
A app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
D app/src/main/res/mipmap-hdpi/ic_launcher_round.png
D app/src/main/res/mipmap-mdpi/ic_launcher.png
A app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
D app/src/main/res/mipmap-mdpi/ic_launcher_round.png
D app/src/main/res/mipmap-xhdpi/ic_launcher.png
A app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
D app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
D app/src/main/res/mipmap-xxhdpi/ic_launcher.png
A app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
D app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
D app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
A app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
D app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
M app/src/main/res/values-night/themes.xml
M app/src/main/res/values/colors.xml
A app/src/main/res/values/ic_launcher_background.xml
M app/src/main/res/values/themes.xml
A qwingo-logo.kra
M app/build.gradle => app/build.gradle +3 -0
@@ 41,4 41,7 @@ dependencies {
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

    implementation 'com.github.bumptech.glide:glide:4.12.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
}
\ No newline at end of file

A app/src/main/ic_launcher-playstore.png => app/src/main/ic_launcher-playstore.png +0 -0
M app/src/main/java/net/hokiegeek/qwingoroller/MainActivity.kt => app/src/main/java/net/hokiegeek/qwingoroller/MainActivity.kt +32 -8
@@ 7,19 7,21 @@ import android.hardware.SensorEventListener
import android.hardware.SensorManager
import android.os.Bundle
import android.util.Log
import android.widget.ImageView
import androidx.appcompat.app.AppCompatActivity
import androidx.constraintlayout.widget.ConstraintLayout
import kotlin.math.sqrt
import kotlin.random.Random

class MainActivity : AppCompatActivity() {
    companion object {
     /*
     * The gForce that is necessary to register as shake.
     * Must be greater than 1G (one earth gravity unit).
     * You can install "G-Force", by Blake La Pierre
     * from the Google Play Store and run it to see how
     *  many G's it takes to register a shake
     */
    /*
    * The gForce that is necessary to register as shake.
    * Must be greater than 1G (one earth gravity unit).
    * You can install "G-Force", by Blake La Pierre
    * from the Google Play Store and run it to see how
    *  many G's it takes to register a shake
    */
        private const val SHAKE_THRESHOLD_GRAVITY = 2.7f
        private const val SHAKE_SLOP_TIME_MS = 500
        // private const val SHAKE_COUNT_RESET_TIME_MS = 3000


@@ 29,6 31,16 @@ class MainActivity : AppCompatActivity() {

    private var mSensorMgr: SensorManager? = null

    // blue coffee cup
    // green watermelon
    // pink tomato
    // purple ice cream cone
    // yellow banana
    // silver (on black) lighting

    private val dieColors = arrayOf(R.color.die_green, R.color.die_blue, R.color.die_pink, R.color.die_purple, R.color.die_yellow, R.color.black)
    private val dieFaces = arrayOf(R.drawable.watermelon, R.drawable.cup, R.drawable.tomato, R.drawable.cone, R.drawable.banana, R.drawable.lightning)

    private val mSensorListener = object : SensorEventListener {
        private var mShakeTimestamp: Long = 0
        // private var mShakeCount = 0


@@ 71,6 83,8 @@ class MainActivity : AppCompatActivity() {
        }

        mSensorMgr = getSystemService(Context.SENSOR_SERVICE) as SensorManager?

        roll() // initialize the view
    }

    override fun onResume() {


@@ 84,6 98,16 @@ class MainActivity : AppCompatActivity() {
    }

    private fun roll() {
        Log.d(logTag, "TODO: roll!")
        Log.d(logTag, "roll!")

        val selection = Random.nextInt(dieFaces.size)
        findViewById<ImageView>(R.id.dieFace).setImageResource(dieFaces[selection]);
        findViewById<ConstraintLayout>(R.id.layout).setBackgroundResource(dieColors[selection])
    }

    /*
    (new Handler()).postDelayed(this::yourMethod, 5000);

    Glide.with(this).load(R.raw.hamster).into(findViewById<ImageView>(R.id.loading));
     */
}

A app/src/main/res/drawable/banana.png => app/src/main/res/drawable/banana.png +0 -0
A app/src/main/res/drawable/cone.png => app/src/main/res/drawable/cone.png +0 -0
A app/src/main/res/drawable/cup.png => app/src/main/res/drawable/cup.png +0 -0
D app/src/main/res/drawable/ic_launcher_background.xml => app/src/main/res/drawable/ic_launcher_background.xml +0 -170
@@ 1,170 0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="108dp"
    android:height="108dp"
    android:viewportHeight="108"
    android:viewportWidth="108">
    <path
        android:fillColor="#3DDC84"
        android:pathData="M0,0h108v108h-108z" />
    <path
        android:fillColor="#00000000"
        android:pathData="M9,0L9,108"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M19,0L19,108"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M29,0L29,108"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M39,0L39,108"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M49,0L49,108"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M59,0L59,108"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M69,0L69,108"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M79,0L79,108"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M89,0L89,108"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M99,0L99,108"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M0,9L108,9"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M0,19L108,19"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M0,29L108,29"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M0,39L108,39"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M0,49L108,49"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M0,59L108,59"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M0,69L108,69"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M0,79L108,79"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M0,89L108,89"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M0,99L108,99"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M19,29L89,29"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M19,39L89,39"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M19,49L89,49"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M19,59L89,59"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M19,69L89,69"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M19,79L89,79"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M29,19L29,89"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M39,19L39,89"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M49,19L49,89"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M59,19L59,89"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M69,19L69,89"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
    <path
        android:fillColor="#00000000"
        android:pathData="M79,19L79,89"
        android:strokeColor="#33FFFFFF"
        android:strokeWidth="0.8" />
</vector>

A app/src/main/res/drawable/lightning.png => app/src/main/res/drawable/lightning.png +0 -0
A app/src/main/res/drawable/tomato.png => app/src/main/res/drawable/tomato.png +0 -0
A app/src/main/res/drawable/watermelon.png => app/src/main/res/drawable/watermelon.png +0 -0
M app/src/main/res/layout/activity_main.xml => app/src/main/res/layout/activity_main.xml +5 -1
@@ 13,9 13,13 @@
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:contentDescription="@string/dieFaceDescription"
        android:paddingBottom="20dp"
        android:paddingLeft="20dp"
        android:paddingRight="20dp"
        android:paddingTop="20dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:srcCompat="@android:drawable/ic_dialog_alert" />
        app:srcCompat="@android:drawable/ic_menu_help" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file

M app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml => app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +2 -2
@@ 1,5 1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@drawable/ic_launcher_background" />
    <foreground android:drawable="@drawable/ic_launcher_foreground" />
    <background android:drawable="@color/ic_launcher_background"/>
    <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
\ No newline at end of file

M app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml => app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +2 -2
@@ 1,5 1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@drawable/ic_launcher_background" />
    <foreground android:drawable="@drawable/ic_launcher_foreground" />
    <background android:drawable="@color/ic_launcher_background"/>
    <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
\ No newline at end of file

D app/src/main/res/mipmap-hdpi/ic_launcher.png => app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
A app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png => app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png +0 -0
D app/src/main/res/mipmap-hdpi/ic_launcher_round.png => app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
D app/src/main/res/mipmap-mdpi/ic_launcher.png => app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
A app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png => app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png +0 -0
D app/src/main/res/mipmap-mdpi/ic_launcher_round.png => app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
D app/src/main/res/mipmap-xhdpi/ic_launcher.png => app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
A app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png => app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png +0 -0
D app/src/main/res/mipmap-xhdpi/ic_launcher_round.png => app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
D app/src/main/res/mipmap-xxhdpi/ic_launcher.png => app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
A app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png => app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png +0 -0
D app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png => app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
D app/src/main/res/mipmap-xxxhdpi/ic_launcher.png => app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
A app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png => app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png +0 -0
D app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png => app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
M app/src/main/res/values-night/themes.xml => app/src/main/res/values-night/themes.xml +4 -4
@@ 2,12 2,12 @@
    <!-- Base application theme. -->
    <style name="Theme.QwingoRoller" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
        <!-- Primary brand color. -->
        <item name="colorPrimary">@color/purple_200</item>
        <item name="colorPrimaryVariant">@color/purple_700</item>
        <item name="colorPrimary">@color/primary_pink</item>
        <item name="colorPrimaryVariant">@color/primary_pink</item>
        <item name="colorOnPrimary">@color/black</item>
        <!-- Secondary brand color. -->
        <item name="colorSecondary">@color/teal_200</item>
        <item name="colorSecondaryVariant">@color/teal_200</item>
        <item name="colorSecondary">@color/primary_orange</item>
        <item name="colorSecondaryVariant">@color/primary_orange</item>
        <item name="colorOnSecondary">@color/black</item>
        <!-- Status bar color. -->
        <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>

M app/src/main/res/values/colors.xml => app/src/main/res/values/colors.xml +10 -5
@@ 1,10 1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="purple_200">#FFBB86FC</color>
    <color name="purple_500">#FF6200EE</color>
    <color name="purple_700">#FF3700B3</color>
    <color name="teal_200">#FF03DAC5</color>
    <color name="teal_700">#FF018786</color>
    <color name="black">#FF000000</color>
    <color name="white">#FFFFFFFF</color>

    <color name="primary_pink">#CA1943</color>
    <color name="primary_orange">#FD8B49</color>

    <color name="die_pink">#DA0166</color>
    <color name="die_green">#4C8600</color>
    <color name="die_purple">#5C4F9F</color>
    <color name="die_yellow">#B08100</color>
    <color name="die_blue">#2B97AE</color>
    <color name="die_silver">#868C93</color>
</resources>
\ No newline at end of file

A app/src/main/res/values/ic_launcher_background.xml => app/src/main/res/values/ic_launcher_background.xml +4 -0
@@ 0,0 1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="ic_launcher_background">#BA2849</color>
</resources>
\ No newline at end of file

M app/src/main/res/values/themes.xml => app/src/main/res/values/themes.xml +4 -4
@@ 2,12 2,12 @@
    <!-- Base application theme. -->
    <style name="Theme.QwingoRoller" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
        <!-- Primary brand color. -->
        <item name="colorPrimary">@color/purple_500</item>
        <item name="colorPrimaryVariant">@color/purple_700</item>
        <item name="colorPrimary">@color/primary_pink</item>
        <item name="colorPrimaryVariant">@color/primary_pink</item>
        <item name="colorOnPrimary">@color/white</item>
        <!-- Secondary brand color. -->
        <item name="colorSecondary">@color/teal_200</item>
        <item name="colorSecondaryVariant">@color/teal_700</item>
        <item name="colorSecondary">@color/primary_orange</item>
        <item name="colorSecondaryVariant">@color/primary_orange</item>
        <item name="colorOnSecondary">@color/black</item>
        <!-- Status bar color. -->
        <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>

A qwingo-logo.kra => qwingo-logo.kra +0 -0