Skip to content

Commit 4355a79

Browse files
committed
fix #200, allow sharing text after device rotating
1 parent 88761e6 commit 4355a79

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

app/src/main/kotlin/com/simplemobiletools/notes/adapters/NotesPagerAdapter.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ class NotesPagerAdapter(fm: FragmentManager, val notes: List<Note>, val activity
2020
val id = notes[position].id
2121
bundle.putInt(NOTE_ID, id)
2222

23-
if (fragments.containsKey(position))
23+
if (fragments.containsKey(position)) {
2424
return fragments[position]!!
25+
}
2526

2627
val fragment = NoteFragment()
2728
fragment.arguments = bundle
@@ -53,4 +54,10 @@ class NotesPagerAdapter(fm: FragmentManager, val notes: List<Note>, val activity
5354
super.destroyItem(container, position, `object`)
5455
fragments.remove(position)
5556
}
57+
58+
override fun instantiateItem(container: ViewGroup, position: Int): Any {
59+
val fragment = super.instantiateItem(container, position) as NoteFragment
60+
fragments[position] = fragment
61+
return fragment
62+
}
5663
}

0 commit comments

Comments
 (0)