Tag: android

Automating Inkscape to Export Android Drawables

Developing for Android, you need to provide a lot of copies of each image you use, for mdpi, hdpi, xhdpi, xxhdpi, and even xxxhdpi screens – possibly even more in the future! Even if you create your images as vectors rather than hand-pixelling them, it’s still time-consuming to get Inkscape, a free vector drawing application, to export the 5 or so different bitmap files. Fortunately, Inkscape has some automation features built-in – for example, you can tell it to generate a PNG from an SVG via the command line:

inkscape source.svg -w 32 -h 32 -e dest.png

I’ve created a little Windows batch file that will take all the SVG files in a directory, and then create all the various sizes of PNG from it and put them in the right places. It’s available here on GitHub. It’s Windows-only, and expects a certain directory structure, but it should work if you’re using the default project setup from IntelliJ or Android Studio. If not, you should be able to tweak it.

One thing to note is that Inkscape does take a second or so to do each export, and that time unfortunately adds-up when you’re doing 5 exports per file, on potentially dozens of files. If I get around to creating a Gradle script that only exports the SVGs that have changed, I’ll make sure to post that as well.

Quick Quote 1.4 Released

Quick Quote version 1.4 has now been submitted to Google Play, and will become available some time over the next 24 hours. Version 1.4 brings a couple of new features, and some general improvements. So, what’s new?

Both Free and Professional now have an About screen, which links to this site and the various open-source libraries used by Quick Quote. This isn’t a big thing, but it’s good to have.

All the forms have been updated to use proper data validation and error messages. What this means is that if you’ve entered something invalid, it will tell you and won’t close until you fix it. Previously, forms would just close, pop an error message up, and just guess as to what the value should be, which was a pretty bad experience. I’m glad to have fixed it. If you’re a dev and curious, this article gives a decent overview of Android form validation, and this StackOverflow answer explains how to stop dialogs closing, because for some strange reason there’s no simple way to do so.

For Quick Quote Professional users, there are two new features about making things easier when there are a lot of quotable items. Firstly, you can now arrange items into categories. There’s a new category management screen, available from the quote item management screen. Items are grouped by category in the ‘add item’ dialog of the calculator, which can make finding things much faster. Search is still available there, and works for both category and item names. The second new feature is you can now import and export quote items and categories to a file, from the menu in the item management screen. Previously, users with more than one device, such as a business with multiple employees using Quick Quote, would have had to enter the quotable items once for each device. Now, they can enter them once, export the file, copy it to another device, and then import them again.

Next, I’m going to be jumping into development of version 1.5. This will be focused on improving the exported quotes, with customer details, quote numbers, notes, and being able to mark them as invoices or receipts or anything you like.

Quick Quote is a time-saving Android app for creating quotes and estimates while on the job. Feel free to try out the free version for as long as you want, with no limitations.

Quick Quote 1.3 Released!

Both Quick Quote Free and Quick Quote Professional have just been updated to version 1.3! There are several improvements that I’ve been putting in over the last couple of weeks.

Both versions:

  • Specify business details, a logo, and legal text to appear on your exported HTML quotes (in the Settings menu).
  • Item quantities can now be any positive number, including fractional parts – eg, 1.5
  • Improved the appearance on phones and Android versions older than 3.0 (Honeycomb).

Quick Quote Professional:

  • Added a search box to the ‘add item’ window, to make finding items easier.
  • Quote items can now be charged per minute or hour, or for an area or volume.
  • Minute and hour types have a new window for easily entering the number of hours and minutes.
  • Area and volume types allow you to enter the dimensions, and have the total calculated automatically.
  • Customise the units that are displayed for each quote item.
  • Saved quotes are organised by date, and have a search box to help you find them easily.

Quick Quote is a time-saving Android app for creating quotes and estimates while on the job. Feel free to try out the free version for as long as you want, with no limitations.

Quick Quote Professional 1.2: The Tax Update

Currently rolling-out across Google Play is version 1.2 of Quick Quote Professional, which allows you to add tax amounts to your quotations and estimates. You can specify any number of percentage tax rates, and the total is calculated automatically.

Quick Quote is an easy-to-use quotation and estimate calculator for Android phones and tablets. Enjoy the free version for as long as you want, with no limits on how many quotes you can store. This new tax feature is only available in the paid-for version.

Multiple App Versions on Android

It’s fairly common for Android apps to be released with both a free version, and a paid one with extra features. Quick Quote is one example, and now that it’s been out a little while, I thought I would share some of the tricks and traps that I’ve come across in its development.

Android has a fairly strict security system, that stops apps accessing each other’s data. That’s great when you are storing private information, but not so great when you want to share that data between your free app and your paid one. Fortunately, there is a way to tell Android that it’s safe for your apps to access each other’s data. This is by specifying the same sharedUserID in the manifest files. You also need to ensure that the APKs are signed with the same key. This causes Android to see them as related, and allows you to bridge the gap between them.

