implement the actual Dark theme

This commit is contained in:
tibbi 2016-08-07 23:14:37 +02:00
parent f66099ccf5
commit 1c8753c341
6 changed files with 35 additions and 8 deletions

View File

@ -3,7 +3,6 @@ package com.simplemobiletools.applauncher.activities
import android.content.ActivityNotFoundException
import android.content.Intent
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.text.Html
import android.text.method.LinkMovementMethod
import android.view.View
@ -15,7 +14,7 @@ import com.simplemobiletools.applauncher.extensions.viewIntent
import kotlinx.android.synthetic.main.activity_about.*
import java.util.*
class AboutActivity : AppCompatActivity() {
class AboutActivity : SimpleActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

View File

@ -1,12 +1,11 @@
package com.simplemobiletools.applauncher.activities
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import com.simplemobiletools.applauncher.R
import com.simplemobiletools.applauncher.extensions.viewIntent
import kotlinx.android.synthetic.main.activity_license.*
class LicenseActivity : AppCompatActivity() {
class LicenseActivity : SimpleActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

View File

@ -2,14 +2,13 @@ package com.simplemobiletools.applauncher.activities
import android.content.Intent
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.view.Menu
import android.view.MenuItem
import com.simplemobiletools.applauncher.R
import com.simplemobiletools.applauncher.extensions.isFirstRun
import com.simplemobiletools.applauncher.extensions.preferences
class MainActivity : AppCompatActivity() {
class MainActivity : SimpleActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

View File

@ -2,13 +2,12 @@ package com.simplemobiletools.applauncher.activities
import android.os.Bundle
import android.support.v4.app.TaskStackBuilder
import android.support.v7.app.AppCompatActivity
import com.simplemobiletools.applauncher.R
import com.simplemobiletools.applauncher.extensions.isDarkTheme
import com.simplemobiletools.applauncher.extensions.preferences
import kotlinx.android.synthetic.main.activity_settings.*
class SettingsActivity : AppCompatActivity() {
class SettingsActivity : SimpleActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

View File

@ -0,0 +1,25 @@
package com.simplemobiletools.applauncher.activities
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.view.MenuItem
import com.simplemobiletools.applauncher.R
import com.simplemobiletools.applauncher.extensions.isDarkTheme
import com.simplemobiletools.applauncher.extensions.preferences
open class SimpleActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
setTheme(if (preferences.isDarkTheme) R.style.AppTheme_Dark else R.style.AppTheme)
super.onCreate(savedInstanceState)
}
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
when (item?.itemId) {
android.R.id.home -> {
finish()
return true
}
}
return super.onOptionsItemSelected(item)
}
}

View File

@ -6,4 +6,10 @@
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.Dark" parent="Theme.AppCompat">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>