diff --git a/app/src/main/kotlin/com/simplemobiletools/thankyou/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/thankyou/activities/SettingsActivity.kt index 5884190..ea741db 100644 --- a/app/src/main/kotlin/com/simplemobiletools/thankyou/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/thankyou/activities/SettingsActivity.kt @@ -1,9 +1,28 @@ package com.simplemobiletools.thankyou.activities import android.os.Bundle +import android.support.v4.app.TaskStackBuilder +import com.simplemobiletools.thankyou.R +import kotlinx.android.synthetic.main.activity_settings.* class SettingsActivity : SimpleActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + setContentView(R.layout.activity_settings) + + setupDarkTheme() + } + + private fun setupDarkTheme() { + settings_dark_theme.isChecked = mConfig.isDarkTheme + settings_dark_theme_holder.setOnClickListener { + settings_dark_theme.toggle() + mConfig.isDarkTheme = settings_dark_theme.isChecked + restartActivity() + } + } + + private fun restartActivity() { + TaskStackBuilder.create(applicationContext).addNextIntentWithParentStack(intent).startActivities() } }