From 75ebd49aa503930769d4c1685b3fd485294fb370 Mon Sep 17 00:00:00 2001 From: Billy Brawner Date: Sat, 17 Aug 2019 13:48:24 -0500 Subject: [PATCH] Convert SettingsActivity to Kotlin --- .../view/activity/SettingsActivity.java | 30 ------------------- .../view/activity/SettingsActivity.kt | 26 ++++++++++++++++ 2 files changed, 26 insertions(+), 30 deletions(-) delete mode 100644 app/src/main/java/com/wbrawner/simplemarkdown/view/activity/SettingsActivity.java create mode 100644 app/src/main/java/com/wbrawner/simplemarkdown/view/activity/SettingsActivity.kt diff --git a/app/src/main/java/com/wbrawner/simplemarkdown/view/activity/SettingsActivity.java b/app/src/main/java/com/wbrawner/simplemarkdown/view/activity/SettingsActivity.java deleted file mode 100644 index 3d61fd5..0000000 --- a/app/src/main/java/com/wbrawner/simplemarkdown/view/activity/SettingsActivity.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.wbrawner.simplemarkdown.view.activity; - -import android.os.Bundle; -import android.view.MenuItem; - -import androidx.annotation.Nullable; -import androidx.appcompat.app.AppCompatActivity; - -import com.wbrawner.simplemarkdown.R; - -public class SettingsActivity extends AppCompatActivity { - - @Override - protected void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_settings); - setSupportActionBar(findViewById(R.id.toolbar)); - if (getSupportActionBar() != null) { - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - } - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - // The only menu item is the back button - setResult(RESULT_OK); - finish(); - return true; - } -} diff --git a/app/src/main/java/com/wbrawner/simplemarkdown/view/activity/SettingsActivity.kt b/app/src/main/java/com/wbrawner/simplemarkdown/view/activity/SettingsActivity.kt new file mode 100644 index 0000000..1cb3b05 --- /dev/null +++ b/app/src/main/java/com/wbrawner/simplemarkdown/view/activity/SettingsActivity.kt @@ -0,0 +1,26 @@ +package com.wbrawner.simplemarkdown.view.activity + +import android.os.Bundle +import android.view.MenuItem +import androidx.appcompat.app.AppCompatActivity + +import com.wbrawner.simplemarkdown.R + +class SettingsActivity : AppCompatActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_settings) + setSupportActionBar(findViewById(R.id.toolbar)) + if (supportActionBar != null) { + supportActionBar!!.setDisplayHomeAsUpEnabled(true) + } + } + + override fun onOptionsItemSelected(item: MenuItem): Boolean { + // The only menu item is the back button + setResult(RESULT_OK) + finish() + return true + } +}