store all added note widgets in a database

This commit is contained in:
tibbi 2018-09-13 16:02:56 +02:00
parent ad3c6aecfd
commit 64953a4e7d
1 changed files with 3 additions and 0 deletions

View File

@ -20,6 +20,7 @@ import com.simplemobiletools.notes.extensions.dbHelper
import com.simplemobiletools.notes.extensions.getTextSize
import com.simplemobiletools.notes.helpers.MyWidgetProvider
import com.simplemobiletools.notes.models.Note
import com.simplemobiletools.notes.models.Widget
import kotlinx.android.synthetic.main.widget_config.*
class WidgetConfigureActivity : SimpleActivity() {
@ -104,6 +105,8 @@ class WidgetConfigureActivity : SimpleActivity() {
val views = RemoteViews(packageName, R.layout.activity_main)
views.setBackgroundColor(R.id.notes_view, mBgColor)
AppWidgetManager.getInstance(this).updateAppWidget(mWidgetId, views)
val widget = Widget(mWidgetId, mCurrentNoteId)
dbHelper.insertWidget(widget)
storeWidgetBackground()
requestWidgetUpdate()