From 2d82586b96593b1b3b5280d77d5ae9a09df9d1fd Mon Sep 17 00:00:00 2001 From: Deepanshu Gupta Date: Mon, 14 Oct 2013 18:14:58 -0700 Subject: Fix CalendarView to show the right labels. [DO NOT MERGE] Change-Id: I95431f1054678d4192bd1621c1f69b29268f55e9 (cherry picked from commit 44bcd64e5b9fd211dd56b0598693a0559f65dc1a) --- .../src/android/text/format/Time_Delegate.java | 61 ++++++++++++++++++++++ .../android/tools/layoutlib/create/CreateInfo.java | 1 + 2 files changed, 62 insertions(+) create mode 100644 tools/layoutlib/bridge/src/android/text/format/Time_Delegate.java (limited to 'tools') diff --git a/tools/layoutlib/bridge/src/android/text/format/Time_Delegate.java b/tools/layoutlib/bridge/src/android/text/format/Time_Delegate.java new file mode 100644 index 0000000..15cd687 --- /dev/null +++ b/tools/layoutlib/bridge/src/android/text/format/Time_Delegate.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.text.format; + +import java.util.Calendar; +import java.util.UnknownFormatConversionException; +import java.util.regex.Pattern; + +import com.android.ide.common.rendering.api.LayoutLog; +import com.android.layoutlib.bridge.Bridge; +import com.android.tools.layoutlib.annotations.LayoutlibDelegate; + +/** + * Delegate used to provide new implementation for native methods of {@link Time} + * + * Through the layoutlib_create tool, some native methods of Time have been replaced by calls to + * methods of the same name in this delegate class. + */ +public class Time_Delegate { + + // Regex to match odd number of '%'. + private static final Pattern p = Pattern.compile("(?