Featured Posts

<< >>

File Manager

ic_launcher

This app is my response to a number of overcomplicated file managers in Google Play that are often outdated and disregard new APIs and design guidelines. I created this app with simplicity of use and convenience in mind. It allows users to add bookmarks to slide-out drawer, and it comes with preset bookmarks to default

Panoramio viewer

App icon

Nearby Photos is my open source weekend project. It’s a location-aware Android app showing photos from Panoramio taken nearby.

The app fetches images from Panoramio API based on user location and continues to download more images as user scrolls down the list until all images in the area have been shown. Gson library is used to parse response from panoramio, and Volley for network requests.

It uses KitKat’s immersive mode to show photos in full screen, and allows user to swipe between photos and toggle map view to get an idea where the photo was taken.

Main screenImage ScreenImage screen with map

The source code is available on GitHub.

Android Wear

LG G watch

I don’t normally review hardware and this isn’t meant to be a review, or a sponsored ad, but a short note about my experience with the LG G watch that I purchased about two weeks ago.

I was curious about the Android Wear devices since they were announced during Google I/O 2014. When I learned about the price, I immediately wanted one, but was sceptical about the battery life, and wanted to wait for the Moto 360, so I held off. I even considered the Pebble, because it lasts longer due to different display technology being used – but it wasn’t Android Wear.

Once Moto 360 came out, it received a mixed reviews, and reportedly the battery life wasn’t much greater than the other smartwatches. I was still undecided, but seeing as it wasn’t available in Ireland, my choice was narrowed to Samsung’s Gear Live, and LG’s G Watch, each €199, and since I already loved LG’s Nexus 5, my choice was easy. I went with LG G Watch.

The device comes in two colours

The device comes in two colours

Initially I intended to use the watch sporadically; maybe if i’m really in a hurry and don’t want to take out my phone, or to see my notifications while driving. I didn’t want an extra device that I would have to remember to charge every night, and I wanted to see what the fuss is all about, maybe develop for it or add Android Wear features to my existing apps.

But when I received my G Watch, it was beautiful. And I was very surprised how long it lasted on the first day – I wanted it to last through the full day of heavy use (after all, it was the first day), so I turned off Always-on, and by the end of the day was amazed that I still had 75% battery left. So naturally, I kept the screen on for the rest of my use, sometimes disabling it for the night.

Some report that they noticed battery life getting better since using a smartwatch, due to using the phone less. I also noticed that I take out my phone much less when I use my watch, but I can’t confirm battery life, because as an Android developer, I my phone is often plugged in for debugging, and thus the battery life is hard to evaluate.

Battery life:

  • 2 days with screen Always-on
  • 4 days without Always-on

I don’t see battery technology getting better anytime soon, so we will be probably seeing the same results for the next few generations of smartwatches, but it can only get better if anything.

I charge my watch every day regardless, but I did leave it on for one night and it lasted until evening the next day! Using the charging cradle is as easy as dropping the device in it, and it’s always on my computer desk – I don’t wear it in bed, and I don’t want to keep it on my bedside table, because with screen always on, it would be too bright at night.

I was also pleasantly surprised how convenient it is to receive notifications on the watch. It supports all apps using system notifications out of the box, and unwanted apps can be muted from displaying on the watch. This allows me to read my messages right away while on a bike or in public transport, without having to take my phone out. And most importantly, I get notified of incoming calls, which are easy to miss when out and about. Of course, notifications on the watch can be muted with a simple swipe down, and the smart watch becomes just a watch, which is very convenient while in lecture and you don’t want to be distracted.

Another important feature of the watch is voice commands. Unfortunately it doesn’t support all Google Now commands, like “what’s this song”, or “Navigate home”, and I was disappointed when I tried sending a text in Polish, but it’s very convenient when you just need to set a reminder while away from your phone.

Since getting my watch I have been using it every day.

To sum up:

  • Battery life is actually pretty good
  • Receiving notifications on the watch is very convenient, especially when outside, or when the phone is in another room
  • Not as distracting as smartphone
  • Very elegant design
  • Voice commands are useful, but limited
  • There’s microphone, vibrations, but no speaker, so Google Now answers aren’t read out loud as they are on the phone.
  • Supports only one language at a time

File Manager

