New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kotlin and a bunch of other stuff #95
Conversation
Note: the android studio kotlin plugin will work much better if you update gradle (#92) |
Add a switch to toggle between sun and custom, not yet functional.
…s stupid. Automatic conversion also automatically stages the file, making it impossible to for me to separate changes I made before converting (which were going to be in a separate commit) and the conversion itself. Thanks, Obama.
@raatmarien I just did a fair amount of reorganization, both UI and code. On the UI side, I moved the automatic toggle prefs into their own sub-category, and made automatic toggle on/off is now styled the same as secure suspend. On the code side, automatic toggle prefs are now their own fragment. Secure suspend is its own fragment, too. I'm going to strip things out of the main activity until it's just a shell which coordinates swapping between fragments (at this point, the only thing left is to change the switch back to a fab, that lives in the filter fragment. I've also moved a bunch of code that lived in custom preferences into the fragments. The automatic suspend fragment uses more xml now and we re-use the xml for on/off in the Time Toggle fragment. The motivation for these changes was that a lot of places had to call back to a parent activity or fragment -- that dependency meant they weren't really independent to be moved around at will. At that point, they're just adding a lot of boilerplate code, which was an added burden to understand. There was also a little bit of duplicate code. My goal is to reduce the number of references that different parts of the application have to keep to each other. Not yet implemented: [moved into top comment] |
Add location updating, but it always fails.
@raatmarien I added eventbus. For now, I just replaced onSettingsChangedListener, because that was the easiest to implement, even though there wasn't much of a gain from doing so (the real gain is that I think eventbus will simplify dealing with state in ScreenFilterPresenter). |
Thanks for all the work you're doing on this! Eventbus does look nice. Do you think it would be best for me to wait with testing/reviewing this until later, since it is a WIP, or would it be best to try and give some input now? |
@raatmarien Does the Can it be removed? |
Hmm, the static method toggleAndFinish is used by the TileService here, but I don't think any of the other parts are needed anymore. |
@raatmarien I'm sure there are bugs I haven't found yet, but I've fixed all the known regressions from the current state, so I'll consider this MR complete. There's been quite a few major refactorings (ScreenFilterService, ScreenFilterPresenter, LocationUpdateService, and FilterFragment are the biggest ones), so let me know if there's anything you want me to walk you through or changes I should make before you're comfortable merging. |
I should probably do testing on a variety of api levels. So far I've only tested on 23 (Galaxy s6) and 24 (emulated nexus 5). |
@raatmarien Did some more testing, have fixed all the regressions I've been able to find. What should I do to get this merged (aside from, wait for you to have time)? |
The 'Visit project page' menu item also opened a new email, it now only opens the project page.
When the TimeToggleActivity or SecureSuspendActivity where closed with the arrow in the action bar, the wrong animation would display, making it seem that the main activity was opened over the subactivity. Now the close activity animation is displayed, so it looks like you are returning to the main activity (which you are, the subactivities aren't kept 'under' the main activity). To get android to display this animation correctly I used a sort of a workaround, overriding the functionality of the arrow in the action bar with calling finish() on the activity. I'm not aware of any other way to do this, so I think this should do fine.
The app now asks for access to coarse location when the 'Times from location' switch is enabled and it doesn't have the permission, instead of silently failing.
The maybeInitializedSwitch thing may be an ugly hack, but I don't know enough about Kotlin to find out the correct way. As far as I know it is null save and will only change it if the switch is already set up.
@smichel17 I finally got the time to take a look and I'm really impressed. The UX and UI feel very polished, great work on this PR 👍 ! I've added a few commits to fix some of the rough edges I encountered, but I think this is rock solid overall and definitely ready to be merged! Thanks a lot for all these contributions you make to Red Moon! |
I've sent you a collaborator invite for this repo, so you can push directly to master or another branch and tag/close issues if you want, since you have been a great contributor to Red Moon 😄 About releasing a new update of Red Moon: I was thinking that we could release 3.0.0 with these changes and everything that is on master right now. The only think I want to fix before that is using PRECISE_LOCATION instead of COARSE_LOCATION to (hopefully) fix #102, #107 and similar issues. Do you have any ideas of what more should be done before releasing the update? |
I missed this reply, oops!
Thank you, it's very helpful!
I fixed up a bunch of other little things. Otherwise, seems good to me. |
This is the continuation of #88. It fixes some or all of #36, #70, #88, #90, #94.
This has become a really big PR, but it should be clear what I've changed if you look at it commit by commit (with the exception of ed27961, because android studio added the new kotlin files to git without asking).
TODO:
openScreenFilter()
andcloseScreenFilter()
into ScreenFilterView. I just want to get this merged, though, so I'll do the easy/brittle fix for now.Not going to do these now: