Android Open Source - Google-IO-Countdown-for-Android Counter






From Project

Back to project page Google-IO-Countdown-for-Android.

License

The source code is released under:

GNU General Public License

If you think the Android project Google-IO-Countdown-for-Android 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.javiersantos.googleiocountdown;
//ww  w .  j  a v  a  2 s .  c  o  m
import android.text.format.Time;

public class Counter {
  
  private long intervalMillis;

    public Counter(int second, int minute, int hour, int monthDay, int month, int year) {

        Time futureTime = new Time();

        // Set date to future time
        futureTime.set(second, minute, hour, monthDay, month, year);
        futureTime.normalize(true);
        long futureMillis = futureTime.toMillis(true);

        Time timeNow = new Time();

        // Set date to current time
        timeNow.setToNow();
        timeNow.normalize(true);
        long nowMillis = timeNow.toMillis(true);

        // Subtract current milliseconds time from future milliseconds time to retrieve interval
        intervalMillis = futureMillis - nowMillis;
    }

    public long getIntervalMillis() {
        return intervalMillis;
    }

}




Java Source Code List

com.javiersantos.googleiocountdown.Counter.java
com.javiersantos.googleiocountdown.MainActivity.java
com.javiersantos.googleiocountdown.RobotoFontLight.java
com.javiersantos.googleiocountdown.RobotoFont.java
com.javiersantos.googleiocountdown.WidgetDate.java
com.javiersantos.googleiocountdown.adapter.AboutFragment.java
com.javiersantos.googleiocountdown.adapter.HomeFragment.java
com.javiersantos.googleiocountdown.adapter.LiveFragment.java
com.javiersantos.googleiocountdown.adapter.TabsPagerAdapter.java