diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 43337408..39d74f81 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -21,5 +21,30 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/clock/activities/MainActivity.kt
index f9aadcc1..61b8c59f 100644
--- a/app/src/main/kotlin/com/simplemobiletools/clock/activities/MainActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/clock/activities/MainActivity.kt
@@ -1,12 +1,75 @@
package com.simplemobiletools.clock.activities
+import android.content.Intent
import android.os.Bundle
+import android.view.Menu
+import android.view.MenuItem
+import android.view.WindowManager
+import com.simplemobiletools.clock.BuildConfig
import com.simplemobiletools.clock.R
+import com.simplemobiletools.clock.extensions.config
+import com.simplemobiletools.commons.extensions.restartActivity
+import com.simplemobiletools.commons.helpers.LICENSE_KOTLIN
+import com.simplemobiletools.commons.models.FAQItem
class MainActivity : SimpleActivity() {
+ private var storedUseEnglish = false
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
+ storeStateVariables()
+ }
+
+ override fun onResume() {
+ super.onResume()
+ if (storedUseEnglish != config.useEnglish) {
+ restartActivity()
+ return
+ }
+
+ if (config.preventPhoneFromSleeping) {
+ window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
+ }
+ }
+
+ override fun onPause() {
+ super.onPause()
+ storeStateVariables()
+ if (config.preventPhoneFromSleeping) {
+ window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
+ }
+ }
+
+ override fun onCreateOptionsMenu(menu: Menu): Boolean {
+ menuInflater.inflate(R.menu.menu, menu)
+ return true
+ }
+
+ override fun onOptionsItemSelected(item: MenuItem): Boolean {
+ when (item.itemId) {
+ R.id.settings -> launchSettings()
+ R.id.about -> launchAbout()
+ else -> return super.onOptionsItemSelected(item)
+ }
+ return true
+ }
+
+ private fun storeStateVariables() {
+ storedUseEnglish = config.useEnglish
+ }
+
+ private fun launchSettings() {
+ startActivity(Intent(applicationContext, SettingsActivity::class.java))
+ }
+
+ private fun launchAbout() {
+ val faqItems = arrayListOf(
+ FAQItem(R.string.faq_1_title_commons, R.string.faq_1_text_commons),
+ FAQItem(R.string.faq_2_title_commons, R.string.faq_2_text_commons),
+ FAQItem(R.string.faq_4_title_commons, R.string.faq_4_text_commons)
+ )
+
+ startAboutActivity(R.string.app_name, LICENSE_KOTLIN, BuildConfig.VERSION_NAME, faqItems)
}
}
diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/clock/activities/SettingsActivity.kt
new file mode 100644
index 00000000..96b766c3
--- /dev/null
+++ b/app/src/main/kotlin/com/simplemobiletools/clock/activities/SettingsActivity.kt
@@ -0,0 +1,59 @@
+package com.simplemobiletools.clock.activities
+
+import android.os.Bundle
+import com.simplemobiletools.clock.R
+import com.simplemobiletools.clock.extensions.config
+import com.simplemobiletools.commons.extensions.beVisibleIf
+import com.simplemobiletools.commons.extensions.updateTextColors
+import com.simplemobiletools.commons.extensions.useEnglishToggled
+import kotlinx.android.synthetic.main.activity_settings.*
+import java.util.*
+
+class SettingsActivity : SimpleActivity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.activity_settings)
+ }
+
+ override fun onResume() {
+ super.onResume()
+
+ setupCustomizeColors()
+ setupUseEnglish()
+ setupAvoidWhatsNew()
+ setupPreventPhoneFromSleeping()
+ updateTextColors(settings_holder)
+ }
+
+ private fun setupCustomizeColors() {
+ settings_customize_colors_holder.setOnClickListener {
+ startCustomizationActivity()
+ }
+ }
+
+ private fun setupUseEnglish() {
+ settings_use_english_holder.beVisibleIf(config.wasUseEnglishToggled || Locale.getDefault().language != "en")
+ settings_use_english.isChecked = config.useEnglish
+ settings_use_english_holder.setOnClickListener {
+ settings_use_english.toggle()
+ config.useEnglish = settings_use_english.isChecked
+ useEnglishToggled()
+ }
+ }
+
+ private fun setupAvoidWhatsNew() {
+ settings_avoid_whats_new.isChecked = config.avoidWhatsNew
+ settings_avoid_whats_new_holder.setOnClickListener {
+ settings_avoid_whats_new.toggle()
+ config.avoidWhatsNew = settings_avoid_whats_new.isChecked
+ }
+ }
+
+ private fun setupPreventPhoneFromSleeping() {
+ settings_prevent_phone_from_sleeping.isChecked = config.preventPhoneFromSleeping
+ settings_prevent_phone_from_sleeping_holder.setOnClickListener {
+ settings_prevent_phone_from_sleeping.toggle()
+ config.preventPhoneFromSleeping = settings_prevent_phone_from_sleeping.isChecked
+ }
+ }
+}
diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/clock/extensions/Context.kt
new file mode 100644
index 00000000..7b80fe88
--- /dev/null
+++ b/app/src/main/kotlin/com/simplemobiletools/clock/extensions/Context.kt
@@ -0,0 +1,6 @@
+package com.simplemobiletools.clock.extensions
+
+import android.content.Context
+import com.simplemobiletools.clock.helpers.Config
+
+val Context.config: Config get() = Config.newInstance(applicationContext)
diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/clock/helpers/Config.kt
new file mode 100644
index 00000000..04b59fc1
--- /dev/null
+++ b/app/src/main/kotlin/com/simplemobiletools/clock/helpers/Config.kt
@@ -0,0 +1,10 @@
+package com.simplemobiletools.clock.helpers
+
+import android.content.Context
+import com.simplemobiletools.commons.helpers.BaseConfig
+
+class Config(context: Context) : BaseConfig(context) {
+ companion object {
+ fun newInstance(context: Context) = Config(context)
+ }
+}
diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml
new file mode 100644
index 00000000..c3427eea
--- /dev/null
+++ b/app/src/main/res/layout/activity_settings.xml
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/menu/menu.xml b/app/src/main/res/menu/menu.xml
new file mode 100644
index 00000000..815619cd
--- /dev/null
+++ b/app/src/main/res/menu/menu.xml
@@ -0,0 +1,12 @@
+
+