couple improvements to widgets and intent handling

This commit is contained in:
tibbi
2018-11-07 23:46:17 +01:00
parent a6b9cbba9b
commit 742fe5d842
8 changed files with 36 additions and 35 deletions

View File

@ -18,7 +18,7 @@ class NotesPagerAdapter(fm: FragmentManager, val notes: List<Note>, val activity
override fun getItem(position: Int): NoteFragment {
val bundle = Bundle()
val id = notes[position].id
bundle.putInt(NOTE_ID, id!!.toInt())
bundle.putLong(NOTE_ID, id!!)
if (fragments.containsKey(position)) {
return fragments[position]!!

View File

@ -22,7 +22,7 @@ class WidgetAdapter(val context: Context, val intent: Intent) : RemoteViewsServi
private var widgetTextColor = context.config.widgetTextColor
override fun getViewAt(position: Int): RemoteViews {
val noteId = intent.getIntExtra(NOTE_ID, 1)
val noteId = intent.getLongExtra(NOTE_ID, 0L)
val views = RemoteViews(context.packageName, R.layout.widget_text_layout).apply {
val note = context.notesDB.getNoteWithId(noteId)
if (note != null) {