When you are done, you will find yourself with additional boilerplate code in each fragment. Inspired by this article Simple one-liner ViewBinding in Fragments and Activities with Kotlin I’ve created a little bit modified version of the fragment one-line view binding solution.
I’m happy to share with you my new article at @AT&T Israel R&D Center Medium blog >>> https://bit.ly/2Noc2SO The default logging solution is minimal, and I believe that most of us have already written a wrapper class and copied it from project to project. Originally I created my Logging library in Java and recently I converted it to Kotlin. Now I want to share it with you.
If you are reading this, I assume that you have reached the same point as I have in the past and you decided to dig a little bit and understand what Kotlin DSL is all about.
Upon googling it, I found the following post that explains this topic pretty well. If you wonder why this post exists, it’s because here I’ll try to explain the same topic with the same code example, but in a more detailed manner. I decided to do so because it took me a while to understand it myself and I’d like to simplify it for you.
The whole solution is available in the following file: Github
Almost in all my projects during the last five years, I used my custom logging library. But Koltin language has come and finally, I wrote it in Kotlin.
Create a project and select the template “Navigation Drawer Activity”. You will get the ToolBar, Drawer and navigation stuff for free as shown in the screenshot.
Now, let’s assume that we got a request to move the drawer under the ToolBar. We need to modify activity_main.xml for that.
Create vertical LinearLayout and make it wrapping DrawerLayout
Open app_bar_main.xml copy AppBarLayout and paste it as a first item in the previously created LinearLayout.
Also from the app_bar_main.xml get the include (content_main) and put it as a first child of DrawerLayout instead of existing include of app_bar_main.xml.
Delete app_bar_main.xml file
In v21\styles.xml – remove the line that makes status bar transparent.