QuitNow!'s sleeping time

General

Category
Free
Tag
Utils
License
MIT License
Registered
Jan 8, 2016
Favorites
1
Link
https://github.com/Fewlaps/quitnow-sleep-time
See also
Specter
android-utils
java-object-diff
Joda Time
NBNConverter

Additional

Language
Java
Version
v1.0 (Dec 21, 2015)
Created
Dec 21, 2015
Updated
Dec 28, 2017
Owner
Fewlaps
Contributors
rocboronat
EsteveAguilera
2
Activity
Badge
Generate
Download
Source code

Advertising

QuitNow!'s sleeping time

Be sure that your user is awake before disturbing it with soundy and vibrant notifications!

Before this library, QuitNow! and lots of apps were sending notifications when the user was sleeping... and HEY! That makes people angry. So, before setting the sound of that notifications and asking the phone to vibrate arround five minutes, write this lovely line:

new SleepingTime().isSleepingTime();

We've done it using TDD, so it's totally tested. Check the tests! :·)

The sample

SleepingTime st = new SleepingTime(); //By default, it uses the Locale of the phone
st.isSleepingTime(); //It's a bad moment to do noise?
st.getBedtime(); //The average bedtime of the user's country, based in its Locale
st.getWakeUp(); //The average wake up of the user's country, based in its Locale

new SleepingTime("es")).isSleepingTime(); //You can also force a country code

Download

repositories { jcenter() }
    
compile 'com.fewlaps.quitnowsleepingtime:quitnow-sleeping-time:1.0.0'
  • Grab via Maven:
<repository>
  <id>jcenter</id>
  <url>http://jcenter.bintray.com</url>
</repository>

<dependency>
    <groupId>com.fewlaps.quitnowsleepingtime</groupId>
    <artifactId>quitnow-sleeping-time</artifactId>
    <version>1.0.0</version>
</dependency>

LICENSE

The MIT License (MIT)

Copyright (c) 2015 Fewlaps

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.