mpcjanssen / simpletask-android

GNU General Public License v3.0
546 stars 125 forks source link

Data loss errors #1216

Open Chou95 opened 1 year ago

Chou95 commented 1 year ago

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

smichel17 commented 1 year ago

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.

Chou95 commented 1 year ago

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:

https://user-images.githubusercontent.com/111506060/215381042-4a530c13-d4f1-42f1-bbd4-365143cd5a93.mp4

smichel17 commented 1 year ago

My phone is still on Android 7.0 :sweat_smile:

mpcjanssen commented 1 year ago

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.