Publish Android library to BinTray (JCenter), AAR vs. JAR and optional dependency

Working on Android open-source I needed to publish two libraries (Android-Image-Cropper and Android-Fast-Image-Loader) to JCenter.
 
What I will touch in this post:

  • Publishing AAR
  • "Sources not found" issue with AAR
  • AAR vs. JAR
  • Publishing JAR
  • Handling optional dependency in Gradle

 
TL;DR see the release gradle script.
 
clip_image001.png
Continue reading

Android cropping image from camera or gallery

Recently I needed to implement avatar image upload from an Android app, I didn't found a library that did all that I needed so I forked a pretty good one and made it better, check it out: Android Image Cropper.
 

Requirements:

  • Pick image from camera or gallery using single chooser.
  • Select circular crop window in the image for the avatar.
  • Limit output avatar image to 500×500 pixels.
  • Efficient memory usage.
    Continue reading

HTML Renderer 1.5.0.0

A lot of things has changed in the past year and it seems more is going to change in the next, unfortunately those changes are not aligned with the work required for HTML Renderer. That's why it took so long for v1.5 release to finally be ready and the reason not all features I originally planned made it.
 
With a heavy heart I'm going to hold all significant work on HTML Renderer until either my career path brings me back to .NET, I have more free time to work on it or the project will get more attentions. In the meanwhile I will continue to support the library with small fixes and answering question on the discussions/issues pages.
Continue reading

Setting HTML/Text to Clipboard revisited

After getting feedback that my original clipboard code doesn't handle all scenarios, especially with Chrome, I went back to the code to get a better understand of what's going on and find the correct way to set plain text and HTML snippet to clipboard.

 
Highlights

  • Setting plain text and html data.
  • Unicode support for plain text.
  • Clipboard HTML format
    • Version.
    • Parts start/end offsets.
    • StartFragment/EndFragment comments.
    • <html> and <body> elements.
    • Unicode handling.

Continue reading

HTML syntax highlight using Rich-Text Format (RTF)

In case you want to display HTML with highlighted/colored syntax the simplest way to go is use WinForms RichTextBox, all is needed is to add RTF color tags surrounding HTML elements.
This helper class goal is exactly that, given a string containing HTML code it will return an RTF formatted string with the HTML elements colored.
 
I have used Alun Evans code as base, improving its coloring support and performance.
See it's usage in HtmlRenderer project.

Continue reading

Generate image from HTML using HTML Renderer

The requirement to generate image from HTML snippet appears to be quite popular, as seen in a few StackOverflow questions1, so I have decided to properly support it in HTML Renderer to simplify the process and improve the results.
 
The support for image generation in HTML Renderer existed since day one, but it required manual handling of image graphics object, size limitations and configuration toggles.
Additionally the change to use GDI text rendering in 1.4.6.0 broke2 the most common code used for generating image with HTML Renderer, as provided in several blogs and StackOverflow answers3.

Continue reading