add colorpicker functionality
This commit is contained in:
parent
2cf956ca7a
commit
e01d7569a9
1 changed files with 44 additions and 3 deletions
|
@ -3,6 +3,7 @@ package com.simplemobiletools.commons.activities
|
|||
import android.os.Bundle
|
||||
import com.simplemobiletools.commons.R
|
||||
import kotlinx.android.synthetic.main.activity_customization.*
|
||||
import yuku.ambilwarna.AmbilWarnaDialog
|
||||
|
||||
class CustomizationActivity : BaseSimpleActivity() {
|
||||
|
||||
|
@ -10,12 +11,52 @@ class CustomizationActivity : BaseSimpleActivity() {
|
|||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_customization)
|
||||
|
||||
setupColors()
|
||||
|
||||
customization_text_color_holder.setOnClickListener { pickTextColor() }
|
||||
customization_background_color_holder.setOnClickListener { pickbackgroundColor() }
|
||||
customization_primary_color_holder.setOnClickListener { pickPrimaryColor() }
|
||||
}
|
||||
|
||||
private fun setupColors() {
|
||||
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 { }
|
||||
private fun pickTextColor() {
|
||||
AmbilWarnaDialog(this, baseConfig.textColor, object : AmbilWarnaDialog.OnAmbilWarnaListener {
|
||||
override fun onCancel(dialog: AmbilWarnaDialog) {
|
||||
}
|
||||
|
||||
override fun onOk(dialog: AmbilWarnaDialog, color: Int) {
|
||||
baseConfig.textColor = color
|
||||
setupColors()
|
||||
}
|
||||
}).show()
|
||||
}
|
||||
|
||||
private fun pickbackgroundColor() {
|
||||
AmbilWarnaDialog(this, baseConfig.backgroundColor, object : AmbilWarnaDialog.OnAmbilWarnaListener {
|
||||
override fun onCancel(dialog: AmbilWarnaDialog) {
|
||||
}
|
||||
|
||||
override fun onOk(dialog: AmbilWarnaDialog, color: Int) {
|
||||
baseConfig.backgroundColor = color
|
||||
setupColors()
|
||||
}
|
||||
}).show()
|
||||
}
|
||||
|
||||
private fun pickPrimaryColor() {
|
||||
AmbilWarnaDialog(this, baseConfig.primaryColor, object : AmbilWarnaDialog.OnAmbilWarnaListener {
|
||||
override fun onCancel(dialog: AmbilWarnaDialog) {
|
||||
}
|
||||
|
||||
override fun onOk(dialog: AmbilWarnaDialog, color: Int) {
|
||||
baseConfig.primaryColor = color
|
||||
setupColors()
|
||||
}
|
||||
}).show()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue