setup the initial theme colors
This commit is contained in:
parent
01806026a0
commit
2cf956ca7a
3 changed files with 21 additions and 1 deletions
|
@ -10,6 +10,10 @@ class CustomizationActivity : BaseSimpleActivity() {
|
|||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_customization)
|
||||
|
||||
customization_text_color.setBackgroundColor(baseConfig.textColor)
|
||||
customization_background_color.setBackgroundColor(baseConfig.backgroundColor)
|
||||
customization_primary_color.setBackgroundColor(baseConfig.primaryColor)
|
||||
|
||||
customization_text_color_holder.setOnClickListener { }
|
||||
customization_background_color_holder.setOnClickListener { }
|
||||
customization_primary_color_holder.setOnClickListener { }
|
||||
|
|
|
@ -2,9 +2,10 @@ package com.simplemobiletools.commons.helpers
|
|||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import com.simplemobiletools.commons.R
|
||||
import com.simplemobiletools.commons.extensions.getSharedPrefs
|
||||
|
||||
open class BaseConfig(context: Context) {
|
||||
open class BaseConfig(val context: Context) {
|
||||
private val mPrefs: SharedPreferences
|
||||
|
||||
companion object {
|
||||
|
@ -30,4 +31,16 @@ open class BaseConfig(context: Context) {
|
|||
var treeUri: String
|
||||
get() = mPrefs.getString(TREE_URI, "")
|
||||
set(uri) = mPrefs.edit().putString(TREE_URI, uri).apply()
|
||||
|
||||
var textColor: Int
|
||||
get() = mPrefs.getInt(TEXT_COLOR, 0xFF333333.toInt())
|
||||
set(textColor) = mPrefs.edit().putInt(TEXT_COLOR, textColor).apply()
|
||||
|
||||
var backgroundColor: Int
|
||||
get() = mPrefs.getInt(BACKGROUND_COLOR, 0xFFEEEEEE.toInt())
|
||||
set(backgroundColor) = mPrefs.edit().putInt(BACKGROUND_COLOR, backgroundColor).apply()
|
||||
|
||||
var primaryColor: Int
|
||||
get() = mPrefs.getInt(PRIMARY_COLOR, context.getColor(R.color.color_primary))
|
||||
set(primaryColor) = mPrefs.edit().putInt(PRIMARY_COLOR, primaryColor).apply()
|
||||
}
|
||||
|
|
|
@ -9,6 +9,9 @@ val IS_FIRST_RUN = "is_first_run"
|
|||
val IS_DARK_THEME = "is_dark_theme"
|
||||
val LAST_VERSION = "last_version"
|
||||
val TREE_URI = "tree_uri"
|
||||
val TEXT_COLOR = "text_color"
|
||||
val BACKGROUND_COLOR = "background_color"
|
||||
val PRIMARY_COLOR = "primary_color"
|
||||
|
||||
// licenses
|
||||
val LICENSE_KOTLIN = 1
|
||||
|
|
Loading…
Reference in a new issue