diff --git a/app/src/main/kotlin/com/simplemobiletools/thankyou/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/thankyou/activities/MainActivity.kt
index 83b583e..518155e 100644
--- a/app/src/main/kotlin/com/simplemobiletools/thankyou/activities/MainActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/thankyou/activities/MainActivity.kt
@@ -1,13 +1,17 @@
package com.simplemobiletools.thankyou.activities
import android.os.Bundle
-import android.support.v7.app.AppCompatActivity
import com.simplemobiletools.thankyou.R
-class MainActivity : AppCompatActivity() {
+class MainActivity : SimpleActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
+
+ override fun onDestroy() {
+ super.onDestroy()
+ mConfig.isFirstRun = false
+ }
}
diff --git a/app/src/main/kotlin/com/simplemobiletools/thankyou/activities/SimpleActivity.kt b/app/src/main/kotlin/com/simplemobiletools/thankyou/activities/SimpleActivity.kt
new file mode 100644
index 0000000..7084233
--- /dev/null
+++ b/app/src/main/kotlin/com/simplemobiletools/thankyou/activities/SimpleActivity.kt
@@ -0,0 +1,27 @@
+package com.simplemobiletools.thankyou.activities
+
+import android.os.Bundle
+import android.support.v7.app.AppCompatActivity
+import android.view.MenuItem
+import com.simplemobiletools.thankyou.R
+import com.simplemobiletools.thankyou.helpers.Config
+
+open class SimpleActivity : AppCompatActivity() {
+ lateinit var mConfig: Config
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ mConfig = Config.newInstance(applicationContext)
+ setTheme(if (mConfig.isDarkTheme) R.style.AppTheme_Dark else R.style.AppTheme)
+ super.onCreate(savedInstanceState)
+ }
+
+ override fun onOptionsItemSelected(item: MenuItem): Boolean {
+ return when (item.itemId) {
+ android.R.id.home -> {
+ finish()
+ true
+ }
+ else -> super.onOptionsItemSelected(item)
+ }
+ }
+}
diff --git a/app/src/main/kotlin/com/simplemobiletools/thankyou/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/thankyou/helpers/Config.kt
new file mode 100644
index 0000000..59e0a79
--- /dev/null
+++ b/app/src/main/kotlin/com/simplemobiletools/thankyou/helpers/Config.kt
@@ -0,0 +1,24 @@
+package com.simplemobiletools.thankyou.helpers
+
+import android.content.Context
+import android.content.SharedPreferences
+
+class Config(context: Context) {
+ private val mPrefs: SharedPreferences
+
+ companion object {
+ fun newInstance(context: Context) = Config(context)
+ }
+
+ init {
+ mPrefs = context.getSharedPreferences(PREFS_KEY, Context.MODE_PRIVATE)
+ }
+
+ var isFirstRun: Boolean
+ get() = mPrefs.getBoolean(IS_FIRST_RUN, true)
+ set(firstRun) = mPrefs.edit().putBoolean(IS_FIRST_RUN, firstRun).apply()
+
+ var isDarkTheme: Boolean
+ get() = mPrefs.getBoolean(IS_DARK_THEME, false)
+ set(isDarkTheme) = mPrefs.edit().putBoolean(IS_DARK_THEME, isDarkTheme).apply()
+}
diff --git a/app/src/main/kotlin/com/simplemobiletools/thankyou/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/thankyou/helpers/Constants.kt
new file mode 100644
index 0000000..1b14b37
--- /dev/null
+++ b/app/src/main/kotlin/com/simplemobiletools/thankyou/helpers/Constants.kt
@@ -0,0 +1,6 @@
+package com.simplemobiletools.thankyou.helpers
+
+// Shared Preferences
+val PREFS_KEY = "Thank You"
+val IS_FIRST_RUN = "is_first_run"
+val IS_DARK_THEME = "is_dark_theme"
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 3ab3e9c..ca8ad63 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -1,6 +1,6 @@
- #3F51B5
- #303F9F
- #FF4081
+ #fff68630
+ #ffe27725
+ @color/colorPrimary
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
index e641ba4..26c3358 100644
--- a/app/src/main/res/values/dimens.xml
+++ b/app/src/main/res/values/dimens.xml
@@ -1,3 +1,5 @@
16dp
+
+ 14sp
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 5885930..89bc6b7 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -1,11 +1,29 @@
-
+
+
+
+
+
+