inline class is a special type of class defined in Kotlin that only has one property. At runtime, the compiler will “inline” the property where it was used. This is similar to
inline functions, where the compiler inserts the contents of the function into where it was called.
For instance, we have two classes —
Ingredient, which both use a
UUID as the type to represent the ID of the instance. When creating a new
Ingredient class, it can be quite easy to pass the incorrect ID to the
Ingredient class. …
Day-to-day tasks as an Android Developer can consist of varying jobs to complete your work effectively. Whether it is making sure your network requests are correct or ensuring pixel-perfect screens, there are a few tools that have made my day-to-day development easier. These are some of my favourites:
Vysor is my go-to tool for screen sharing of physical devices. It allows you to plug in your device to your laptop and mirror the screen as well as allowing control of the device. A must have for working remotely.
Chucker is an on-device network interceptor. It monitors network calls you make…
I’ve been working on getting Dark Mode in our app fully supported and I stumbled upon an interesting finding:
Application#applicationContextdoes not keep information about the theme that you have set via
AppCompatDelegate.setDefaultNightMode(), only a View or Activity
contexthas this information stored.
After reading through Chris Banes’ articles and watching some great talks about Styles, Themes & Dark Mode, I felt pretty comfortable that I knew quite a bit about the Theming system on Android. However, this particular issue was something that I was not expecting, which is why I decided to document this particular problem I faced.
At Over, we’ve been using Kotlin since we started the new Android version of the app in November 2018. From day one, we’ve been excited to try the language features and leverage them to build our mobile design app.
One of the features we were most excited about was extension functions.
An extension function allows you to extend a classes functionality without needing to edit (or have access to) the class itself. They are great for libraries whose classes you can’t access.
This is an example of an extension function in Kotlin:
fun Canvas.center(): Point = Point(width / 2f, height…
I recently presented this talk at Kotlin Everywhere South Africa as the keynote for the event. I really enjoyed preparing this talk as it spoke about how we use Kotlin, mistakes we’ve made along the way and our opinion on how we decide to use certain features.
Over the past year and a half, I’ve worked primarily on a Kotlin codebase. We at Over, were lucky enough to get a chance to start a project from scratch and we chose Kotlin for many reasons. …
Drawing on an Android Canvas is quite overwhelming, there are many different classes and concepts to understand when drawing something. If you haven’t already read part one of this series make sure to read it here.
In this post, we will be covering some classes that you will find available within the Android Framework which can make your life a bit easier when working with a canvas.
A rectangle class that stores four values:
bottom. These can be used for drawing directly on canvas or just for storing sizes of objects that you want to draw.
Diving into using the Android
Canvas class can unlock magical super powers you never knew you had 🤯. Imagine being able to draw anything* your heart desires just with some basic shapes, paths and bitmaps? Well, the Android Canvas gives you just that ability.
Canvas is a class in Android that performs 2D drawing of different objects onto the screen. The saying “a blank canvas” is very similar to what a Canvas object is on Android. It is basically, an empty space to draw onto.
You’ve used all the standard Android animation techniques, but you find that they sometimes just don’t give you that extra sparkle you are looking for. You’ve wondered how to get more natural looking animations and had no luck thinking about how to do it yourself. So here you are, reading this article in the hope that you will learn how to create beautiful, natural, physics-based animations in your app. 🌈
The physics-based animation library is not new, but it was largely unexplored territory for me. Having always used the “standard” animation options (i.e.
view.animate()), I had never found a need…
Have you ever wanted to write a Custom View on Android but you were too afraid to deal with X, Y translations on a Canvas object?
Well, working with them got a whole lot easier when using Kotlin and the Android KTX Extension functions provided by the Android Team at Google.
If you want to translate (move) an object you are drawing on a
Canvas, how would you go about doing that? You would likely need to do something like the following:
Canvas#restore() can be used to
save() the current matrix (transformations like translate, rotate etc) and…
Supporting ChromeOS devices sounds like a large undertaking with many unknowns. If you didn’t know already, ChromeOS allows users to install Android Apps on their devices. This is great news for ChromeOS users since it unlocks a huge amount of apps that previously weren’t available to them.
ChromeOS support seems like a big task that you may not think is important to implement. But if you do a bit of research into the Chromebook usage, you will see that there is a large portion of the US market that uses Chromebooks. ChromeOS made up 59.6% of mobile computing sales in…