Life of Apps

Grid View, Font Changes and a New Icon!

The app received its biggest change so far with the main screen now displaying images in a grid instead of a list. I was planning to write the grid using the default components when I came across etsy's AndroidStaggeredGrid. A simple and minimal grid with options to control the number of columns, margins and padding. The reason why I chose this over other custom controls was that it had minimal impact on my existing code. The AndroidStaggeredGrid control extended from AbsListView so most of the code that I had written could be reused.
StaggeredGridView thingsList = (StaggeredGridView)findViewById(R.id.grid_view);

thingsList.setAdapter(listAdapter);
thingsList.setOnItemClickListener(this);

As I had earlier extended from ListActivity, I could get a few features out of the box: such as a default TextView to show on empty. Now, even after calling an explicit setEmptyView method, I was not able to get the desired result. So had to work around by adding a TextView on a FlowLayout that would only show when the grid was empty. But other than this the other changes (listener etc) were minimal.

Main-grid

Font Changes

While the Roboto font is a fine one, I was getting bored of seeing it, as it is the default in almost all apps. So, decided to replace it with a sans-serif open source font.
Typeface typeface = Typeface.createFromAsset( getResources().getAssets(), "SourceSansPro-Regular.otf");
((TextView)findViewById(R.id.datePurchValue)).setTypeface(typeface);
((TextView)findViewById(R.id.priceValue)).setTypeface(typeface);
((TextView)findViewById(R.id.descValue)).setTypeface(typeface);

Also, added a few icons to spruce up the view screen. The base icons are from www.icons4android.com

View-fontchanges

A New Launcher Icon! 

And finally, I created a new launcher icon using using Roman Nurik's Android Asset Studio. The launcher icon is also displayed in the About screen of the app.

About-new-icon

Bug Fixes

Along with the new enhancements, a bug related to images was fixed. The images though were stored in a directory created by Thingse, were still referring to their original location. Any delete of the original image would throw a NullPointerException and cause the app to crash. I fixed this by pointing to the right location and also hid the images directory where Thingse stores the captured/selected images from gallery apps. This was done by starting the directory name with a "." (dot) and additionally adding a "nomedia" file in the directory.

Danesh

Visit Pleb.in for apps developed by Danesh

No comments :

Post a Comment

Leave a Comment...