I’ve been a long-time, hardcore user of iTerm2 on Mac. One of the big reasons I love using my Mac everyday is because of iTerm2’s plethora of features. However, I’ve begun to feel like it has become sluggish and bloated. A lot of features I don’t even use and some I try to but they don’t work consistently. In the cases when I need to use Linux, what do I even use? I can’t stand Gnome Terminal. And my recent fascination with ligatures in fonts like Fira Code has left me wanting more typography support and speed.
In steps Kitty.
You’ve probably wanted to separate the items in your Android list-type layouts (e.g. LinearLayout, RecyclerView, and ListView) on more than one occasion. You might have used odd/negative margins/paddings or inserted unnecessary space/divider views. Did you know these views have support for dividers built in?
For RecyclerViews, we can use an ItemDecoration. This decoration is actually applied to the whole item view and is the most powerful API we’ll talk about. For simple dividers, though, all we’re interested in is the getItemOffsets method.
There is a convenience class DividerItemDecoration to make it easy to create a divider by simply setting a…
We all know how to run
adb logcat and some of us might have used a flag or two or piped the output to
grep but what do we do if we need to access the contents of the log from on-device (e.g. when looking for the output file of our thread traces during a UIAutomator test)?
We can access the logcat from shell via the (you probably guessed it)
logcat command. This command is documented quite extensively and provides quite a fair amount of options. …
If you’re debugging a Android application with Android Studio, it’s easy to inspect the stack traces of all the threads running in your application. But what do you do if you’re not able to attach the debugger? It may be that you’re running an out-of-process UIAutomator test or you’re just manually testing your application. We can utilize the on-device command
kill with the signal
SIGQUIT to dump our application’s thread stacks.
First, we’ll need to get the PID of our application. We can use the another on-device command
ps for that. The
-A flag will list all the running processes…
Some of Kotlin’s scope functions can be a bit confusing at first glance. Specifically,
run. Even after using them quite a bit, I still need to think about each one’s behavior before adding a new one to my code. I’ve gotten a bit quicker at remembering the correct one but I thought a quick, runnable example would help myself and others visualize the differences. If you’re more of a textual learner, Kotlin’s own site has a table to enumerate each function’s distinctions.
The above example allows us to interactively see what we get with each of the scope functions. I thought about commenting the output of the
println functions but I decided that guessing before running it would be a good exercise left to the reader.