Skip to main content

Giorgos Neokleous

Level up your Compose Previews

This should be a quick blog post about @PreviewParameter in Jetpack Compose. This annotation allows us to provide a class called PreviewParameterProvider. The PreviewParameterProvider is responsible for providing data to our previews in jetpack compose. Setup We are going to use the basic hello world from the Android Studio Wizard. @Composable fun Greeting(name: String, modifier: Modifier = Modifier) { Text( text = "Hello $name!", modifier = modifier ) } If we want to preview this so that we get instant feedback then we will do something like:

Kotlin's Coroutines Testing Tips

Introduction Do you love Kotlin’s Coroutines? So do I! Kotlin’s Coroutines offer many benefits such as: Readability: the following code can be read line by line and understand the order of execution without going into callbacks (at least on what the developers write). suspend fun runTwoExpensiveOperations() { // Running First Operation val resultOfFirstExpensiveOperation = withContext(Dispatchers.IO) { runFirstExpensiveOperation() } // Running Second Operation val resultOfSecondExpensiveOperation = withContext(Dispatchers.IO) { runSecondExpensiveOperation(resultOfFirstExpensiveOperation) } return resultOfSecondExpensiveOperation } Reactive capabilities: Flows, Channels, StateFlow come with a lot of operators which provide an API for hot and cold streams.

Let’s talk (Tts)Spans in Android Accessibility

A great talk from the Google IO 2019 called “Demystifying Android Accessibility Development” mentions that when designing apps, we often miss to account for the users with accessibility needs. Users with accessibility needs won’t interact with the app directly, but instead they will use tools such as the Android Accessibility Suite (includes Talkback and Switch Access). The user will interact with the Accessibility service and then the service will interact with the app.

Full-Screen Intent Notifications – Android

What are Full-Screen Intents? Full-Screen Intents are Intents that can launch in full-screen and can be used for showing a full-screen notification. Well, I guess that needs a bit more explanation so keep on reading. From the official docs: Your app might need to display an urgent, time-sensitive message, such as an incoming phone call or a ringing alarm. In these situations, you can associate a full-screen intent with your notification.

Documenting your XML attributes – Custom View

Today, I will walk you through on how to create a very basic Custom View, and we will do something that many libraries and developers often forget to do: Documenting XML Attributes, which offer customizations on custom views. Why Documentation sometimes is redundant if the method, class or property is self-describing. However, imagine any Android API without it. Android development will instantly turn into living hell. To figure out what’s going on we will have to step into source code and trial-and-error different options.