diff --git a/app/build.gradle b/app/build.gradle index 83e045c..94048ba 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,14 +1,15 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' +apply plugin: 'kotlin-android-extensions' android { - compileSdkVersion 25 - buildToolsVersion "25.0.2" + compileSdkVersion 28 + buildToolsVersion '28.0.2' defaultConfig { applicationId "android.emu6502" minSdkVersion 16 - targetSdkVersion 25 + targetSdkVersion 28 versionCode 1 versionName "1.0" } @@ -22,16 +23,14 @@ android { } dependencies { - compile 'com.android.support:design:25.2.0' - compile 'com.android.support:appcompat-v7:25.2.0' - compile 'com.android.support:cardview-v7:25.2.0' - compile 'org.jetbrains.kotlin:kotlin-stdlib:1.1.0' - compile "org.jetbrains.kotlin:kotlin-reflect:1.1.0" - compile 'com.jakewharton:kotterknife:0.1.0-SNAPSHOT' - compile 'com.facebook.stetho:stetho:1.3.1' - compile 'com.google.guava:guava:20.0' + implementation 'com.google.android.material:material:1.0.0-alpha1' + implementation 'androidx.appcompat:appcompat:1.0.0-alpha1' + implementation 'androidx.cardview:cardview:1.0.0-alpha1' + implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.2.60' + implementation "org.jetbrains.kotlin:kotlin-reflect:1.2.60" + implementation 'com.facebook.stetho:stetho:1.5.0' - testCompile 'junit:junit:4.12' - testCompile 'com.google.truth:truth:0.32' - testCompile 'org.mockito:mockito-core:1.10.19' + testImplementation 'junit:junit:4.12' + testImplementation 'com.google.truth:truth:0.42' + testImplementation 'org.mockito:mockito-core:1.10.19' } diff --git a/app/src/main/kotlin/android/emu6502/app/MainActivity.kt b/app/src/main/kotlin/android/emu6502/app/MainActivity.kt index 0748cee..9f6260e 100644 --- a/app/src/main/kotlin/android/emu6502/app/MainActivity.kt +++ b/app/src/main/kotlin/android/emu6502/app/MainActivity.kt @@ -1,42 +1,18 @@ package android.emu6502.app -import android.emu6502.Display import android.emu6502.Emulator import android.emu6502.R import android.os.Bundle -import android.support.design.widget.CoordinatorLayout -import android.support.design.widget.FloatingActionButton -import android.support.design.widget.Snackbar -import android.support.v7.app.ActionBar -import android.support.v7.app.AppCompatActivity -import android.support.v7.widget.Toolbar import android.view.Menu import android.view.MenuItem import android.view.View -import android.widget.Button -import android.widget.FrameLayout -import android.widget.TextView -import butterknife.bindView +import androidx.appcompat.app.ActionBar +import androidx.appcompat.app.AppCompatActivity +import com.google.android.material.snackbar.Snackbar +import kotlinx.android.synthetic.main.activity_main.* +import kotlinx.android.synthetic.main.toolbar.* class MainActivity : AppCompatActivity() { - val toolbar: Toolbar by bindView(R.id.toolbar) - val txtA: TextView by bindView(R.id.A) - val txtX: TextView by bindView(R.id.X) - val txtY: TextView by bindView(R.id.Y) - val txtSP: TextView by bindView(R.id.SP) - val txtPC: TextView by bindView(R.id.PC) - val txtFlags: TextView by bindView(R.id.PC) - val displayWrapper: FrameLayout by bindView(R.id.display_wrapper) - val display: Display by bindView(R.id.display) - val txtInstructions: TextView by bindView(R.id.txtInstructions) - val fabRun: FloatingActionButton by bindView(R.id.fabRun) - val layoutContent: CoordinatorLayout by bindView(R.id.layout_content) - val btnLeft: Button by bindView(R.id.arrowLeft) - val btnRight: Button by bindView(R.id.arrowRight) - val btnUp: Button by bindView(R.id.arrowUp) - val btnDown: Button by bindView(R.id.arrowDown) - val btnReset: Button by bindView(R.id.btnReset) - private var emulator: Emulator? = null override fun onCreate(savedInstanceState: Bundle?) { @@ -47,11 +23,11 @@ class MainActivity : AppCompatActivity() { ab.setDisplayHomeAsUpEnabled(true) fabRun.setOnClickListener { - displayWrapper.visibility = View.VISIBLE + display_wrapper.visibility = View.VISIBLE emulator = Emulator(display) val emu: Emulator = emulator as Emulator emu.assembler.assembleCode(txtInstructions.text.toString().split("\n")) - Snackbar.make(layoutContent, + Snackbar.make(layout_content, "Code assembled successfully, ${emu.assembler.codeLen} bytes.", Snackbar.LENGTH_SHORT).show() emu.cpu.run() @@ -68,10 +44,10 @@ class MainActivity : AppCompatActivity() { emu.cpu.memory.storeKeypress(code) } } - btnLeft.setOnClickListener { onClickButton(0x61) } - btnRight.setOnClickListener { onClickButton(0x64) } - btnUp.setOnClickListener { onClickButton(0x77) } - btnDown.setOnClickListener { onClickButton(0x73) } + arrowLeft.setOnClickListener { onClickButton(0x61) } + arrowRight.setOnClickListener { onClickButton(0x64) } + arrowUp.setOnClickListener { onClickButton(0x77) } + arrowDown.setOnClickListener { onClickButton(0x73) } } override fun onCreateOptionsMenu(menu: Menu?): Boolean { @@ -85,10 +61,10 @@ class MainActivity : AppCompatActivity() { // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. val id = item!!.itemId - if (id == R.id.action_settings) { - return true + return if (id == R.id.action_settings) { + true } else { - return super.onOptionsItemSelected(item) + super.onOptionsItemSelected(item) } } } diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index d589187..e369220 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,4 +1,4 @@ - - - + - @@ -54,7 +54,7 @@ android:layout_height="match_parent"/> - + - - + diff --git a/app/src/main/res/layout/toolbar.xml b/app/src/main/res/layout/toolbar.xml index 418dd3b..719eb5e 100644 --- a/app/src/main/res/layout/toolbar.xml +++ b/app/src/main/res/layout/toolbar.xml @@ -1,4 +1,4 @@ -