SwallowCatcher 0.2.0 Released

Download SwallowCatcher 0.2.0

Download SwallowCatcher 0.2.0

After what seems like ages I’m proud to release a new version of SwallowCatcher – version 0.2.0, codenamed “The Black Knight (Come On Ya Pansy!)”. The reason behind the version number jump is twofold: 1. Bigger numbers are better, 2. I think the new features in this version and improved stability warrant a new version. Notable new features in this release include support for more URL schemes, cover art support and the ability to browse show notes from directly within the app.

I’ve had several contributions to this release both in the form of  bug fixes and in code and artwork. In particular I’d like to thank Nick Clark (@nrlucre on identi.ca) for contributing a great icon and Luke (~nobugs on Gitorious) for contributing bug fixes and adding itpc:// and pcast:// URL scheme support. Also, thanks to everyone who’s given me feedback and sent me bug reports.
As always, please check out the project page and the gitorious page where you can download the source code. Feedback and bug reports can again be submitted via identi.ca, email or via the comments on this post.

SwallowCatcher 0.1.3 Released

Download SwallowCatcher 0.1.3

Download SwallowCatcher 0.1.3

I’m again proud to announce a new release of SwallowCatcher. This is a small maintenance update which fixes some of the backwards compatibility issues which people have been experiencing with pre-Froyo versions of Android. Thanks to @diabalomarcus, @fdroid and Henrik Tunedal for their help with this issue.

As always, please check out the project page and the gitorious page where you can download the source code. Feedback and bug reports can again be submitted via identi.ca, email or via the comments on this post.

Using Android WebViews

Recently I’ve been working on show notes support for SwallowCatcher. Since most podcast feeds include their show notes in the feed as embedded HTML I decided to render this HTML to display the show notes. This turned out to be ridiculously simple thanks to Android’s WebView class. The API for rendering arbitrary HTML within your app is almost Pythonic in its simplicity. However, there are a couple of gotchas which caught me out, so I decided to cover them here.

I started out by creating a new Activity class and a layout XML file for it. The layout XML was taken almost directly from the Android WebView Tutorial page:

<?xml version="1.0" encoding="utf-8"?>
<WebView  xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/shownotes"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
/>

In my Activity class the XML is loaded as normal. We also need to import the WebView class and the URLEncoder class. Additionally, the UnsupportedEncodingException class is required:

import android.webkit.WebView;
import java.net.URLEncoder;
import java.io.UnsupportedEncodingException;

Next, we need to encode the text in the correct format. Weirdly, WebView requires that the text is URL escaped, but without spaces converted to ‘+’ symbols. I used URLEncoder to encode my content then replaced the ‘+’ symbols with spaces. This probably isn’t perfect, but for my purposes it works.

String text = "<html><head></head><body>Content goes here!</body></html>";
text = URLEncoder.encode(text, "utf-8");
text = text.replace('+', ' ');

Finally, we find the WebView from the XML and tell it to load the string as its content:

WebView web = (WebView)findViewById(R.id.shownotes);
web.loadData(text, "text/html", "utf-8");

All the above is encased in a try..catch statement for UnsupportedEncodingException, just in case the URLEncoder has a fit. That’s pretty much it. In SwallowCatcher the ShowNotesActivity is 56 lines, including all the verbose Java imports and bootstrapping and loading the content from the database via ORMLite.

As a wise action hero (and ex-Jedi) once said, “I love it when a plan comes together”.

SwallowCatcher 0.1.2 Released

Download SwallowCatcher 0.1.2

Download SwallowCatcher 0.1.2

I’m proud to announce the release of a new version of SwallowCatcher. This version follows hot on the heals of the 0.1.1 release and fixes several bugs reported to me over the last few days. Specific fixes include:

* Fixed empty description tag problem (scratched by Linux Outlaws feed) as reported by @andyc in identi.ca.
* Fixed feed missing scheme validation problem as reported by @andyc in identi.ca.
* Fixed download permissions problem as reported by @andyc in identi.ca.
* Fixed individual feed refresh problem.

Thankfully, I have managed to hold onto my encryption key this time, so upgrading from version 0.1.1 should be smooth. Remember to check out the project page and the gitorious page where you can download the source code. Feedback and bug reports can again be submitted via identi.ca, email or via the comments on this post.

Quick QR Code Generation

QR Codes are a really easy way to share information between your desktop or laptop and a smartphone, which don’t have the privacy issues inherent in Google’s Chrome To Phone. The excellent FOSS Barcode Scanner app for Android makes scanning these codes and opening the scanned data a breeze. However, generating them on the desktop can be a bit of a pain. There are several websites, browser addons and APIs for generating these codes, but up until now I haven’t found anything really quick and easy.

That is until today, when I discovered the ‘qrencode’ utility. Qrencode does exactly what it says on the tin. It takes some text, encodes it as a QR Code and writes the result as a PNG file. It’s a simple command line tool, which opens up awesome scripting possibilities.

My use case is simply to send the URL of a web page that I’m viewing on my desktop to my phone, via QR Code. I found that qrencode was quite happy to write its output to stdout, which meant I could display the result directly using ImageMagick’s ‘display’ command, e.g:

$ qrencode http://blog.webworxshop.com -o - | display

You’ll notice that by default the QR Code is quite small. We can fix this by increasing the block size:

$ qrencode http://blog.webworxshop.com -s 10 -o - | display

Next, I wanted to automatically pull the text to encode from somewhere to save typing – the clipboard was an ideal candidate. Enter ‘xclip’. Xclip is a command line utility to read and write from/to the X system’s built in clipboard. I used bash’s backtick command substitution to grab text from the clipboard and encode it:

$ qrencode `xclip -o` -s 10 -o - | display

And there you have it, a simple one line command to generate and display a QR Code from the contents of the clipboard. I created a bash script containing the command and assigned it to a keyboard shortcut in Gnome (Ctrl-Shift-Q), so that sharing URLs to my phone is as simple as selecting the text in the location bar and hitting Ctrl-C followed by Ctrl-Shift-Q.

If you want to give this a try, you’ll need to install the utilities discussed, in Fedora these can be installed with:

$ sudo yum install qrencode xclip ImageMagick

Enjoy!