Archives 2013

A developer's tool : Grid Wichterle

Written by Xavier Gouchet - 12 november 2013 - no comments

Many apps exists to enforce good UI design in Android Apps, some embedded in the developper settings screen. This app is a small simple app that you can add to your toolbox.

Grid Wichterle

As you can see on the screenshot above, the app draws a grid above your Android UI, to let you see if your views are aligned following the design guidelines.

The project is Open Sourced on Github and can be downloaded on the Google Play Store

A developer tool : taming the logcat with pidcat

Written by Xavier Gouchet - 11 september 2013 - no comments

LogCat is a great logging feature which is part of the core Android Developper Experience™. Most of us using an IDE use the DDMS tool to view the LogCat outputs. Some might also use directly the console with adb logcat -v long, with maybe some grep or awk to enhance the result.

Well Jake Wharton (you know, the guy behind ActionBarSherlock) developped PidCat, a Python script to print the LogCat output in the console in a usefull way. Here's how it looks like.

PidCat Screenshot

After a couple of day, I find it better than DDMS LogCat view. And what's great is that it's Open Source, so I'll probably add some features in it myself. You can download it or fork it from PidCat Github Repository.

Secret Phone number

Written by Xavier Gouchet - 14 august 2013 - no comments

So maybe you already know that some secret phone numbers are hidden in Android. For instance, if you dial *#*#4636#*#* on your Android phone1, you'll access a secret settings panel.

But did you know that you can add this feature in your own android application ? Basically, you can setup a BroadcastReceiver to listen to a secret number and then launch a hidden Activity. This can be used to unlock some beta features or access developper options on your app. Or just add an easter egg to your phone.

To do that, you simply need to declare your BroadcastReceiver in your manifest, like this :

    <!-- Secret receiver -->
    <receiver android:name=".MySecretBroadcastReceiver" >
        <intent-filter>
            <action android:name="android.provider.Telephony.SECRET_CODE" />
            <data
                android:host="1337"
                android:scheme="android_secret_code" />
        </intent-filter>
    </receiver>

After that, you simply need to handle the corresponding Intent in your BroadcastReceiver :


public class MySecretBroadcastReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		if (intent.getAction().equals("android.provider.Telephony.SECRET_CODE")) {
			// Do something in here
		}
	}

}

A designer tool : UI Stencils

Written by Xavier Gouchet - 18 april 2013 - no comments

A couple of months ago, I stumbled upon pdf with an outline of Android phone / tablet (and other fruity devices too) used to design apps on paper before writing a line of code. For the curious, those files are still available online.

Today I found the ultimate tool for a designer : the Android Stencil Kit (and yes, they also have other OS covered too).

Android Stencil Kit

So yeah, it's my birthday soon, so I guess I'll make myself a gift...

Source: Spawn Rider

The Google Play Store™ is starting to remove Android™ apps

Written by Xavier Gouchet - 17 april 2013 - no comments

The Google Play Store contains more than 700'000 apps for Android, a number which slowly grew since 2008 when the first Android phone was released.

In february, the Play Store saw the removal of around 60'000 apps, most of them automatically removed by Google itself. Most of those apps were spam apps, so no one will mourn for them.

Today, I learnt that the Android UI Patterns which I presented on this blog was removed due to a Violation of the intellectual property.

Following the author's post on G+ and on the Android developpers community, I learnt that the reason for this removal is the name of the app.

"Android" by itself cannot be used in the name of an application name or accessory product. Instead use "for Android."

  • Incorrect: "Android MediaPlayer"
  • Correct: "MediaPlayer for Android"

If used with your logo, "for Android" needs to be smaller in size than your logo. First instance of this use should be followed by a TM symbol, "for Android™".

Needless to say that I immediatly reviewed all my apps descriptions to make sure that I followed the Branding Guidelines and Policies from the Android documentation.

Un nouveau design pour le Kamoulox

Written by Xavier Gouchet - 30 march 2013 - 1 comment

This article is written in French as the app is in French only

Kamoulox est une de mes applications les plus loufoques. Directement inspirée des vidéos absurdes de Kad et Olivier, l'application permet de générer des milliers de phrases permettant de jouer au Kamoulox selon les règles officielles du jeu, ainsi que les règles locales de Bourcefranc le Chapus (Charente-Maritime), d’Arnac-la-Poste (Haute-Vienne) et évidemment Bézaudun-sur-Bîne (Drome).

Kamoulox, version 2010

Cette application a été écrite en 2010, et malgré quelques mises à jour, a peu évolué en terme de design. Aujourd'hui, grâce à l'aide de JF Tolaguera, je vous propose une toute nouvelle version du Kamoulox entièrement redesigné.

Kamoulox, version 2013

Bien évidemment vous pouvez retrouver l'application depuis le Google Play Store en cliquant sur le lien ci dessous. Et si vous avez un souci, une remarque, ou une question sur les règles du Kamoulox à Chaumont sur Tharonne, n'hésitez pas à me contacter !

Kamoulox on Google Play

A developer tool : DevApps Direct

Written by Xavier Gouchet - 29 march 2013 - no comments

This is a somewhat similar app to Android UI Patterns (which I talked about earlier). The aim of DevApps Direct is to list available libraries for Android developpers, with again a live demo feature.

DevAppsDirect

