FileDocCategorySizeDatePackage
TwilightState.javaAPI DocAndroid 5.1 API3424Thu Mar 12 22:22:42 GMT 2015com.android.server.twilight

TwilightState

public class TwilightState extends Object
Describes whether it is day or night. This object is immutable.

Fields Summary
private final boolean
mIsNight
private final long
mYesterdaySunset
private final long
mTodaySunrise
private final long
mTodaySunset
private final long
mTomorrowSunrise
Constructors Summary
TwilightState(boolean isNight, long yesterdaySunset, long todaySunrise, long todaySunset, long tomorrowSunrise)

        mIsNight = isNight;
        mYesterdaySunset = yesterdaySunset;
        mTodaySunrise = todaySunrise;
        mTodaySunset = todaySunset;
        mTomorrowSunrise = tomorrowSunrise;
    
Methods Summary
public booleanequals(java.lang.Object o)

        return o instanceof TwilightState && equals((TwilightState)o);
    
public booleanequals(com.android.server.twilight.TwilightState other)

        return other != null
                && mIsNight == other.mIsNight
                && mYesterdaySunset == other.mYesterdaySunset
                && mTodaySunrise == other.mTodaySunrise
                && mTodaySunset == other.mTodaySunset
                && mTomorrowSunrise == other.mTomorrowSunrise;
    
public longgetTodaySunrise()
Returns the time of today's sunrise in the System.currentTimeMillis() timebase, or -1 if the sun never rises.

        return mTodaySunrise;
    
public longgetTodaySunset()
Returns the time of today's sunset in the System.currentTimeMillis() timebase, or -1 if the sun never sets.

        return mTodaySunset;
    
public longgetTomorrowSunrise()
Returns the time of tomorrow's sunrise in the System.currentTimeMillis() timebase, or -1 if the sun never rises.

        return mTomorrowSunrise;
    
public longgetYesterdaySunset()
Returns the time of yesterday's sunset in the System.currentTimeMillis() timebase, or -1 if the sun never sets.

        return mYesterdaySunset;
    
public inthashCode()

        return 0; // don't care
    
public booleanisNight()
Returns true if it is currently night time.

        return mIsNight;
    
public java.lang.StringtoString()

        DateFormat f = DateFormat.getDateTimeInstance();
        return "{TwilightState: isNight=" + mIsNight
                + ", mYesterdaySunset=" + f.format(new Date(mYesterdaySunset))
                + ", mTodaySunrise=" + f.format(new Date(mTodaySunrise))
                + ", mTodaySunset=" + f.format(new Date(mTodaySunset))
                + ", mTomorrowSunrise=" + f.format(new Date(mTomorrowSunrise))
                + "}";