Add root listener source
Red Moon is a simple screen filter app for night time phone use. It helps you sleep healthier by filtering out blue light, which can disrupt your sleep cycle (circadian rhythm). And when your phone's lowest brightness isn't low enough, Red Moon protects your eyes by making your screen even darker.
- Use the default filters or create your own, with separate color, intensity and dim settings.
- Automatically turn Red Moon on while the sun is down, or set custom times.
- Switch between filters right in the notification, without leaving the app you're using.
- Turn Red Moon on and off without opening the app using:
- A widget or a shortcut on your home screen.
- A quick settings tile, like WiFi or Airplane mode (Android 7.0+).
- The notification (if Red Moon is on, or was recently on).
All help is welcome! Code is great and saves us work, but sometimes a comment that clarifies a design issue or a link to the relevant part of some documentation is just as helpful (and often more efficient, since you don't need to familiarize yourself with Red Moon's code base).
Bugs, feedback, and ideas
planned: The most important issues.
help wanted: These would be
planned, but there's a question or problem that we're stuck on. We'd love help getting un-stuck!
someday/maybe: Worth adding, but not that important.
Weblate is the easiest way for most people. You can work in your browser instead of crawling through text files, and your translations will be automatically be merged into this repository. If you'd prefer to make a pull request, that's fine too, but if you're also changing code, please keep that in a separate PR.
Trust your judgement! If there is a loose translation that you think is simpler and clearer than the literal translation, go for it. We'll try not to use strings in multiple places, even if the English word could be reused.
Bugfixes are very safe PRs (likely to be merged), and a good way to learn the
code base, but often not as exciting as adding something new. Issues tagged
patches welcome are also safe, since they have the design worked out. If
you have something else in mind, open a new issue about it first, especially
if it requires increasing Red Moon's complexity (ie, adding options).
Prioritize legibility over dogmatism. That said, consistency is nice, so here's a short list of what I've been doing.
- Try very hard to stay under 100 characters per line. Try less hard to stay under 80.
- Indent 4 spaces, (exception: 8 spaces for the second line of variable assignments that have to wrap)
- constants are
ALL_CAPS, functions, vals, and short-lived vars are
camelCase, persistent vars are
- Form suggests function: Group and align similar actions, and don't do that for dissimmilar ones, even if you could.
- Good code is (mostly) self-documenting. If you're commenting frequently, consider:
- Refactoring into smaller functions with descriptive names
- Converting comments to logs. Code confusing enough to require comments will probably require good logs to debug, and debug output that includes variable contents forces you to keep it up to date.
- Always use brackets with
if, with one exception: one-liners with an
x = if (p) q else r)
- note: I (@smichel17) used to prefer omitting parenthesis from one-liners; some code still uses that style.
Again, prioritize legibility over dogmatism.
To build the app on GNU+Linux, clone the repository and run
in the root directory.
to install the app on a connected device or running emulator.
"Red Moon" is a derivative of "Shades" by Chris Nguyen used under the MIT License. "Red Moon" is licensed under the GNU General Public License version 3, or (at your option) any later version by the contributors.
All used artwork is released into the public domain. Some of the icons use cliparts from openclipart.org, which are all released in the public domain, namely:
* Google Play and the Google Play logo are trademarks of Google Inc.