From a24d3223a6cb005fbedd959ae30005d9a5b3c272 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Wed, 16 Aug 2023 13:32:53 +0200 Subject: [PATCH] Fix crash when restoring state on TextFragment `onViewStateRestored()` in TextFragment crashed with `ClassCastException`, because layout has `MyEditText` with id `text_note_view` and not `MyTextView`. This has now been changed to `TextView` to ensure less breaking in the future and since only `text` was changed, this is enough. This happened when viewing notes and causing configuration change or something else that would cause the state to be restored. --- .../com/simplemobiletools/notes/pro/fragments/TextFragment.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments/TextFragment.kt b/app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments/TextFragment.kt index 16b4faab..ff142fbb 100644 --- a/app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments/TextFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments/TextFragment.kt @@ -131,7 +131,7 @@ class TextFragment : NoteFragment() { if (savedInstanceState != null && note != null && savedInstanceState.containsKey(TEXT)) { skipTextUpdating = true val newText = savedInstanceState.getString(TEXT) ?: "" - innerBinding.root.findViewById(R.id.text_note_view).text = newText + innerBinding.root.findViewById(R.id.text_note_view).text = newText } }