Android Open Source - Webby Duration






From Project

Back to project page Webby.

License

The source code is released under:

MIT License

If you think the Android project Webby listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.swampmobile.webby.util.time;
/*from  www. j  a  v a2s  . c o  m*/
public enum Duration 
{
    IMMEDIATELY(0),
  ONE_MINUTE(60 * 1000),
  ONE_HOUR(60 * 60 * 1000),
  ONE_DAY(24 * 60 * 60 * 1000),
  ONE_WEEK(7 * 24 * 60 * 60 * 1000),
  ETERNITY(-1);
  
  private long span;
  
  private Duration(long span)
  {
    this.span = span;
  }

    public long getValue() { return span; }
  
  /**
   * Is this duration exceeded by the difference between time1 and time2 (order is irrelevant).
   * 
   * @param time1 is either a start or end timestamp for a range of time
   * @param time2 is the timestamp for the other end of the range of time referenced by time1
   * @return
   */
  public boolean isExceeded(long time1, long time2)
  {
    if(span < 0)
      return false; // <- eternity
    else
      return Math.abs(time2 - time1) > span;
  }
}




Java Source Code List

com.swampmobile.webby.WebbyManager.java
com.swampmobile.webby.Webby.java
com.swampmobile.webby.examples.activities.MainActivity.java
com.swampmobile.webby.examples.activities.WebbyActivity.java
com.swampmobile.webby.examples.activities.WebbyFragmentActivity.java
com.swampmobile.webby.examples.apis.FeedzillaApi.java
com.swampmobile.webby.examples.fragments.WebbyFragment.java
com.swampmobile.webby.examples.requests.TestWebbyRequest.java
com.swampmobile.webby.requests.WebbyRequest.java
com.swampmobile.webby.requests.WebbyResponse.java
com.swampmobile.webby.services.WebbyService.java
com.swampmobile.webby.util.cache.DataCache.java
com.swampmobile.webby.util.cache.FlatFileDataCache.java
com.swampmobile.webby.util.logging.WebbyLog.java
com.swampmobile.webby.util.time.Duration.java