resolved conflicts for merge of 98b8fe74 to lmp-mr1-dev-plus-aosp

Change-Id: Ic2826f3be8337e72a80978e4565e0884b9ceed70
This commit is contained in:
Narayan Kamath
2014-11-24 16:32:06 +00:00

View File

@@ -156,7 +156,7 @@ public class DateTimeView extends TextView {
format = getTimeFormat(); format = getTimeFormat();
break; break;
case SHOW_MONTH_DAY_YEAR: case SHOW_MONTH_DAY_YEAR:
format = getDateFormat(); format = DateFormat.getDateInstance(DateFormat.SHORT);
break; break;
default: default:
throw new RuntimeException("unknown display value: " + display); throw new RuntimeException("unknown display value: " + display);
@@ -196,21 +196,6 @@ public class DateTimeView extends TextView {
return android.text.format.DateFormat.getTimeFormat(getContext()); return android.text.format.DateFormat.getTimeFormat(getContext());
} }
private DateFormat getDateFormat() {
String format = Settings.System.getString(getContext().getContentResolver(),
Settings.System.DATE_FORMAT);
if (format == null || "".equals(format)) {
return DateFormat.getDateInstance(DateFormat.SHORT);
} else {
try {
return new SimpleDateFormat(format);
} catch (IllegalArgumentException e) {
// If we tried to use a bad format string, fall back to a default.
return DateFormat.getDateInstance(DateFormat.SHORT);
}
}
}
void clearFormatAndUpdate() { void clearFormatAndUpdate() {
mLastFormat = null; mLastFormat = null;
update(); update();
@@ -283,14 +268,10 @@ public class DateTimeView extends TextView {
filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED); filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
filter.addAction(Intent.ACTION_TIMEZONE_CHANGED); filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
context.registerReceiver(mReceiver, filter); context.registerReceiver(mReceiver, filter);
final Uri uri = Settings.System.getUriFor(Settings.System.DATE_FORMAT);
context.getContentResolver().registerContentObserver(uri, true, mObserver);
} }
void unregister(Context context) { void unregister(Context context) {
context.unregisterReceiver(mReceiver); context.unregisterReceiver(mReceiver);
context.getContentResolver().unregisterContentObserver(mObserver);
} }
} }
} }