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")
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

View File

@ -96,7 +96,8 @@
android:id="@+id/config_bg_color"
android:layout_width="@dimen/widget_colorpicker_size"
android:layout_height="@dimen/widget_colorpicker_size"
android:layout_above="@+id/config_text_color" />
android:layout_above="@+id/config_text_color"
android:layout_margin="@dimen/tiny_margin" />
<RelativeLayout
android:id="@+id/config_bg_seekbar_holder"
@ -104,36 +105,40 @@
android:layout_height="match_parent"
android:layout_alignTop="@+id/config_bg_color"
android:layout_alignBottom="@+id/config_bg_color"
android:layout_marginStart="@dimen/medium_margin"
android:layout_toEndOf="@+id/config_bg_color"
android:background="@android:color/white">
android:background="@drawable/widget_config_seekbar_background">
<SeekBar
<com.simplemobiletools.commons.views.MySeekBar
android:id="@+id/config_bg_seekbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingStart="@dimen/activity_margin"
android:paddingEnd="@dimen/activity_margin" />
</RelativeLayout>
<ImageView
android:id="@+id/config_text_color"
android:layout_width="@dimen/widget_colorpicker_size"
android:layout_height="@dimen/widget_colorpicker_size"
android:layout_alignParentBottom="true" />
android:layout_alignParentBottom="true"
android:layout_margin="@dimen/tiny_margin" />
<Button
android:id="@+id/config_save"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignTop="@+id/config_text_color"
android:layout_alignBottom="@+id/config_text_color"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:background="@drawable/widget_config_seekbar_background"
android:fontFamily="sans-serif-light"
android:paddingStart="@dimen/activity_margin"
android:paddingEnd="@dimen/activity_margin"
android:text="@string/ok"
android:textColor="@android:color/white"
android:textColor="@color/dark_grey"
android:textFontWeight="400"
android:textSize="@dimen/big_text_size" />
</RelativeLayout>