When it comes to solving the Dependency Inversion principle, there is no better way then using annotations in the JVM world. However, generating code in compile time has some costs. For example the build time. And I believe this is the only thing dagger can’t do well alone. This is not a bye bye dagger post. This is mostly, obtaining the most out of Dagger. To solve this problem, Dagger-Reflect was written.
Once getting inside the open source concept, the idea and desire to publish a library is inevitable. What you need is an idea, or perhaps make a better version of an existing library, or just you need to use some module inside your company for several projects. With the JitPack, you won’t be suffering at all. So how do you do it? For the sake of this tutorial, I’m just gonna make a logging library.
The dark mode, perhaps is one of the easiest functionality to implement without breaking literally anything in existing project. However, it has it’s own hidden costs, tricks. Before implementing the Dark mode, what is most important is that your project must be ready for dark mode. What I had: What I wanted to achieve: The setup: The only thing you need to do to get your app ready for dark mode is the themes tag and the AppCompatDelegate class.
One of my previous article Dagger Multibinding Saved My Time “claimed” to have found the right practice for providing ViewModels without producing a ViewModel Factory for each ViewModel. Apparently, I was wrong. There are 2 main problems with that approach: 1 - I might forget to add a ViewModel in the Map graph. 2 - With the new SavedStateHandle which stays uniqely in each ViewModel I can’t use a generic ViewModel Factory.
Room persistence library is one of the easiest one to set up. However, when using data classes for your Room entities, you might face some small problem, which on the first look doesn’t really make any sense. Let’s try to compile this class: @Entity(tableName = "users") data class User( @PrimaryKey @ColumnInfo(name = "id") val number: Int, @ColumnInfo(name = "user_name") val userName: String, @ColumnInfo(name = "user_status") val userStatus: String, @Ignore val englishNameMeaning: UserGrade ) The problem:
_Inspired by myself and perhaps some other people, who coded Java style in Kotlin. I have seen tones of articles which (mostly) highlight Kotlins null safety and nothing more. So that’s it? If it was only for that I swear I would be still using Java with some null checks. Therefore, this article suggest what to use best in Kotlin as well as droping some everyday Java habits. _