The Art of Readable Code
A not so deep dive into the nuances of code readability and maintainability, examining the subjective nature of what makes code readable, weird programming languages and personal preferences
If you met me in recent months, you’ve heard my complaining about the same Android chores over and over. Well, the work on that is done, the chores are now automated, and my utility library Silly Android is ready for a release.
I’m hopeful that this work primarily addresses the most common issues with the Android APIs nowadays, while also allowing us to quickly start up new projects and maintain the older ones more easily.
Why “Silly”, you may ask? Because the original API decisions are just silly, so I decided to call the fixes that way too.
Contributions are welcome:
An update as per mori-honest’s request (see here), Silly Android now also includes access to the software keyboard. Read more below.
To detect when soft keyboard is shown:
@Override
public void onKeyboardShown(int size) {
Log.d(TAG, "Current keyboard size is: " + size);
}
To detect when soft keyboard is hidden:
@Override
public void onKeyboardHidden() {
Log.d(TAG, "Current keyboard is hidden!");
}
To hide the keyboard on command, e.g. after a click event:
hideKeyboard();
All of these are directly available in Silly Android’s Easy
components, i.e. EasyActivity
, EasyFragment
, EasyDialog
, and transitively available in all Parsable
components.
I hope that with Kotlin we won’t need utilities such as Silly Android anymore.
But until then, this fixes a lot of the silly APIs. 😬