ic_launcher

This app is my response to a number of overcomplicated file managers in Google Play that are often outdated and disregard new APIs and design guidelines.

I created this app with simplicity of use and convenience in mind. It allows users to add bookmarks to slide-out drawer, and it comes with preset bookmarks to default media directories that can be easily modified by user by starring/unstarring folders.

It will also automatically detect media directories, and display media content using cards with preview of the image/video/album cover.

The feature set of this app is limited to viewing content and basic file operations, but also sharing files, but also sports unique features like creating shortcuts to files and folders in the homescreen. Another interesting feature is displaying file icons in a similar fashion as MS windows, by superimposing an app icon over the file, signifying which app will open the file when clicked.

I’ve planned more features for this app, like built-in media player, gallery viewer, file chooser, but due to other projects, college, and my internship, I do not have the time to actively maintain this project at the moment.

File list File info dialog Media cards

File manager is available in Google Play, and source code is available on GitHub.

Update to MSQLite library

Recently MSQlite library saw few new updates:

  1. Tracking classes
    The library allows adding classes to ‘tracked classes’ by calling trackClasses() or trackClass() this adds class(es) to a collection of tables that will create automatically in onCreate() and upgrade in onUpgrade(). These method must be called before MSQLiteOpenHelper.onCreate(), or you can use one of the new constructors to pass an array of classes directly.
  2. Serialization of non primitive fields
    All class members will be added to database table as columns by default. If member type is not a primitive or integer, the library will attempt to serialize it, or throw an exception if type does not implement Serializable.
  3. Upgrading tables
    When new fields are added to class, and database version number is increased, the SQLite framework will call onUpgrade() which will upgrade table columns to match the classes. This is limited to adding new columns since SQLite’s ALTER TABLE command is limited to ADD COLUMN.

MSQLite library

MSQLite is my first library for Android. It’s a wrapper for Android’s SQLiteOpenHelper that extends it by adding methods for easier data manipulation.

Source code is available on GitHub: https://github.com/mick88/MSQLite

The aim of this project is to make it easier for beginner developers on android to use database, but at the same time give them direct control on how data is stored. By default table and column take over names from Class/field, but table and field names can be customized by using @TableName() or @ColumnName() annotation. This is very useful if you are upgrading your current database solution to MSQLite, and your database fields differ from class field names. Another useful feature is excluding select fields from database by adding transient keyword to them.

It uses generics and reflection features of java languages to interpret classes as database tables. This way users can easily insert data to database without worrying about SQL syntax. It also uses annotations for adding metadata to database tables/columns, like Primary Keys, names or data types.

The main class MSQLiteOpenHelper extends SQLiteOpenHelper, so upgrading your database helper with new methods is as easy as changing which class you extend. This gives you access to a number of useful methods

Currently supported field types are:

  • Primitives: int, double, float, long, short, char, byte
  • Wrappers for primitives: Integer, Double, Float etc…
  • String
  • Serializable

 Examples:

Database helper can now look as clean as this:

 

The following is the Note class from the above example:

This is an example of plain Java class that can be converted into database table using createTable() method. There is no need to extend any class or implement any interface. The @PrimaryKey annotation points to field that will be used as a primary key in the table. It is not required, and since SQLite supports multiple PrimaryKeys, multiple fieds can be defined as such. Similarily @NotNull specifies that field may not be null.

The createTable() method effectively creates and executes the following SQL statement:

 

Inserting instance of Note into database can be easily done by calling static insert() method:

or using the helper insert() method on an instance of DatabaseHelper, which gets database instance for you, and closes it afterwards:

TIP: If your PrimaryKey is an integer and is null, after insertion it will take value of row id after insertion.

Inserting a batch of objects is just as simple, you just have to specify Type of the objects in the List:

Sure enough, selecting data is just as easy. The selectAll() method returns a List of all objects of specified type:

If you need more control over which data you need, you can use the main select() method, which wraps SQLiteDatabase.select() method:

Obviously there are also methods for deleting, updating and even replacing items in database:

 Downsides?

  • Currently MSQLite doesn’t support relational databases, so non-supported fields must be declared as transient or implement Serializable.
  • Performance of this solution hasn’t been measured, but it’s expected to execute slower than code tailored for your specific needs.