Merge "Move WallTime out of ZoneInfoData" am: 65d1fda8f6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1490736 Change-Id: I95f99bbb58d8b25f9ce24be92669ba2916f6d70c
This commit is contained in:
@@ -18,6 +18,7 @@ package android.text.format;
|
|||||||
|
|
||||||
import android.util.TimeFormatException;
|
import android.util.TimeFormatException;
|
||||||
|
|
||||||
|
import com.android.i18n.timezone.WallTime;
|
||||||
import com.android.i18n.timezone.ZoneInfoData;
|
import com.android.i18n.timezone.ZoneInfoData;
|
||||||
import com.android.i18n.timezone.ZoneInfoDb;
|
import com.android.i18n.timezone.ZoneInfoDb;
|
||||||
|
|
||||||
@@ -1070,7 +1071,7 @@ public class Time {
|
|||||||
* to the enclosing object, but others do not: thus separate state is retained.
|
* to the enclosing object, but others do not: thus separate state is retained.
|
||||||
*/
|
*/
|
||||||
private static class TimeCalculator {
|
private static class TimeCalculator {
|
||||||
public final ZoneInfoData.WallTime wallTime;
|
public final WallTime wallTime;
|
||||||
public String timezone;
|
public String timezone;
|
||||||
|
|
||||||
// Information about the current timezone.
|
// Information about the current timezone.
|
||||||
@@ -1078,7 +1079,7 @@ public class Time {
|
|||||||
|
|
||||||
public TimeCalculator(String timezoneId) {
|
public TimeCalculator(String timezoneId) {
|
||||||
this.mZoneInfoData = lookupZoneInfoData(timezoneId);
|
this.mZoneInfoData = lookupZoneInfoData(timezoneId);
|
||||||
this.wallTime = new ZoneInfoData.WallTime();
|
this.wallTime = new WallTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
public long toMillis(boolean ignoreDst) {
|
public long toMillis(boolean ignoreDst) {
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import android.content.res.Resources;
|
|||||||
import android.icu.text.DateFormatSymbols;
|
import android.icu.text.DateFormatSymbols;
|
||||||
import android.icu.text.DecimalFormatSymbols;
|
import android.icu.text.DecimalFormatSymbols;
|
||||||
|
|
||||||
|
import com.android.i18n.timezone.WallTime;
|
||||||
import com.android.i18n.timezone.ZoneInfoData;
|
import com.android.i18n.timezone.ZoneInfoData;
|
||||||
|
|
||||||
import java.nio.CharBuffer;
|
import java.nio.CharBuffer;
|
||||||
@@ -149,7 +150,7 @@ class TimeFormatter {
|
|||||||
/**
|
/**
|
||||||
* Format the specified {@code wallTime} using {@code pattern}. The output is returned.
|
* Format the specified {@code wallTime} using {@code pattern}. The output is returned.
|
||||||
*/
|
*/
|
||||||
public String format(String pattern, ZoneInfoData.WallTime wallTime,
|
public String format(String pattern, WallTime wallTime,
|
||||||
ZoneInfoData zoneInfoData) {
|
ZoneInfoData zoneInfoData) {
|
||||||
try {
|
try {
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
@@ -192,7 +193,7 @@ class TimeFormatter {
|
|||||||
* Format the specified {@code wallTime} using {@code pattern}. The output is written to
|
* Format the specified {@code wallTime} using {@code pattern}. The output is written to
|
||||||
* {@link #outputBuilder}.
|
* {@link #outputBuilder}.
|
||||||
*/
|
*/
|
||||||
private void formatInternal(String pattern, ZoneInfoData.WallTime wallTime,
|
private void formatInternal(String pattern, WallTime wallTime,
|
||||||
ZoneInfoData zoneInfoData) {
|
ZoneInfoData zoneInfoData) {
|
||||||
CharBuffer formatBuffer = CharBuffer.wrap(pattern);
|
CharBuffer formatBuffer = CharBuffer.wrap(pattern);
|
||||||
while (formatBuffer.remaining() > 0) {
|
while (formatBuffer.remaining() > 0) {
|
||||||
@@ -208,7 +209,7 @@ class TimeFormatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean handleToken(CharBuffer formatBuffer, ZoneInfoData.WallTime wallTime,
|
private boolean handleToken(CharBuffer formatBuffer, WallTime wallTime,
|
||||||
ZoneInfoData zoneInfoData) {
|
ZoneInfoData zoneInfoData) {
|
||||||
|
|
||||||
// The char at formatBuffer.position() is expected to be '%' at this point.
|
// The char at formatBuffer.position() is expected to be '%' at this point.
|
||||||
|
|||||||
Reference in New Issue
Block a user