Commit 76e4506
committed
Fix bug where the switch wasn't set correctly
I don't know if this bug occurs on any other devices, but on my Nexus
5X the switch in the app bar is set incorrectly after the following
steps:
1. Open Red Moon
2. Start the filter
3. Use the home button to exit Red Moon
4. Stop the filter through the notification
5. Reopen Red Moon through the launcher
After these steps the switch in the activity is still on for me,
although the filter is off.
To fix this, I've added an attempt to set the switch correctly on the
Resume event. Since the Switch may not be initialized (if the app is
opened after closing completely), we have to catch the
NotInitializedException. As far as I've found, there is no other way to
check if a lateinit variable is initialized in Kotlin.
This fix may be a bit crude, but I don't think it does any harm, and it
does fix the bug at least on my phone.1 parent 9462134 commit 76e4506
File tree
1 file changed
+18
-0
lines changed- app/src/main/java/com/jmstudios/redmoon/activity
1 file changed
+18
-0
lines changedLines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
115 | 133 | | |
116 | 134 | | |
117 | 135 | | |
| |||
0 commit comments