Search in sources :

Example 81 with LayoutlibDelegate

use of com.android.tools.layoutlib.annotations.LayoutlibDelegate in project android_frameworks_base by DirtyUnicorns.

the class PathParser_Delegate method nParseStringForPath.

@LayoutlibDelegate
static /*package*/
void nParseStringForPath(long pathPtr, @NonNull String pathString, int stringLength) {
    Path_Delegate path_delegate = Path_Delegate.getDelegate(pathPtr);
    if (path_delegate == null) {
        return;
    }
    assert pathString.length() == stringLength;
    PathDataNode.nodesToPath(createNodesFromPathData(pathString), path_delegate);
}
Also used : Path_Delegate(android.graphics.Path_Delegate) LayoutlibDelegate(com.android.tools.layoutlib.annotations.LayoutlibDelegate)

Example 82 with LayoutlibDelegate

use of com.android.tools.layoutlib.annotations.LayoutlibDelegate in project android_frameworks_base by DirtyUnicorns.

the class Region_Delegate method nativeSetPath.

@LayoutlibDelegate
static /*package*/
boolean nativeSetPath(long native_dst, long native_path, long native_clip) {
    Region_Delegate dstRegion = sManager.getDelegate(native_dst);
    if (dstRegion == null) {
        return true;
    }
    Path_Delegate path = Path_Delegate.getDelegate(native_path);
    if (path == null) {
        return true;
    }
    dstRegion.mArea = new Area(path.getJavaShape());
    Region_Delegate clip = sManager.getDelegate(native_clip);
    if (clip != null) {
        dstRegion.mArea.subtract(clip.getJavaArea());
    }
    return dstRegion.mArea.getBounds().isEmpty() == false;
}
Also used : Area(java.awt.geom.Area) LayoutlibDelegate(com.android.tools.layoutlib.annotations.LayoutlibDelegate)

Example 83 with LayoutlibDelegate

use of com.android.tools.layoutlib.annotations.LayoutlibDelegate in project android_frameworks_base by DirtyUnicorns.

the class AnimatedVectorDrawable_Delegate method nCreatePathPropertyHolder.

@LayoutlibDelegate
static /*package*/
long nCreatePathPropertyHolder(long nativePtr, int propertyId, float startValue, float endValue) {
    VFullPath_Delegate path = VNativeObject.getDelegate(nativePtr);
    Consumer<Float> setter = path.getFloatPropertySetter(propertyId);
    return sHolders.addNewDelegate(FloatPropertySetter.of(setter, startValue, endValue));
}
Also used : VFullPath_Delegate(android.graphics.drawable.VectorDrawable_Delegate.VFullPath_Delegate) LayoutlibDelegate(com.android.tools.layoutlib.annotations.LayoutlibDelegate)

Example 84 with LayoutlibDelegate

use of com.android.tools.layoutlib.annotations.LayoutlibDelegate in project android_frameworks_base by DirtyUnicorns.

the class AnimatedVectorDrawable_Delegate method nAddAnimator.

@LayoutlibDelegate
static /*package*/
void nAddAnimator(long setPtr, long propertyValuesHolder, long nativeInterpolator, long startDelay, long duration, int repeatCount) {
    PropertySetter holder = sHolders.getDelegate(propertyValuesHolder);
    if (holder == null || holder.getValues() == null) {
        return;
    }
    ObjectAnimator animator = new ObjectAnimator();
    animator.setValues(holder.getValues());
    animator.setInterpolator(NativeInterpolatorFactoryHelper_Delegate.getDelegate(nativeInterpolator));
    animator.setStartDelay(startDelay);
    animator.setDuration(duration);
    animator.setRepeatCount(repeatCount);
    animator.setTarget(holder);
    animator.setPropertyName(holder.getValues().getPropertyName());
    AnimatorSetHolder set = sAnimatorSets.getDelegate(setPtr);
    assert set != null;
    set.addAnimator(animator);
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) LayoutlibDelegate(com.android.tools.layoutlib.annotations.LayoutlibDelegate)

Example 85 with LayoutlibDelegate

use of com.android.tools.layoutlib.annotations.LayoutlibDelegate in project android_frameworks_base by DirtyUnicorns.

the class AnimatedVectorDrawable_Delegate method nCreateGroupPropertyHolder.

@LayoutlibDelegate
static /*package*/
long nCreateGroupPropertyHolder(long nativePtr, int propertyId, float startValue, float endValue) {
    VGroup_Delegate group = VNativeObject.getDelegate(nativePtr);
    Consumer<Float> setter = group.getPropertySetter(propertyId);
    return sHolders.addNewDelegate(FloatPropertySetter.of(setter, startValue, endValue));
}
Also used : VGroup_Delegate(android.graphics.drawable.VectorDrawable_Delegate.VGroup_Delegate) LayoutlibDelegate(com.android.tools.layoutlib.annotations.LayoutlibDelegate)

Aggregations

LayoutlibDelegate (com.android.tools.layoutlib.annotations.LayoutlibDelegate)334 ArrayResourceValue (com.android.ide.common.rendering.api.ArrayResourceValue)56 DensityBasedResourceValue (com.android.ide.common.rendering.api.DensityBasedResourceValue)56 ResourceValue (com.android.ide.common.rendering.api.ResourceValue)56 BufferedImage (java.awt.image.BufferedImage)46 AffineTransform (java.awt.geom.AffineTransform)42 Area (java.awt.geom.Area)42 File (java.io.File)30 GcSnapshot (com.android.layoutlib.bridge.impl.GcSnapshot)29 FileNotFoundException (java.io.FileNotFoundException)24 Graphics2D (java.awt.Graphics2D)19 TypedValue (android.util.TypedValue)17 NotFoundException (android.content.res.Resources.NotFoundException)16 BridgeContext (com.android.layoutlib.bridge.android.BridgeContext)16 BridgeXmlBlockParser (com.android.layoutlib.bridge.android.BridgeXmlBlockParser)16 ArrayList (java.util.ArrayList)16 XmlPullParser (org.xmlpull.v1.XmlPullParser)16 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)16 IOException (java.io.IOException)14 NinePatchInputStream (com.android.layoutlib.bridge.util.NinePatchInputStream)12