mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-03-21 19:10:06 +01:00
adding some widget config related improvements
This commit is contained in:
parent
216b34643f
commit
236ae3a233
@ -59,7 +59,11 @@ class WidgetConfigureActivity : SimpleActivity() {
|
|||||||
config_bg_color.setOnClickListener { pickBackgroundColor() }
|
config_bg_color.setOnClickListener { pickBackgroundColor() }
|
||||||
config_text_color.setOnClickListener { pickTextColor() }
|
config_text_color.setOnClickListener { pickTextColor() }
|
||||||
notes_picker_value.setOnClickListener { showNoteSelector() }
|
notes_picker_value.setOnClickListener { showNoteSelector() }
|
||||||
|
|
||||||
|
val primaryColor = getProperPrimaryColor()
|
||||||
|
config_bg_seekbar.setColors(mTextColor, primaryColor, primaryColor)
|
||||||
notes_picker_holder.background = ColorDrawable(getProperBackgroundColor())
|
notes_picker_holder.background = ColorDrawable(getProperBackgroundColor())
|
||||||
|
|
||||||
show_note_title_holder.setOnClickListener {
|
show_note_title_holder.setOnClickListener {
|
||||||
show_note_title.toggle()
|
show_note_title.toggle()
|
||||||
handleNoteTitleDisplay()
|
handleNoteTitleDisplay()
|
||||||
@ -229,17 +233,15 @@ class WidgetConfigureActivity : SimpleActivity() {
|
|||||||
mBgColor = mBgColorWithoutTransparency.adjustAlpha(mBgAlpha)
|
mBgColor = mBgColorWithoutTransparency.adjustAlpha(mBgAlpha)
|
||||||
text_note_view.setBackgroundColor(mBgColor)
|
text_note_view.setBackgroundColor(mBgColor)
|
||||||
checklist_note_view.setBackgroundColor(mBgColor)
|
checklist_note_view.setBackgroundColor(mBgColor)
|
||||||
config_save.setBackgroundColor(mBgColor)
|
|
||||||
text_note_view_title.setBackgroundColor(mBgColor)
|
text_note_view_title.setBackgroundColor(mBgColor)
|
||||||
config_bg_color.setFillWithStroke(mBgColor, Color.BLACK)
|
config_bg_color.setFillWithStroke(mBgColor, mBgColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateTextColor() {
|
private fun updateTextColor() {
|
||||||
config_save.setTextColor(mTextColor)
|
|
||||||
text_note_view.setTextColor(mTextColor)
|
text_note_view.setTextColor(mTextColor)
|
||||||
text_note_view_title.setTextColor(mTextColor)
|
text_note_view_title.setTextColor(mTextColor)
|
||||||
(checklist_note_view.adapter as? ChecklistAdapter)?.updateTextColor(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() {
|
private fun pickBackgroundColor() {
|
||||||
|
@ -6,7 +6,6 @@ import androidx.room.Room
|
|||||||
import androidx.room.RoomDatabase
|
import androidx.room.RoomDatabase
|
||||||
import androidx.room.migration.Migration
|
import androidx.room.migration.Migration
|
||||||
import androidx.sqlite.db.SupportSQLiteDatabase
|
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||||
import com.simplemobiletools.commons.helpers.DEFAULT_WIDGET_BG_COLOR
|
|
||||||
import com.simplemobiletools.commons.helpers.PROTECTION_NONE
|
import com.simplemobiletools.commons.helpers.PROTECTION_NONE
|
||||||
import com.simplemobiletools.notes.pro.R
|
import com.simplemobiletools.notes.pro.R
|
||||||
import com.simplemobiletools.notes.pro.helpers.DEFAULT_WIDGET_TEXT_COLOR
|
import com.simplemobiletools.notes.pro.helpers.DEFAULT_WIDGET_TEXT_COLOR
|
||||||
@ -26,8 +25,10 @@ abstract class NotesDatabase : RoomDatabase() {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private var db: NotesDatabase? = null
|
private var db: NotesDatabase? = null
|
||||||
|
private var defaultWidgetBgColor = 0
|
||||||
|
|
||||||
fun getInstance(context: Context): NotesDatabase {
|
fun getInstance(context: Context): NotesDatabase {
|
||||||
|
defaultWidgetBgColor = context.resources.getInteger(R.integer.default_widget_bg_color)
|
||||||
if (db == null) {
|
if (db == null) {
|
||||||
synchronized(NotesDatabase::class) {
|
synchronized(NotesDatabase::class) {
|
||||||
if (db == null) {
|
if (db == null) {
|
||||||
@ -64,7 +65,7 @@ abstract class NotesDatabase : RoomDatabase() {
|
|||||||
private val MIGRATION_1_2 = object : Migration(1, 2) {
|
private val MIGRATION_1_2 = object : Migration(1, 2) {
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(database: SupportSQLiteDatabase) {
|
||||||
database.apply {
|
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")
|
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 |
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 |
@ -96,7 +96,8 @@
|
|||||||
android:id="@+id/config_bg_color"
|
android:id="@+id/config_bg_color"
|
||||||
android:layout_width="@dimen/widget_colorpicker_size"
|
android:layout_width="@dimen/widget_colorpicker_size"
|
||||||
android:layout_height="@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
|
<RelativeLayout
|
||||||
android:id="@+id/config_bg_seekbar_holder"
|
android:id="@+id/config_bg_seekbar_holder"
|
||||||
@ -104,36 +105,40 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_alignTop="@+id/config_bg_color"
|
android:layout_alignTop="@+id/config_bg_color"
|
||||||
android:layout_alignBottom="@+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: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:id="@+id/config_bg_seekbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:paddingStart="@dimen/activity_margin"
|
android:paddingStart="@dimen/activity_margin"
|
||||||
android:paddingEnd="@dimen/activity_margin" />
|
android:paddingEnd="@dimen/activity_margin" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/config_text_color"
|
android:id="@+id/config_text_color"
|
||||||
android:layout_width="@dimen/widget_colorpicker_size"
|
android:layout_width="@dimen/widget_colorpicker_size"
|
||||||
android:layout_height="@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
|
<Button
|
||||||
android:id="@+id/config_save"
|
android:id="@+id/config_save"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignTop="@+id/config_text_color"
|
|
||||||
android:layout_alignBottom="@+id/config_text_color"
|
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:background="@drawable/widget_config_seekbar_background"
|
||||||
android:fontFamily="sans-serif-light"
|
android:fontFamily="sans-serif-light"
|
||||||
android:paddingStart="@dimen/activity_margin"
|
android:paddingStart="@dimen/activity_margin"
|
||||||
android:paddingEnd="@dimen/activity_margin"
|
android:paddingEnd="@dimen/activity_margin"
|
||||||
android:text="@string/ok"
|
android:text="@string/ok"
|
||||||
android:textColor="@android:color/white"
|
android:textColor="@color/dark_grey"
|
||||||
|
android:textFontWeight="400"
|
||||||
android:textSize="@dimen/big_text_size" />
|
android:textSize="@dimen/big_text_size" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user