adding some widget config related improvements

This commit is contained in:
tibbi
2022-05-23 20:47:56 +02:00
parent 216b34643f
commit 236ae3a233
7 changed files with 22 additions and 14 deletions

View File

@ -59,7 +59,11 @@ class WidgetConfigureActivity : SimpleActivity() {
config_bg_color.setOnClickListener { pickBackgroundColor() }
config_text_color.setOnClickListener { pickTextColor() }
notes_picker_value.setOnClickListener { showNoteSelector() }
val primaryColor = getProperPrimaryColor()
config_bg_seekbar.setColors(mTextColor, primaryColor, primaryColor)
notes_picker_holder.background = ColorDrawable(getProperBackgroundColor())
show_note_title_holder.setOnClickListener {
show_note_title.toggle()
handleNoteTitleDisplay()
@ -229,17 +233,15 @@ class WidgetConfigureActivity : SimpleActivity() {
mBgColor = mBgColorWithoutTransparency.adjustAlpha(mBgAlpha)
text_note_view.setBackgroundColor(mBgColor)
checklist_note_view.setBackgroundColor(mBgColor)
config_save.setBackgroundColor(mBgColor)
text_note_view_title.setBackgroundColor(mBgColor)
config_bg_color.setFillWithStroke(mBgColor, Color.BLACK)
config_bg_color.setFillWithStroke(mBgColor, mBgColor)
}
private fun updateTextColor() {
config_save.setTextColor(mTextColor)
text_note_view.setTextColor(mTextColor)
text_note_view_title.setTextColor(mTextColor)
(checklist_note_view.adapter as? ChecklistAdapter)?.updateTextColor(mTextColor)
config_text_color.setFillWithStroke(mTextColor, Color.BLACK)
config_text_color.setFillWithStroke(mTextColor, mTextColor)
}
private fun pickBackgroundColor() {

View File

@ -6,7 +6,6 @@ import androidx.room.Room
import androidx.room.RoomDatabase
import androidx.room.migration.Migration
import androidx.sqlite.db.SupportSQLiteDatabase
import com.simplemobiletools.commons.helpers.DEFAULT_WIDGET_BG_COLOR
import com.simplemobiletools.commons.helpers.PROTECTION_NONE
import com.simplemobiletools.notes.pro.R
import com.simplemobiletools.notes.pro.helpers.DEFAULT_WIDGET_TEXT_COLOR
@ -26,8 +25,10 @@ abstract class NotesDatabase : RoomDatabase() {
companion object {
private var db: NotesDatabase? = null
private var defaultWidgetBgColor = 0
fun getInstance(context: Context): NotesDatabase {
defaultWidgetBgColor = context.resources.getInteger(R.integer.default_widget_bg_color)
if (db == null) {
synchronized(NotesDatabase::class) {
if (db == null) {
@ -64,7 +65,7 @@ abstract class NotesDatabase : RoomDatabase() {
private val MIGRATION_1_2 = object : Migration(1, 2) {
override fun migrate(database: SupportSQLiteDatabase) {
database.apply {
execSQL("ALTER TABLE widgets ADD COLUMN widget_bg_color INTEGER NOT NULL DEFAULT $DEFAULT_WIDGET_BG_COLOR")
execSQL("ALTER TABLE widgets ADD COLUMN widget_bg_color INTEGER NOT NULL DEFAULT $defaultWidgetBgColor")
execSQL("ALTER TABLE widgets ADD COLUMN widget_text_color INTEGER NOT NULL DEFAULT $DEFAULT_WIDGET_TEXT_COLOR")
}
}