commit 468ec1ede43a2048f5762f07e4a55524ea8cbb2a Author: Wyatt J. Miller Date: Tue Sep 15 23:07:30 2020 -0400 added initial code 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 @@ + + + + + +