diff options
| author | 2014-04-04 02:01:45 +0000 | |
|---|---|---|
| committer | 2014-04-04 02:01:45 +0000 | |
| commit | ce393373b73e1a1f30ce9bb41568d415cab7df49 (patch) | |
| tree | a12481a58b9ab94d244e3a7277546fca5ec6aa41 | |
| parent | 99939cce702b6b5a01be351f1a0b406a16509103 (diff) | |
| parent | ef9f3043f5259fa55376a1522152779295e15da6 (diff) | |
am ef9f3043: am 3bc5b23f: Merge "Fix layoutlib [DO NOT MERGE]" into jb-mr2-dev
* commit 'ef9f3043f5259fa55376a1522152779295e15da6':
Fix layoutlib [DO NOT MERGE]
| -rw-r--r-- | tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java | 21 | ||||
| -rw-r--r-- | tools/layoutlib/bridge/src/libcore/icu/ICU_Delegate.java | 5 |
2 files changed, 19 insertions, 7 deletions
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java index 87047b34371e..23d08e343bdb 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java @@ -248,11 +248,16 @@ public abstract class RenderAction<T extends RenderParams> extends FrameworkReso * The counterpart is {@link #setUp()}. */ private void tearDown() { - // Make sure to remove static references, otherwise we could not unload the lib - mContext.disposeResources(); + // The context may be null, if there was an error during init(). + if (mContext != null) { + // Make sure to remove static references, otherwise we could not unload the lib + mContext.disposeResources(); + } - // quit HandlerThread created during this session. - HandlerThread_Delegate.cleanUp(sCurrentContext); + if (sCurrentContext != null) { + // quit HandlerThread created during this session. + HandlerThread_Delegate.cleanUp(sCurrentContext); + } // clear the stored ViewConfiguration since the map is per density and not per context. ViewConfiguration_Accessor.clearConfigurations(); @@ -263,8 +268,12 @@ public abstract class RenderAction<T extends RenderParams> extends FrameworkReso sCurrentContext = null; Bridge.setLog(null); - mContext.getRenderResources().setFrameworkResourceIdProvider(null); - mContext.getRenderResources().setLogger(null); + if (mContext != null) { + mContext.getRenderResources().setFrameworkResourceIdProvider(null); + mContext.getRenderResources().setLogger(null); + } + + mContext = null; } public static BridgeContext getCurrentContext() { diff --git a/tools/layoutlib/bridge/src/libcore/icu/ICU_Delegate.java b/tools/layoutlib/bridge/src/libcore/icu/ICU_Delegate.java index 294d743e8cf9..06ae804aa7c6 100644 --- a/tools/layoutlib/bridge/src/libcore/icu/ICU_Delegate.java +++ b/tools/layoutlib/bridge/src/libcore/icu/ICU_Delegate.java @@ -17,6 +17,8 @@ package libcore.icu; import com.android.tools.layoutlib.annotations.LayoutlibDelegate; +import com.ibm.icu.text.DateTimePatternGenerator; +import com.ibm.icu.util.ULocale; import java.util.Locale; @@ -45,7 +47,8 @@ public class ICU_Delegate { @LayoutlibDelegate /*package*/ static String getBestDateTimePattern(String skeleton, String localeName) { - return ""; // TODO: check what the right value should be. + return DateTimePatternGenerator.getInstance(new ULocale(localeName)) + .getBestPattern(skeleton); } @LayoutlibDelegate |