What is really interesting is that it is built around an RSS feed, which you can still follow in any RSS Reader (well, not Google Reader obviously). The app itself will then be able to get new libraries without having to update the app itself.

DevAppsDirect

It will also download the libraries' demo on demand, meaning that it won't use much of your space for nothing. Although it's still in beta, this app is very usefull to test many libraris, and keep some in your favorites

As always, you can download it from the Google Play Store.

A developer tool : Stanley (beta)

Written by Xavier Gouchet - 22 march 2013 - no comments

Recently I needed to know what intents were used by an app on my phone, simply out of curiosity and to learn how to have similar features in one of my app.

There aren't so many way to do this, and so I designed and developped an App to take a look at an App, from a developper point of view. So here it is, in public beta.

Stanley Preview

Stanley can list all package installed on any device, and for any given package, lets one see the Activities, Services, Broadcast Receivers, Content Providers, and more.

More over, it can export the package's original manifest into a readable XML, to see what lies in the intent filters for instance.

It is not yet available on the Play Store, but you can already try it by downloading the APK attached to this post. Any feedback on this app will be welcomed.

Stanley 1.0 (Beta) APK (562 Kb)

Stanley on Google Play

Enabling / Disabling activities at runtime

Written by Xavier Gouchet - 20 february 2013 - no comments

Sometimes, you might want an activity to be available only under specific conditions. But you may want to completely disable it at runtime when some conditions are met. For instance based on the time, or the user geolocation.

This could also let one have different activities based on the user's configuration

You can do so simply by using the PackageManager. In the following example, I disable an activity and enable another one.


PackageManager pm = getPackageManager();
pm.setComponentEnabledSetting(new ComponentName(this, ActivityC.class), 
    PackageManager.COMPONENT_ENABLED_STATE_ENABLED, 0);
pm.setComponentEnabledSetting(new ComponentName(this, ActivityA.class), 
    PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);

The manifest declares the two activities with the same intent filter, namely the home screen shortcut. But using the previous code, I'm able to get a single one of them in the launcher menu at any given time.

Axel v2.3 : quick actions and clipboard support

Written by Xavier Gouchet - 15 february 2013 - no comments

Today, the latest version of Axel was launched, bringing many new features to make XML edition simpler.

New version

First of all, I added an implementation of the Done / Discard UI pattern. This make a much clearer interface when editing a node.

Then I added many ways to interact differently with nodes. A friend of mine once taught me that a user must be able to perform a single action in many different way, and better, should be able to change the way an action must be performed.

Quick Actions

So from now on, Axel lets you choose what happens when you tap, double tap or long press a node. By default, actions are edit on tap, add a child on double tap and bring the context menu on long press.

Axel : quick node actions

Speaking of quick action, I used the NewQuickAction library to add a better looking quick action. The same actions are available, with new ones.

Cut, Copy, Paste

A brand new feature is that Axel now support the integration with the Android clipboard, with the famous cut, copy and paste operations. Cut and copy will put the xml node (and hierarchy) as xml text in the clipboard, and psat will parse the clipboard content and insert it inside the selected node's hierarchy.

And as always, if you have any trouble with one of my app or one of my repo on github, please let me know.

Android app on Google Play Fork me on GitHub

A developer tool : AndroidXRef

Written by Xavier Gouchet - 06 february 2013 - no comments

The Android source code is full of information, and I never spend a week without having to find a piece of code in there. The problem with it is that I had to download the git repo, and to use my OS's search to find the relevant piece of code.

Not anymore, thanks to AndroidXRef, a search engine for the Android Open Source Project. Although it's still in beta, it is very usefull to find information on how things are implemented in Android.

A more complete Activity Lifecycle

Written by Xavier Gouchet - 05 february 2013 - no comments

In one of my application, I want to perform an action when the user has been idle for more than n minutes.

While searching the web I found those two callbacks in the Activity class : onUserInteraction() and onUserLeaveHint , both available since Cupcake.

The first one is simply called whenever an interaction is consumed by the activity : touch, key event, trackball event. The second is called just before onPause() when the user leaves your Activity on purpose. For example by pressing the home button, launching another activity from the notification bar. It won't be called when an Activity generated by the system comes in the foreground (an incoming phone call for instance).

And there are a lot more callbacks in an Activity that one can override. So, after some extensive logging and reading through AOSP sources, here's a new and more complete Activity lifecycle graph, with all the callbacks one may find usefull. I also included the callbacks sent to an Activity's fragments.

Android Full LifeCycle

Feel free to add any remark to make this diagram as accurate as possible.

A developer tool : Quick REx , Eclipse Regexp Plugin

Written by Xavier Gouchet - 01 february 2013 - no comments

Now and then, a little Regexp is necessary. Recently, I had to create a couple of regexp for my Android XML Editor. When the Regexp is complex, designing it from memory is almost impossible, and one needs a tool to write and test the Regexp.

Here is a little Eclipse plugin I found recently. In short, it's a Regex editor, with a couple of useful features:

  • preview of matches (and groups) in a user defined input;
  • a button to escape the sequence to be parsed in a Java String;
  • Ctrl-Space completion to insert common patterns, quantifiers, ...;
  • flags and options to match Pattern options.

Quick REx Eclipse plugin

Checkout the official Quick REx website, or install it in Eclipse using the following update-site URL : http://www.bastian-bergerhoff.com/eclipse/features.