-
Notifications
You must be signed in to change notification settings - Fork 73
[MRG] Add reset settings option. #300
base: master
Are you sure you want to change the base?
[MRG] Add reset settings option. #300
Conversation
skunkworks_crow/src/main/java/org/odk/share/views/ui/settings/SettingsActivity.java
Outdated
Show resolved
Hide resolved
skunkworks_crow/src/main/java/org/odk/share/views/ui/settings/SettingsActivity.java
Outdated
Show resolved
Hide resolved
skunkworks_crow/src/main/java/org/odk/share/views/ui/settings/SettingsActivity.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good to me, there are few string resources which needs improvements, please fix those.
@huangyz0918 I've tested this and it looks like whenever I clear the |
In the code you can see I just deleted all the files in share folder and create a new folder. The share related databases should be reset successfully. According to you comment, do you mean we should also clear the odk folder? |
No, skunkworks-crow should not delete any of the things present in ODK folder. I'm testing it again, it could be some problem at my end because I took a pull from master in your branch while testing because bluetooth was not working. |
There seems to be some issue with InMemory map that we've related to forms information.
I checked the tables and db are deleted. |
So it seems we should clear the cache in memory after resetting the forms? @lakshyagupta21 |
Hmm, or lets reset the state of variables in onResume, anyways we're not doing any high memory usage operation in MainActivity. |
Sure, let me have a try. |
@lakshyagupta21 How about restarting the application after resetting the application? Restart code like Intent mainIntent = new Intent(this, MainActivity.class);
int mPendingIntentId = 0x130;
PendingIntent mPendingIntent = PendingIntent.getActivity(this, mPendingIntentId, mainIntent, PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager mgr = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 100, mPendingIntent);
System.exit(0); I updated the PR, and did some tests, after a restart we can get the right behavior. |
@huangyz0918 , Restarting the application is not the solution we've to modify the code in MainActivity, this could be a solution in the short term but it's not going to help us in the long term. |
I think a quick restart looks like exiting and starting |
I would still not advice you to write code for app restart, if this was a solution then it would be there in ODK-Collect right? There are some consequences that we should take care when we're thinking in the direction of restarting the app, for high-end device this could be fast but for low-end devices restarting the app may take some time because that would take some time to load resources, activity, creating the storage directory(in our case its not required but in future we may have some use case) |
@huangyz0918 While testing this PR, I was able to see the crash in Android 4.4
|
It seems we missed a |
@huangyz0918 Can you fix the above issue in the same PR. |
Yes will do. |
Closes #299
What has been done to verify that this works as intended?
Test using my Nexus 6P
Screenshots,
Why is this the best possible solution? Were any other approaches considered?
I only reset the settings, reset related to forms can be done by Collect, so we don't need to build a duplicate feature.
Note, the arrange of preference items will be improved by #290 , that includes some groups.
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
N/A
Before submitting this PR, please make sure you have:
./gradlew checkCode
and confirmed all checks still pass OR confirm CircleCI build passes