From 468ec1ede43a2048f5762f07e4a55524ea8cbb2a Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Tue, 15 Sep 2020 23:07:30 -0400 Subject: [PATCH] added initial code --- app/.gitignore | 1 + app/build.gradle | 38 ++++ app/proguard-rules.pro | 21 +++ .../tictactoeapp/ExampleInstrumentedTest.kt | 24 +++ app/src/main/AndroidManifest.xml | 21 +++ .../wyattjmiller/tictactoeapp/Gameboard.kt | 24 +++ .../wyattjmiller/tictactoeapp/MainActivity.kt | 44 +++++ .../drawable-v24/ic_launcher_foreground.xml | 30 ++++ .../res/drawable/ic_launcher_background.xml | 170 ++++++++++++++++++ app/src/main/res/layout/activity_main.xml | 112 ++++++++++++ .../res/mipmap-anydpi-v26/ic_launcher.xml | 5 + .../mipmap-anydpi-v26/ic_launcher_round.xml | 5 + app/src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 3593 bytes .../res/mipmap-hdpi/ic_launcher_round.png | Bin 0 -> 5339 bytes app/src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 2636 bytes .../res/mipmap-mdpi/ic_launcher_round.png | Bin 0 -> 3388 bytes app/src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 4926 bytes .../res/mipmap-xhdpi/ic_launcher_round.png | Bin 0 -> 7472 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 7909 bytes .../res/mipmap-xxhdpi/ic_launcher_round.png | Bin 0 -> 11873 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 10652 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.png | Bin 0 -> 16570 bytes app/src/main/res/values/colors.xml | 6 + app/src/main/res/values/strings.xml | 3 + app/src/main/res/values/styles.xml | 10 ++ .../tictactoeapp/ExampleUnitTest.kt | 17 ++ 26 files changed, 531 insertions(+) create mode 100644 app/.gitignore create mode 100644 app/build.gradle create mode 100644 app/proguard-rules.pro create mode 100644 app/src/androidTest/java/com/wyattjmiller/tictactoeapp/ExampleInstrumentedTest.kt create mode 100644 app/src/main/AndroidManifest.xml create mode 100644 app/src/main/java/com/wyattjmiller/tictactoeapp/Gameboard.kt create mode 100644 app/src/main/java/com/wyattjmiller/tictactoeapp/MainActivity.kt create mode 100644 app/src/main/res/drawable-v24/ic_launcher_foreground.xml create mode 100644 app/src/main/res/drawable/ic_launcher_background.xml create mode 100644 app/src/main/res/layout/activity_main.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png create mode 100644 app/src/main/res/values/colors.xml create mode 100644 app/src/main/res/values/strings.xml create mode 100644 app/src/main/res/values/styles.xml create mode 100644 app/src/test/java/com/wyattjmiller/tictactoeapp/ExampleUnitTest.kt diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..0e67b6b --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,38 @@ +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-android-extensions' + +android { + compileSdkVersion 29 + buildToolsVersion "30.0.2" + + defaultConfig { + applicationId "com.wyattjmiller.tictactoeapp" + minSdkVersion 21 + targetSdkVersion 29 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: "libs", include: ["*.jar"]) + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation 'androidx.core:core-ktx:1.3.1' + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'androidx.constraintlayout:constraintlayout:2.0.1' + implementation 'androidx.gridlayout:gridlayout:1.0.0' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test.ext:junit:1.1.2' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' + +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/src/androidTest/java/com/wyattjmiller/tictactoeapp/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/wyattjmiller/tictactoeapp/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..4df90ca --- /dev/null +++ b/app/src/androidTest/java/com/wyattjmiller/tictactoeapp/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.wyattjmiller.tictactoeapp + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.wyattjmiller.tictactoeapp", appContext.packageName) + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..75a930c --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/wyattjmiller/tictactoeapp/Gameboard.kt b/app/src/main/java/com/wyattjmiller/tictactoeapp/Gameboard.kt new file mode 100644 index 0000000..5357ed7 --- /dev/null +++ b/app/src/main/java/com/wyattjmiller/tictactoeapp/Gameboard.kt @@ -0,0 +1,24 @@ +package com.wyattjmiller.tictactoeapp + +class Gameboard() { + enum class GameState { + GameStart, + GamePlayerTurnX, + GamePlayerTurnO, + GamePlayerWinX, + GamePlayerWinO, + GameExit + } + + enum class GamePiece { + None, + X, + O + } + + + + companion object { } + + init { } +} \ No newline at end of file diff --git a/app/src/main/java/com/wyattjmiller/tictactoeapp/MainActivity.kt b/app/src/main/java/com/wyattjmiller/tictactoeapp/MainActivity.kt new file mode 100644 index 0000000..6f22bdd --- /dev/null +++ b/app/src/main/java/com/wyattjmiller/tictactoeapp/MainActivity.kt @@ -0,0 +1,44 @@ +package com.wyattjmiller.tictactoeapp + +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import android.view.View +import android.widget.Button +import android.widget.GridLayout +import androidx.appcompat.app.AppCompatDelegate +import androidx.fragment.app.DialogFragment + +class MainActivity : AppCompatActivity() { + + // Private variables per the layout + private lateinit var mGameboardGridLayout: GridLayout + private lateinit var mGameboardButtonOne: Button + private lateinit var mGameboardButtonTwo: Button + private lateinit var mGameboardButtonThree: Button + private lateinit var mGameboardButtonFour: Button + private lateinit var mGameboardButtonFive: Button + private lateinit var mGameboardButtonSix: Button + private lateinit var mGameboardButtonSeven: Button + private lateinit var mGameboardButtonEight: Button + private lateinit var mGameboardButtonNine: Button + private lateinit var mGameStatsButton: Button + private lateinit var mResetGameButton: Button + + // Private variables - other variables + private lateinit var mResetDialog: DialogFragment + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main) + + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM) + } + + fun clickResetGame(view: View?) { + + } + + fun clickGameStats(view: View?) { + + } +} \ No newline at end of file diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..c2f8ad2 --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,112 @@ + + + + + +