mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-06-05 17:00:23 +02:00
adding some widget config related improvements
This commit is contained in:
@ -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() {
|
||||
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user