BatteryApp



The n0r1sk battery app is an Android App you can install through Google Play.

= About =

You may ask yourselves why...
...we wrote another Battery Indicator App ==
 * First of all - We wanted to get in tough with Androids SDK
 * Second we wanted the App to behave a little different to 'others' on Google Play and
 * Third we build up our knowledge on Activities/Services/Broadcast Receivers to get ready for our next App

The main components involved

 * The Activity - handles the main screen and menu buttons
 * The Intent Service - to put the notification, reschedules himself using the AlarmManager and stops afterwards (frees memory)
 * The Receiver - to handle the auto start 'android.intent.action.BOOT_COMPLETED'

= Download =

Binary
Get it on Google Play (tm):

  

Source
The Eclipse project source is available under the terms and conditions of the GNU Gpl v. 2 or later.

= Version road map/progress = 5

= Used tools =

The icon problem
The battery app displays the current battery load in percentage from 0 to 100. Therefore we need 101 icons to display all levels. Android currently supports four types of screen resolutions (beside tablets) with different sizes. As we are using the status bar of Android it is useful to make different color sets.

So you need:
 * 101 icons * 4 sizes * 2 colors = 808 icons

It would be possible to make a set of 101 per hand but doing 808 is more than boring. :)

Programming an icon drawing script
In this situation we decided to make a tool that should draw the icons with the correct number in it. This tool should save the icons per default as e.g. 24x24 SVG graphics because they could be easily resized without the loss of details.

Perl and SVG
Perl and SVG are good friends if you only need to write SVG files. SVG files are XML formatted files. What you need is a kind of wrapper around the different types of XML data. PERL::SVG is what we used for that and what is easily available on a lot of Linux distributions.

The string problem
If you need text (strings) in different languages (and this is a common task) the Android platform supports you by providing helper calls (R.java). It is very easy to add new translated strings because Android will pick it up automatically. But if you want to format these strings via HTML you have two problems.

The escape char problem
Android needs to have all HTML tags correctly escaped or they will not get parsed from the SDK. On the following site you could convert HTML to escaped HTML.

Online HTML converter

The Java code to load these strings from resources
After that operation inside the CharSequence is the correct formatted text.

The Java code to make html-links clickable in your TextView
This updates the defined TextView to make html-format shown and linked to the installed browser.

= Tested devices =

= Licence = GNU General Public Licence, version 2

Copyright (C) 2012 Markus, Bernhard, Martin and Mario This is how to contact us!

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.

You will find a copy of the GNU Library General Public License here; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.

- last edit .. by