Loading tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java +21 −4 Original line number Diff line number Diff line Loading @@ -254,6 +254,11 @@ public final class BridgeContext extends Activity { return null; } // needed by SearchView if (INPUT_METHOD_SERVICE.equals(service)) { return null; } throw new UnsupportedOperationException("Unsupported Service: " + service); } Loading Loading @@ -443,7 +448,7 @@ public final class BridgeContext extends Activity { } else { // there is a value in the XML, but we need to resolve it in case it's // referencing another resource or a theme value. ta.bridgeSetValue(index, name, resolveValue(null, name, value)); ta.bridgeSetValue(index, name, resolveValue(null, name, value, isPlatformFile)); } } } Loading Loading @@ -506,21 +511,24 @@ public final class BridgeContext extends Activity { * @param type the type of the resource * @param name the name of the attribute containing this value. * @param value the resource value, or reference to resolve * @param isFrameworkValue whether the value is a framework value. * * @return the resolved resource value or <code>null</code> if it failed to resolve it. */ private ResourceValue resolveValue(String type, String name, String value) { private ResourceValue resolveValue(String type, String name, String value, boolean isFrameworkValue) { if (value == null) { return null; } // get the ResourceValue referenced by this value ResourceValue resValue = findResValue(value, false /*forceFrameworkOnly*/); ResourceValue resValue = findResValue(value, isFrameworkValue); // if resValue is null, but value is not null, this means it was not a reference. // we return the name/value wrapper in a ResourceValue. the isFramework flag doesn't // matter. if (resValue == null) { return new ResourceValue(type, name, value, false /*isFramework*/); return new ResourceValue(type, name, value, isFrameworkValue); } // we resolved a first reference, but we need to make sure this isn't a reference also. Loading Loading @@ -701,6 +709,15 @@ public final class BridgeContext extends Activity { if (item != null) { return item; } // if it was not found and the type is an id, it is possible that the ID was // generated dynamically when compiling the framework resources. // Look for it in the R map. if (BridgeConstants.RES_ID.equals(resType)) { if (Bridge.getResourceValue(resType, resName) != null) { return new ResourceValue(resType, resName, true); } } } // didn't find the resource anywhere. Loading tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/GcSnapshot.java +13 −14 Original line number Diff line number Diff line Loading @@ -393,27 +393,26 @@ public class GcSnapshot { * @param bitmap the bitmap to link to. */ public void setBitmap(Bitmap_Delegate bitmap) { assert mLayers.size() == 0; // create a new Layer for the bitmap. This will be the base layer. Graphics2D graphics2D = bitmap.getImage().createGraphics(); Layer baseLayer = new Layer(graphics2D, bitmap); // add it to the list. mLayers.add(baseLayer); // if transform and clip where modified before, get the information and give it to the // layer. // Set the current transform and clip which can either come from mTransform/mClip if they // were set when there was no bitmap/layers or from the current base layers if there is // one already. if (mTransform != null) { graphics2D.setTransform(mTransform); graphics2D.setTransform(getTransform()); // reset mTransform in case there was one. mTransform = null; } if (mClip != null) { baseLayer.setClip(mClip); baseLayer.setClip(getClip()); // reset mClip in case there was one. mClip = null; } // replace whatever current layers we have with this. mLayers.clear(); mLayers.add(baseLayer); } public void translate(float dx, float dy) { Loading Loading
tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java +21 −4 Original line number Diff line number Diff line Loading @@ -254,6 +254,11 @@ public final class BridgeContext extends Activity { return null; } // needed by SearchView if (INPUT_METHOD_SERVICE.equals(service)) { return null; } throw new UnsupportedOperationException("Unsupported Service: " + service); } Loading Loading @@ -443,7 +448,7 @@ public final class BridgeContext extends Activity { } else { // there is a value in the XML, but we need to resolve it in case it's // referencing another resource or a theme value. ta.bridgeSetValue(index, name, resolveValue(null, name, value)); ta.bridgeSetValue(index, name, resolveValue(null, name, value, isPlatformFile)); } } } Loading Loading @@ -506,21 +511,24 @@ public final class BridgeContext extends Activity { * @param type the type of the resource * @param name the name of the attribute containing this value. * @param value the resource value, or reference to resolve * @param isFrameworkValue whether the value is a framework value. * * @return the resolved resource value or <code>null</code> if it failed to resolve it. */ private ResourceValue resolveValue(String type, String name, String value) { private ResourceValue resolveValue(String type, String name, String value, boolean isFrameworkValue) { if (value == null) { return null; } // get the ResourceValue referenced by this value ResourceValue resValue = findResValue(value, false /*forceFrameworkOnly*/); ResourceValue resValue = findResValue(value, isFrameworkValue); // if resValue is null, but value is not null, this means it was not a reference. // we return the name/value wrapper in a ResourceValue. the isFramework flag doesn't // matter. if (resValue == null) { return new ResourceValue(type, name, value, false /*isFramework*/); return new ResourceValue(type, name, value, isFrameworkValue); } // we resolved a first reference, but we need to make sure this isn't a reference also. Loading Loading @@ -701,6 +709,15 @@ public final class BridgeContext extends Activity { if (item != null) { return item; } // if it was not found and the type is an id, it is possible that the ID was // generated dynamically when compiling the framework resources. // Look for it in the R map. if (BridgeConstants.RES_ID.equals(resType)) { if (Bridge.getResourceValue(resType, resName) != null) { return new ResourceValue(resType, resName, true); } } } // didn't find the resource anywhere. Loading
tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/GcSnapshot.java +13 −14 Original line number Diff line number Diff line Loading @@ -393,27 +393,26 @@ public class GcSnapshot { * @param bitmap the bitmap to link to. */ public void setBitmap(Bitmap_Delegate bitmap) { assert mLayers.size() == 0; // create a new Layer for the bitmap. This will be the base layer. Graphics2D graphics2D = bitmap.getImage().createGraphics(); Layer baseLayer = new Layer(graphics2D, bitmap); // add it to the list. mLayers.add(baseLayer); // if transform and clip where modified before, get the information and give it to the // layer. // Set the current transform and clip which can either come from mTransform/mClip if they // were set when there was no bitmap/layers or from the current base layers if there is // one already. if (mTransform != null) { graphics2D.setTransform(mTransform); graphics2D.setTransform(getTransform()); // reset mTransform in case there was one. mTransform = null; } if (mClip != null) { baseLayer.setClip(mClip); baseLayer.setClip(getClip()); // reset mClip in case there was one. mClip = null; } // replace whatever current layers we have with this. mLayers.clear(); mLayers.add(baseLayer); } public void translate(float dx, float dy) { Loading