Tuesday, September 2, 2014

Android Image Cropping - Changing Template Instructions

A year ago I posted on my blog about my image cropping algorithm that developers can use freely for their own applications. During this time I have received many requests on changing template to their own custom templates, which many of them faced identical issues when modifying code to adapt to their custom templates. Therefore, in this post I will provide a step-by-step process on how to make the necessary changes when you plan to add your own custom templates.




Setting Up Project with your Templates

For this image crop algorithm to successfully work, you must provide templates with the background transparent and the lines clearly outlining your template. Make sure this template is saved as PNG, otherwise you won't have the transparent background that is required.
Once you have your templates in PNG files, you now need to place them into the correct project folders.
Looking at the screenshot above, I've placed my templates under res/drawable-nodpi. If you created your templates meant for any screen resolutions, then you can just place it under res/drawable-nodpi. Otherwise if you made different template sizes for different screen densities, then place them in their respective drawable folders.

Making the Proper Code Changes

The next process is to write code that will crop the images that you need.
Looking at the code snippet I have posted above.  The only code that you will need to modify are the arguments for invoking the static method ImageProcess.cropImage(). In the last two arguments, you must provide it with the width and height of your template. Passing in the incorrect argument can produce an error within the application.

That is pretty much it for making the proper modifications to add your own templates. If you have any questions and/or facing issues, feel free to comment below or create a Github issue.

Cheers!!

Link to my Github project: android-cropping-example.
Link to previous blog post: Android Image Cropping Example

Tuesday, April 22, 2014

Randomizer Refresh

Awhile back (like last year), I've released an app called Randomizer and then released the app source code open source on Github. Randomizer was my very first app released on the Google Play Store and was initially created using HTML5, CSS, JavaScript, JQuery, JQuery Mobile, and then packaged together with PhoneGap.

In short, Randomizer is an simple application to help people, who cannot decide on something from a list of choices. With this app users would input their list of choices, and then Randomizer would randomly select a selection from that list. Other features include randomizing the order of the given selection list, and selecting a number of a specified range of numbers.

In my initial post, I have described some of the issues regarding the user experience and the performance issues related to the application. At the time I thought this application never would have many downloads and it has been put aside for quite some time for improvements. Just two months ago, when I revisited this application, I've looked into the amount of downloads for this application and it turned out to be quite a decent number, at least 4000+ downloads. I was quite surprised with this number and thought why not improve it by overhauling the application. While the app download downloads statistics, I couldn't help but to also notice the comments left behind by the users. I noticed there were actually quite a bit of people looking for these types of applications, but the known issue regarding the user experience of Randomizer was the major let down for people wanting to use this app. Not only that, users were also helpful by providing some suggestions that should be implemented to make Randomizer better than before.

Being experienced with Android development than ever before, I started to go about overhauling the application by mimicking the exact UI layout and features. The only issue with this is that when users update their app, they will not be able to access their saved lists, which was previously stored on the HTML5's local storage. I believe that this will only be a minimal issue compared to the improved experience that they will be receiving. During this time, I've even taken advantage to implement a feature where users will be able to access their saved lists on multiple devices that has Randomizer install. This was accomplished by getting the user to create an account with an email and password, and their lists will be updated on our servers. On the server side, this accomplished by using nodeJS and PostgreSQL as our database. I must note that users are not forced to login and they can just skip the login process, but they will not be able to access their saved lists on multiple servers. If the users do happen to login, I suggest that they DO NOT store any valuable information like credit card numbers, social identity numbers, and so on.

In the meantime, I will continue to observe the progress of my Randomizer app and within the next two weeks I will bring an update with new and very important features.

Randomizer on Google Play Store HERE.
Randomizer source code HERE.