use of com.android.tools.layoutlib.annotations.LayoutlibDelegate in project platform_frameworks_base by android.
the class VectorDrawable_Delegate method nGetFullPathProperties.
@LayoutlibDelegate
static boolean nGetFullPathProperties(long pathPtr, byte[] propertiesData, int length) {
VFullPath_Delegate path = VNativeObject.getDelegate(pathPtr);
ByteBuffer properties = ByteBuffer.wrap(propertiesData);
properties.order(ByteOrder.nativeOrder());
properties.putFloat(VFullPath_Delegate.STROKE_WIDTH_INDEX * 4, path.getStrokeWidth());
properties.putInt(VFullPath_Delegate.STROKE_COLOR_INDEX * 4, path.getStrokeColor());
properties.putFloat(VFullPath_Delegate.STROKE_ALPHA_INDEX * 4, path.getStrokeAlpha());
properties.putInt(VFullPath_Delegate.FILL_COLOR_INDEX * 4, path.getFillColor());
properties.putFloat(VFullPath_Delegate.FILL_ALPHA_INDEX * 4, path.getStrokeAlpha());
properties.putFloat(VFullPath_Delegate.TRIM_PATH_START_INDEX * 4, path.getTrimPathStart());
properties.putFloat(VFullPath_Delegate.TRIM_PATH_END_INDEX * 4, path.getTrimPathEnd());
properties.putFloat(VFullPath_Delegate.TRIM_PATH_OFFSET_INDEX * 4, path.getTrimPathOffset());
properties.putInt(VFullPath_Delegate.STROKE_LINE_CAP_INDEX * 4, path.getStrokeLineCap());
properties.putInt(VFullPath_Delegate.STROKE_LINE_JOIN_INDEX * 4, path.getStrokeLineJoin());
properties.putFloat(VFullPath_Delegate.STROKE_MITER_LIMIT_INDEX * 4, path.getStrokeMiterlimit());
properties.putInt(VFullPath_Delegate.FILL_TYPE_INDEX * 4, path.getFillType());
return true;
}
use of com.android.tools.layoutlib.annotations.LayoutlibDelegate in project platform_frameworks_base by android.
the class Preference_Delegate method getView.
@LayoutlibDelegate
static /*package*/
View getView(Preference pref, View convertView, ViewGroup parent) {
Context context = pref.getContext();
BridgeContext bc = context instanceof BridgeContext ? ((BridgeContext) context) : null;
convertView = pref.getView_Original(convertView, parent);
if (bc != null) {
Object cookie = bc.getCookie(pref);
if (cookie != null) {
bc.addViewKey(convertView, cookie);
}
}
return convertView;
}
use of com.android.tools.layoutlib.annotations.LayoutlibDelegate in project platform_frameworks_base by android.
the class InputMethodManager_Delegate method getInstance.
// ---- Overridden methods ----
@LayoutlibDelegate
static /*package*/
InputMethodManager getInstance() {
synchronized (InputMethodManager.class) {
InputMethodManager imm = InputMethodManager.peekInstance();
if (imm == null) {
imm = new InputMethodManager(new BridgeIInputMethodManager(), Looper.getMainLooper());
InputMethodManager.sInstance = imm;
}
return imm;
}
}
use of com.android.tools.layoutlib.annotations.LayoutlibDelegate in project android_frameworks_base by ParanoidAndroid.
the class BitmapFactory_Delegate method nativeDecodeStream.
@LayoutlibDelegate
static /*package*/
Bitmap nativeDecodeStream(InputStream is, byte[] storage, Rect padding, Options opts, boolean applyScale, float scale) {
Bitmap bm = null;
//TODO support rescaling
Density density = Density.MEDIUM;
if (opts != null) {
density = Density.getEnum(opts.inDensity);
}
try {
if (is instanceof NinePatchInputStream) {
NinePatchInputStream npis = (NinePatchInputStream) is;
npis.disableFakeMarkSupport();
// load the bitmap as a nine patch
com.android.ninepatch.NinePatch ninePatch = com.android.ninepatch.NinePatch.load(npis, true, /*is9Patch*/
false);
// get the bitmap and chunk objects.
bm = Bitmap_Delegate.createBitmap(ninePatch.getImage(), true, /*isMutable*/
density);
NinePatchChunk chunk = ninePatch.getChunk();
// put the chunk in the bitmap
bm.setNinePatchChunk(NinePatch_Delegate.serialize(chunk));
// read the padding
int[] paddingarray = chunk.getPadding();
padding.left = paddingarray[0];
padding.top = paddingarray[1];
padding.right = paddingarray[2];
padding.bottom = paddingarray[3];
} else {
// load the bitmap directly.
bm = Bitmap_Delegate.createBitmap(is, true, density);
}
} catch (IOException e) {
Bridge.getLog().error(null, "Failed to load image", e, null);
}
return bm;
}
use of com.android.tools.layoutlib.annotations.LayoutlibDelegate in project android_frameworks_base by ParanoidAndroid.
the class Bitmap_Delegate method nativeCreate.
// ---- native methods ----
@LayoutlibDelegate
static /*package*/
Bitmap nativeCreate(int[] colors, int offset, int stride, int width, int height, int nativeConfig, boolean mutable) {
int imageType = getBufferedImageType(nativeConfig);
// create the image
BufferedImage image = new BufferedImage(width, height, imageType);
if (colors != null) {
image.setRGB(0, 0, width, height, colors, offset, stride);
}
// create a delegate with the content of the stream.
Bitmap_Delegate delegate = new Bitmap_Delegate(image, Config.nativeToConfig(nativeConfig));
return createBitmap(delegate, mutable, Bitmap.getDefaultDensity());
}
Aggregations