Skip to content

Commit 236ae3a

Browse files
committed
adding some widget config related improvements
1 parent 216b346 commit 236ae3a

File tree

7 files changed

+22
-14
lines changed

7 files changed

+22
-14
lines changed

app/src/main/kotlin/com/simplemobiletools/notes/pro/activities/WidgetConfigureActivity.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ class WidgetConfigureActivity : SimpleActivity() {
5959
config_bg_color.setOnClickListener { pickBackgroundColor() }
6060
config_text_color.setOnClickListener { pickTextColor() }
6161
notes_picker_value.setOnClickListener { showNoteSelector() }
62+
63+
val primaryColor = getProperPrimaryColor()
64+
config_bg_seekbar.setColors(mTextColor, primaryColor, primaryColor)
6265
notes_picker_holder.background = ColorDrawable(getProperBackgroundColor())
66+
6367
show_note_title_holder.setOnClickListener {
6468
show_note_title.toggle()
6569
handleNoteTitleDisplay()
@@ -229,17 +233,15 @@ class WidgetConfigureActivity : SimpleActivity() {
229233
mBgColor = mBgColorWithoutTransparency.adjustAlpha(mBgAlpha)
230234
text_note_view.setBackgroundColor(mBgColor)
231235
checklist_note_view.setBackgroundColor(mBgColor)
232-
config_save.setBackgroundColor(mBgColor)
233236
text_note_view_title.setBackgroundColor(mBgColor)
234-
config_bg_color.setFillWithStroke(mBgColor, Color.BLACK)
237+
config_bg_color.setFillWithStroke(mBgColor, mBgColor)
235238
}
236239

237240
private fun updateTextColor() {
238-
config_save.setTextColor(mTextColor)
239241
text_note_view.setTextColor(mTextColor)
240242
text_note_view_title.setTextColor(mTextColor)
241243
(checklist_note_view.adapter as? ChecklistAdapter)?.updateTextColor(mTextColor)
242-
config_text_color.setFillWithStroke(mTextColor, Color.BLACK)
244+
config_text_color.setFillWithStroke(mTextColor, mTextColor)
243245
}
244246

245247
private fun pickBackgroundColor() {

app/src/main/kotlin/com/simplemobiletools/notes/pro/databases/NotesDatabase.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import androidx.room.Room
66
import androidx.room.RoomDatabase
77
import androidx.room.migration.Migration
88
import androidx.sqlite.db.SupportSQLiteDatabase
9-
import com.simplemobiletools.commons.helpers.DEFAULT_WIDGET_BG_COLOR
109
import com.simplemobiletools.commons.helpers.PROTECTION_NONE
1110
import com.simplemobiletools.notes.pro.R
1211
import com.simplemobiletools.notes.pro.helpers.DEFAULT_WIDGET_TEXT_COLOR
@@ -26,8 +25,10 @@ abstract class NotesDatabase : RoomDatabase() {
2625

2726
companion object {
2827
private var db: NotesDatabase? = null
28+
private var defaultWidgetBgColor = 0
2929

3030
fun getInstance(context: Context): NotesDatabase {
31+
defaultWidgetBgColor = context.resources.getInteger(R.integer.default_widget_bg_color)
3132
if (db == null) {
3233
synchronized(NotesDatabase::class) {
3334
if (db == null) {
@@ -64,7 +65,7 @@ abstract class NotesDatabase : RoomDatabase() {
6465
private val MIGRATION_1_2 = object : Migration(1, 2) {
6566
override fun migrate(database: SupportSQLiteDatabase) {
6667
database.apply {
67-
execSQL("ALTER TABLE widgets ADD COLUMN widget_bg_color INTEGER NOT NULL DEFAULT $DEFAULT_WIDGET_BG_COLOR")
68+
execSQL("ALTER TABLE widgets ADD COLUMN widget_bg_color INTEGER NOT NULL DEFAULT $defaultWidgetBgColor")
6869
execSQL("ALTER TABLE widgets ADD COLUMN widget_text_color INTEGER NOT NULL DEFAULT $DEFAULT_WIDGET_TEXT_COLOR")
6970
}
7071
}
-13.8 KB
Binary file not shown.

app/src/main/res/drawable-xxxhdpi/img_widget_preview.png renamed to app/src/main/res/drawable-nodpi/img_widget_preview.png

File renamed without changes.
-12.1 KB
Binary file not shown.
-33.4 KB
Binary file not shown.

app/src/main/res/layout/widget_config.xml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,44 +96,49 @@
9696
android:id="@+id/config_bg_color"
9797
android:layout_width="@dimen/widget_colorpicker_size"
9898
android:layout_height="@dimen/widget_colorpicker_size"
99-
android:layout_above="@+id/config_text_color" />
99+
android:layout_above="@+id/config_text_color"
100+
android:layout_margin="@dimen/tiny_margin" />
100101

101102
<RelativeLayout
102103
android:id="@+id/config_bg_seekbar_holder"
103104
android:layout_width="match_parent"
104105
android:layout_height="match_parent"
105106
android:layout_alignTop="@+id/config_bg_color"
106107
android:layout_alignBottom="@+id/config_bg_color"
108+
android:layout_marginStart="@dimen/medium_margin"
107109
android:layout_toEndOf="@+id/config_bg_color"
108-
android:background="@android:color/white">
110+
android:background="@drawable/widget_config_seekbar_background">
109111

110-
<SeekBar
112+
<com.simplemobiletools.commons.views.MySeekBar
111113
android:id="@+id/config_bg_seekbar"
112114
android:layout_width="match_parent"
113115
android:layout_height="wrap_content"
114116
android:layout_centerVertical="true"
115117
android:paddingStart="@dimen/activity_margin"
116118
android:paddingEnd="@dimen/activity_margin" />
119+
117120
</RelativeLayout>
118121

119122
<ImageView
120123
android:id="@+id/config_text_color"
121124
android:layout_width="@dimen/widget_colorpicker_size"
122125
android:layout_height="@dimen/widget_colorpicker_size"
123-
android:layout_alignParentBottom="true" />
126+
android:layout_alignParentBottom="true"
127+
android:layout_margin="@dimen/tiny_margin" />
124128

125129
<Button
126130
android:id="@+id/config_save"
127131
android:layout_width="wrap_content"
128-
android:layout_height="match_parent"
129-
android:layout_alignTop="@+id/config_text_color"
130-
android:layout_alignBottom="@+id/config_text_color"
132+
android:layout_height="wrap_content"
131133
android:layout_alignParentEnd="true"
134+
android:layout_alignParentBottom="true"
135+
android:background="@drawable/widget_config_seekbar_background"
132136
android:fontFamily="sans-serif-light"
133137
android:paddingStart="@dimen/activity_margin"
134138
android:paddingEnd="@dimen/activity_margin"
135139
android:text="@string/ok"
136-
android:textColor="@android:color/white"
140+
android:textColor="@color/dark_grey"
141+
android:textFontWeight="400"
137142
android:textSize="@dimen/big_text_size" />
138143

139144
</RelativeLayout>

0 commit comments

Comments
 (0)