Adafruit PiTFT 2.4″ touchscreen on a Raspberry Pi Zero with Archlinux

While ago I bought the Adafruit PiTFT 2.4″ touchscreen HAT and I wanted to use it with my Rapsberry Pi Zero.

Unfortunately, it seems that Adafruit supports only the Raspian distribution while my favourite distro is Archlinux.

However, I managed to get the screen to work under Archlinux too:

Continue reading

Change locale in an Espresso test

You can change the locale programmatically in an Espresso test too.

Here you can find a quick example I wrote.

The key part is to restart the Activity after you have set the new Locale.

Of course you can also set the flag of ActivityTestRule to manually re-launch the Activity so that you launch it after you set the new Locale.

Just ensure you have a new Activity after you change Locale.

Bear in mind that to change the locale taking into account all the deprecations and sdk versions is more complex than the code I wrote in my example. Read more here.

Android Searchview and the magnifying icon

Just a quick note about the android.support.v7.widget.SearchView.

Normally the widget has the magnifying on the left side if expanded. So if you do something like this:

SearchView searchView =
   (SearchView) findViewById(R.id.search_view);
searchView.setIconifiedByDefault(false);
searchView.setIconified(false);

We will end up with something like this:

Android Searchview standard

If we need to manipulate the magnifying icon, we need a reference to that View:

ImageView searchViewIcon =
   (ImageView)searchView.findViewById(android.support.v7.appcompat.R.id.search_mag_icon);

After that just retrieve the parent ViewGroup. It is, at least today, a LinearLayout, so just remove the View and add it again to have it at the end / right side of the SearchView.

ViewGroup linearLayoutSearchView =
   (ViewGroup) searchViewIcon.getParent();
linearLayoutSearchView.removeView(searchViewIcon);
linearLayoutSearchView.addView(searchViewIcon);

So we have something like this:

Android Searchview right

Of course, it is a standard View, so if we need to remove it altogether, just set its properties accordingly (from here):

searchViewIcon.setAdjustViewBounds(true);
searchViewIcon.setMaxWidth(0);
searchViewIcon.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
searchViewIcon.setImageDrawable(null);

Jira issue filters used as notifications

Using Atlassian Jira, it is very useful to have notifications for issues, created or edited, of your projects.

Unfortunately, to enable custom notifications, you have to create a notification scheme and only an administrator can do that.

Jira, however, offers you the ability to save searches, called filters and the results can be delivered by email through subscriptions.

With the right filter and the right subscription you can set Jira to notify you via email if and only if issues of your projects are creted or edited, without clogging your inbox.

Continue reading

Text labels in Trello

In the last years, for all my projects, personal and non-personal ones, I relied on Trello, the famous dashboard tool based on cards and boards.

What I really like about Trello is how it lets you see the state of a project, from various (all) its point of views, from all its contexts, in a glimpse, in a visual way. It is beautifully designed to let you do so.

One of the habits I started to adopt is the use of text labels in my cards.

I don’t use them as a substitute of the labelling system of Trello but I find them useful as a starting point to order the cards across the lists.

Trello test board

Continue reading