You can then call the createPackageContext() method with the package name of the relevant app, in order to obtain a Context for it, and then access its files and resources as normal. A word of warning, however: If the app in question is not installed, createPackageContext() will throw a NameNotFoundException and not return the Context you are after. There are of course, multiple ways to solve this issue. In the case of Quick Quote, I decided to have the paid version look for the free version when it launches, and copy the data over if it has not already been copied.

Now, probably the majority of the code and resources in the different app versions will be the same. Duplication is often a signal that things need a rethink. The Android development tools support the creation of Library Projects as a solution: put the majority of the code in the library project, then include it in the release projects and extend it with any differences.

In the case of inserting advertisements, it’s helpful to know about the <include/> layout element. This lets you directly include another layout file within a layout. This makes it easy to include an activity layout, and add an advertisement without duplicating the whole layout file. It’s also generally useful if you want to use a segment of layout in several places.

2013 in Review

In 2012, I basically had a breakdown. Stress at work reached a point where one day in April I just couldn’t make myself go. I then bounced around various mental health services and medications, and mostly sat around doing nothing and feeling horrible.

2013, however, is the year I finally got some control back in my life. Not complete control – I still find dealing with people outside of close family members difficult; I doubt I could handle employment; and I’m still on medication. However, I am working self-employed. I’ve seen my first Android project through to release. I’ve not given-up despite it being a failure commercially (though I do have plans for several improvements to it that may help).

I have found I struggle with uncertainty: if I know how the finished product should be, I can stick with it, but when it’s complete, I feel lost. Games are particularly tricky, as you cannot design one in advance and know if it will work. I’ve put a lot of time into two projects in particular this year, DropPix, last mentioned here; and Turn By Turn Racing. Both seemed good in theory, but didn’t work well in practice, and I found it very difficult to pull the plug on them. How could I know whether more polish would fix them?

As I go into 2014, I have several projects in need of completion. There’s a new Android app that’s been in my head since before Quick Quote. F!shing is in need of a structural rewrite to deal with some performance issues, but I’m otherwise pretty confident in it. I began work on a roguelike game in November for the Trial of Oryx contest, and though I missed the deadline, it’s very satisfying to work on, even if it’s not likely to make me rich. I have the beginning of a Goblin Fortress remake lying around too, though its fate has not yet been decided.

So, I’ve got lots to keep busy with. Hopefully in 2014 it will finally pay-off a little!

Quick Quote Professional 1.1: The Discount Update

This past week I’ve been working on adding discounts to the paid version of Quick Quote. You can add an unlimited number of discounts to a quote, and these can be either a fixed amount, or a percentage of the total cost.

Quick Quote is an easy-to-use quotation and estimate calculator for Android phones and tablets. Enjoy the free version for as long as you want, with no limits on how many quotes you can store. The discount feature is only available in the paid-for version.

Quick Quote Free now available on Google Play

I’ve just published a new, free version of Quick Quote to Google Play. It’s not showing up quite yet, as it can take a couple of hours for it to filter through the system. But when it does, please go and try it out!

The paid version, which is now called Quick Quote Professional, has not exactly been a resounding commercial success, so far only selling a single copy. I put this down largely to the lack of a free version, to let people try it out. There are a couple of competing apps that do have free versions, and I’m confident that my product is as good, if not better. So now, a free version! There are adverts, and a couple of feature limitations – the gap between the versions will become wider as I release the updates I have planned.

I could have done with releasing this earlier, but I’ve been away for a couple of weeks. During that time, I worked on an Android version of the fishing jam game I made a couple of months ago. There’s a screenshot below. I look forward to finishing that up soon, but so many projects are calling to me at the moment. It’s good to be busy!


Development screenshot of F!shing from a couple of weeks ago. Graphics are placeholder.

I’ll try to keep this site better updated with what I’m doing. I have a tendency to get carried away working on things, and never tell anyone!

Sharing Private App Data in Android

Just a quick post, because this is something that wasn’t obvious. It’s quite common to have multiple versions of an app, usually a paid version and a free version. In order to make the transition from the free to the paid version as easy as possible, you want to have the data shared between the apps.

The first thing you need to do is declare the same ‘sharedUserId‘ in the app manifest for both apps. They also both need to be signed using the same key – but you’ll probably be using the same key anyway. You need to set the key before publishing, otherwise you can have problems.

However, even doing so, you won’t see the same data. Whichever app is the ‘child’ will need to use Context.createPackageContext() with the package name for the ‘parent’. Using this Context, the child can then read and write files as if it were the parent.