@LayoutlibDelegate /*package*/ static String formatDateInterval(long address, long fromDate, long toDate) { DateIntervalFormat_Delegate delegate = sManager.getDelegate((int) address); if (delegate == null) { Bridge.getLog() .error(LayoutLog.TAG_BROKEN, "Unable for find native DateIntervalFormat", null); return null; } DateInterval interval = new DateInterval(fromDate, toDate); StringBuffer sb = new StringBuffer(); FieldPosition pos = new FieldPosition(0); delegate.mFormat.format(interval, sb, pos); return sb.toString(); }
private static void draw( long canvas_instance, final int left, final int top, final int right, final int bottom, Bitmap bitmap_instance, long chunk, long paint_instance_or_null, final int destDensity, final int srcDensity) { // get the delegate from the native int. final Bitmap_Delegate bitmap_delegate = Bitmap_Delegate.getDelegate(bitmap_instance); if (bitmap_delegate == null) { return; } byte[] c = null; NinePatch_Delegate delegate = sManager.getDelegate(chunk); if (delegate != null) { c = delegate.chunk; } if (c == null) { // not a 9-patch? BufferedImage image = bitmap_delegate.getImage(); Canvas_Delegate.native_drawBitmap( null, canvas_instance, bitmap_instance, 0f, 0f, (float) image.getWidth(), (float) image.getHeight(), (float) left, (float) top, (float) right, (float) bottom, paint_instance_or_null, destDensity, srcDensity); return; } final NinePatchChunk chunkObject = getChunk(c); assert chunkObject != null; if (chunkObject == null) { return; } Canvas_Delegate canvas_delegate = Canvas_Delegate.getDelegate(canvas_instance); if (canvas_delegate == null) { return; } // this one can be null Paint_Delegate paint_delegate = Paint_Delegate.getDelegate(paint_instance_or_null); canvas_delegate .getSnapshot() .draw( new GcSnapshot.Drawable() { @Override public void draw(Graphics2D graphics, Paint_Delegate paint) { chunkObject.draw( bitmap_delegate.getImage(), graphics, left, top, right - left, bottom - top, destDensity, srcDensity); } }, paint_delegate, true /*compositeOnly*/, false /*forceSrcMode*/); }