mpcjanssen/simpletask-android

Data loss errors

Chou95 opened this issue · 4 comments

Hi, developers!

general information

the unsaved text will lose after screen rotation, which may reduce user experience (expecially when I have entried lots of text). However, I think that screen rotation shouldn't do damange to the UI state. The re-created UI should be the same as before rotation, Right?

I think it is not hard to save the editable text to Bundle in onPause() (or onSaveInstanceState()) before destroy, and then use edittext.setText() to restore the text.

This may improve the user experience, do you think so?

snapshot details

before rotation

NO1-BEFORE

after rotation

NO1-AFTER

So this is odd. I can't reproduce on my phone (Galaxy S6). I'm running a quite old version of Android, though. Maybe the EditText behavior changed between versions and needs to be saved explicitly now?

If you'd like to experiment with fixing it and send a PR, it should be pretty isolated to AddTask.kt. binding.taskText is the EditText element. If you need the XML, it's add_task.xml.

So this is odd. I can't reproduce on my phone (Galaxy S6). I'm running a quite old version of Android, though. Maybe the EditText behavior changed between versions and needs to be saved explicitly now?

If you'd like to experiment with fixing it and send a PR, it should be pretty isolated to AddTask.kt. binding.taskText is the EditText element. If you need the XML, it's add_task.xml.

Thanks for your reply!
The error above comes from (Galaxy S10, android 10). I try it again on my another phone (Mi 10 pro, android 12, video is as follows), and the error still exist! I will try to send a PR if I can fix it successfully when I have time.

video of loss error:

error.video.mp4

My phone is still on Android 7.0 😅

You would think that screen rotation is simple, but being Android of course it's not. Screen rotation within the New task activity is indeed not handled properly.