Search in sources :

Example 81 with Time

use of android.text.format.Time in project android_frameworks_base by ResurrectionRemix.

the class TimeTest method testSet1.

@SmallTest
public void testSet1() throws Exception {
    Time t = new Time(Time.TIMEZONE_UTC);
    t.set(1, 2, 3, 4, 5, 6);
// System.out.println("t=" + t);
}
Also used : Time(android.text.format.Time) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 82 with Time

use of android.text.format.Time in project android_frameworks_base by ResurrectionRemix.

the class TimeTest method testNormalize0.

@SmallTest
public void testNormalize0() throws Exception {
    Time t = new Time(Time.TIMEZONE_UTC);
    t.parse("20060432T010203");
    t.normalize(false);
//        System.out.println("got: " + t.year + '-'
//                + t.month + '-' + t.monthDay
//                + ' ' + t.hour + ':' + t.minute
//                + ':' + t.second
//                + "( " + t.isDst + ',' + t.gmtoff
//                + ',' + t.weekDay
//                + ',' + t.yearDay + ')');
}
Also used : Time(android.text.format.Time) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 83 with Time

use of android.text.format.Time in project android_frameworks_base by ResurrectionRemix.

the class NetworkPolicyEditor method buildDefaultPolicy.

@Deprecated
private static NetworkPolicy buildDefaultPolicy(NetworkTemplate template) {
    // TODO: move this into framework to share with NetworkPolicyManagerService
    final int cycleDay;
    final String cycleTimezone;
    final boolean metered;
    if (template.getMatchRule() == MATCH_WIFI) {
        cycleDay = CYCLE_NONE;
        cycleTimezone = Time.TIMEZONE_UTC;
        metered = false;
    } else {
        final Time time = new Time();
        time.setToNow();
        cycleDay = time.monthDay;
        cycleTimezone = time.timezone;
        metered = true;
    }
    return new NetworkPolicy(template, cycleDay, cycleTimezone, WARNING_DISABLED, LIMIT_DISABLED, SNOOZE_NEVER, SNOOZE_NEVER, metered, true);
}
Also used : NetworkPolicy(android.net.NetworkPolicy) Time(android.text.format.Time)

Example 84 with Time

use of android.text.format.Time in project android_frameworks_base by ResurrectionRemix.

the class NetworkPolicyManagerServiceTest method formatTime.

private static String formatTime(long millis) {
    final Time time = new Time(Time.TIMEZONE_UTC);
    time.set(millis);
    return time.format3339(false);
}
Also used : Time(android.text.format.Time) TrustedTime(android.util.TrustedTime)

Example 85 with Time

use of android.text.format.Time in project android_frameworks_base by ResurrectionRemix.

the class NetworkPolicyManagerServiceTest method parseTime.

private static long parseTime(String time) {
    final Time result = new Time();
    result.parse3339(time);
    return result.toMillis(true);
}
Also used : Time(android.text.format.Time) TrustedTime(android.util.TrustedTime)

Aggregations

Time (android.text.format.Time)395 SmallTest (android.test.suitebuilder.annotation.SmallTest)97 Test (org.junit.Test)25 ArrayList (java.util.ArrayList)23 Date (java.util.Date)21 NetworkPolicy (android.net.NetworkPolicy)16 TrustedTime (android.util.TrustedTime)16 TextView (android.widget.TextView)15 Bundle (android.os.Bundle)13 TimeFormatException (android.util.TimeFormatException)13 Suppress (android.test.suitebuilder.annotation.Suppress)12 View (android.view.View)12 Paint (android.graphics.Paint)11 IOException (java.io.IOException)11 Matcher (java.util.regex.Matcher)9 IntentFilter (android.content.IntentFilter)7 File (java.io.File)7 DateFormat (java.text.DateFormat)7 SimpleDateFormat (java.text.SimpleDateFormat)7 ContentValues (android.content.ContentValues)6