# Ban Markovic

Stories by Ban Markovic on Medium

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Why I Built Bloomind

DevFeed: [Why I Built Bloomind](<https://devfeed.tech/articles/why-i-built-bloomind-106534.md>)

Original publisher: [Read original article](<https://medium.com/@banmarkovic/why-i-built-bloomind-e491c215e828?source=rss-8aced922ece------2>)

Author: Ban Markovic

Published: 2026-10-26T00:00:16Z

Content type: article

Language: en

Sources: [Ban Markovic](<https://devfeed.tech/sources/stories-by-ban-markovic-on-medium.md>)

Topics: [experience report](<https://devfeed.tech/topics/experience-report.md>), [Tool](<https://devfeed.tech/topics/tool.md>), [X (Twitter)](<https://devfeed.tech/topics/twitter.md>)

Tags: [advice](<https://devfeed.tech/tags/advice.md>), [android](<https://devfeed.tech/tags/android.md>), [books](<https://devfeed.tech/tags/books.md>), [challenge](<https://devfeed.tech/tags/challenge.md>), [focus](<https://devfeed.tech/tags/focus.md>), [goals](<https://devfeed.tech/tags/goals.md>), [habits](<https://devfeed.tech/tags/habits.md>), [indiedev](<https://devfeed.tech/tags/indiedev.md>), [ios](<https://devfeed.tech/tags/ios.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [learn](<https://devfeed.tech/tags/learn.md>), [learning](<https://devfeed.tech/tags/learning.md>), [memory](<https://devfeed.tech/tags/memory.md>), [podcasts](<https://devfeed.tech/tags/podcasts.md>), [principles](<https://devfeed.tech/tags/principles.md>), [programming](<https://devfeed.tech/tags/programming.md>), [reading](<https://devfeed.tech/tags/reading.md>), [self-improvement](<https://devfeed.tech/tags/self-improvement.md>), [social-media](<https://devfeed.tech/tags/social-media.md>), [software](<https://devfeed.tech/tags/software.md>), [software-developer](<https://devfeed.tech/tags/software-developer.md>), [story](<https://devfeed.tech/tags/story.md>), [technology](<https://devfeed.tech/tags/technology.md>)

### AI overview

Bloomind aims to help people retain useful ideas from books and podcasts by making regular review easier. The author describes saving notes, quotes, and advice in one place, then using gamified spaced repetition: Play mode prioritizes notes not seen for the longest time, tracks which ideas may be fading, and shows mastery across life areas. This replaces an endless feed with short review sessions around ideas the user chose to remember. The author also built Bloomind to learn Kotlin Multiplatform and Swift while bringing the app to Android and iOS.

### Source excerpt

Have you ever heard a piece of advice that felt like it could change your life, and a week later you couldn't even remember what it was? That happened to me more times than I'd like to admit. And after a while I realized it wasn't just about forgetting a quote or a tip. I was forgetting the things I actually wanted to become. This is the story of why I built Bloomind, what problem I'm trying to solve, and how building it turned into a challenge of its own. Learning never stops, in code and in life I've been on my self-improvement path for the last 5 or 6 years. During that time I noticed something that I already knew very well from my job as a software developer. In programming, you can't stop learning. Languages change, frameworks come and go, and the moment you stop learning, you start falling behind. It turns out life works in a very similar way. If you want your life to get better, you need to keep learning and discovering new things, about your health, your relationships, your work and yourself. Luckily, there is no shortage of great material. Over the years I found so many helpful lessons in books and podcasts. Some of them really changed how I think and how I live. The problem: I kept forgetting But there was a catch. I would read a book, highlight the parts I liked, listen to a great podcast episode, and feel motivated. Then, a few weeks later, most of it was gone. Even worse, I would forget what I was striving for. The goals and principles that felt so clear while I was reading slowly faded away, and I would fall back into the same old habits. Later I learned that this is completely normal. Our memory drops very fast after we learn something, unless we come back to it. I wrote about the science behind this, and what you can do about it, in How to Remember What You Read: 7 Techniques That Actually Work. The bigger problem: everyone is fighting for our focus There was another thing I couldn't ignore. Today's technology, and social media especially, is built t

## Jetpack Compose Clip or Cut a Composable with Custom Image Shape

DevFeed: [Jetpack Compose Clip or Cut a Composable with Custom Image Shape](<https://devfeed.tech/articles/jetpack-compose-clip-or-cut-a-composable-with-custom-image-shape-25850.md>)

Original publisher: [Read original article](<https://medium.com/@banmarkovic/jetpack-compose-clip-or-cut-a-composable-with-custom-image-shape-062dde54d4b2?source=rss-8aced922ece------2>)

Author: Ban Markovic

Published: 2024-02-14T17:25:40Z

Content type: tutorial

Language: en

Sources: [Ban Markovic](<https://devfeed.tech/sources/stories-by-ban-markovic-on-medium.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [User Interfaces](<https://devfeed.tech/topics/user-interfaces.md>), [Image processing](<https://devfeed.tech/topics/image-processing.md>), [Image](<https://devfeed.tech/topics/image.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [androiddev](<https://devfeed.tech/tags/androiddev.md>), [clip](<https://devfeed.tech/tags/clip.md>), [component](<https://devfeed.tech/tags/component.md>), [compose](<https://devfeed.tech/tags/compose.md>), [compose-ui](<https://devfeed.tech/tags/compose-ui.md>), [example](<https://devfeed.tech/tags/example.md>), [game](<https://devfeed.tech/tags/game.md>), [gradient](<https://devfeed.tech/tags/gradient.md>), [health](<https://devfeed.tech/tags/health.md>), [hit](<https://devfeed.tech/tags/hit.md>), [image](<https://devfeed.tech/tags/image.md>), [jetpack](<https://devfeed.tech/tags/jetpack.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [layout](<https://devfeed.tech/tags/layout.md>), [progress](<https://devfeed.tech/tags/progress.md>), [ui](<https://devfeed.tech/tags/ui.md>)

### AI overview

The excerpt builds a health indicator by filling a gray square's bottom-aligned green area according to a 0.0-1.0 progress value, then describes shaping that fill to a plane image. Its example starts at full health and reduces the value by 0.1 per hit. For combining the composable layers, it introduces Android PorterDuff modes, which merge source and destination pixels, and Jetpack Compose's Modifier.drawWithContent as the customization mechanism. The supplied text cuts off before showing the drawing implementation.

### Source excerpt

As an Android developer, I face all sorts of challenges provided to me by my fellow designers. One of them was actually building an UI component that has a custom shape in a form of an image. This was required because we wanted to display a special type of a progress bar by fulfilling the image shape with gradient. Because I didn't find this functionality trivial to implement, I decided to show how I solved this issue with some fun example. Example Here is a simple game where I utilized cutting of my composable. The game consists of one plane with full health. Upon each hit, it looses 10% of its health. Game is over once the plane remains with no health. Game Setup First, let me show you how I formed the basic layout for this game. It will contain the gray square and Hit button. Column( modifier = Modifier.fillMaxSize().background(Color.Black), verticalArrangement = Arrangement.Center, horizontalAlignment = Alignment.CenterHorizontally ) { Box( modifier = Modifier .size(240.dp) .background(Color.LightGray) ) Spacer(modifier = Modifier.height(40.dp)) Button( onClick = { /* TODO */ } ) { Text("HIT") } } Next step, is to create custom Composable called SquareHealth. SquareHealth is expecting the progress value (from 0.0 to 1.0). This will determine the height of the green area inside my gray square (aligned at bottom). It will represent remaining health for my Square. @Composable fun SquareHealth(healthPercentage: Float) { Box( modifier = Modifier .size(240.dp) .background(Color.LightGray) ) { Box( modifier = Modifier .fillMaxWidth() .height((240 * healthPercentage).dp) .background(Color.Green) .align(Alignment.BottomCenter) ) } } Now, I can call it instead of the static gray Box inside my screen. The basic layout is now set, and I just need to set initial health progress to 1.0, and enable my button to decrease the health percentage by 0.1 on each click. var healthPercentage by remember { mutableStateOf(1.0f) } Column( modifier = Modifier .fillMaxSize() .background(Co

## What Every Android Developer Should Have in Their GitHub?

DevFeed: [What Every Android Developer Should Have in Their GitHub?](<https://devfeed.tech/articles/what-every-android-developer-should-have-in-their-github-25844.md>)

Original publisher: [Read original article](<https://blog.stackademic.com/what-every-android-developer-should-have-in-their-github-de8deab051b9?source=rss-8aced922ece------2>)

Author: Ban Markovic

Published: 2024-02-05T11:00:04Z

Content type: article

Language: en

Sources: [Ban Markovic](<https://devfeed.tech/sources/stories-by-ban-markovic-on-medium.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [GitHub](<https://devfeed.tech/topics/github.md>), [MVVM](<https://devfeed.tech/topics/mvvm.md>), [dagger-hilt](<https://devfeed.tech/topics/dagger-hilt.md>), [Dagger](<https://devfeed.tech/topics/dagger.md>), [REST API](<https://devfeed.tech/topics/rest-api.md>), [RxJava](<https://devfeed.tech/topics/rxjava.md>), [Test-driven development](<https://devfeed.tech/topics/tdd.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-development](<https://devfeed.tech/tags/android-development.md>), [androiddev](<https://devfeed.tech/tags/androiddev.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [asynchronous-communication](<https://devfeed.tech/tags/asynchronous-communication.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [dagger](<https://devfeed.tech/tags/dagger.md>), [dependency-injection](<https://devfeed.tech/tags/dependency-injection.md>), [fetching](<https://devfeed.tech/tags/fetching.md>), [github](<https://devfeed.tech/tags/github.md>), [hilt](<https://devfeed.tech/tags/hilt.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [koin](<https://devfeed.tech/tags/koin.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [livedata](<https://devfeed.tech/tags/livedata.md>), [mvi](<https://devfeed.tech/tags/mvi.md>), [mvvm](<https://devfeed.tech/tags/mvvm.md>), [navigation](<https://devfeed.tech/tags/navigation.md>), [portfolio](<https://devfeed.tech/tags/portfolio.md>), [rest-api](<https://devfeed.tech/tags/rest-api.md>), [rxjava](<https://devfeed.tech/tags/rxjava.md>), [unit-tests](<https://devfeed.tech/tags/unit-tests.md>)

### AI overview

The article recommends a compact Android GitHub showcase with two screens: fetch a list from a REST API, display it, and let users open an item's details. It advises demonstrating either MVI or MVVM, organizing files by feature or type, handling asynchronous work with a library such as Kotlin Coroutines, LiveData, or RxJava, and using dependency injection with Hilt, Dagger, or Koin. It also recommends unit tests for ViewModel, UseCase, and Repository classes. The article presents these as ways to show core Android development skills to potential employers; it does not compare the listed architecture or library options.

### Source excerpt

In the competitive world of Android development, having a strong GitHub portfolio is crucial for showcasing your skills to potential employers. One effective way to demonstrate your expertise is by creating a concise yet comprehensive project that highlights key aspects of Android development. In this article, we'll explore the essential components that every Android developer should have in their GitHub, focusing on a project that encapsulates fundamental skills. The Project Overview A successful showcase project should include two screens and cover the following key functionalities: Fetching and Displaying Data - Utilize a REST API to fetch a list of items. - Display this list on the first screen of the app. Navigation and Detailed Information - Enable users to navigate to a second screen by clicking on a specific item. - On the second screen, display more detailed information about the selected item. Key Considerations for the Showcase ProjectArchitecture -- MVI or MVVM Clearly implement and showcase your understanding of the chosen architecture (MVI or MVVM). Organize code files in a logical and easily understandable structure. File Organization Demonstrate a well-organized project structure, separating concerns and making codebase easily maintainable (feature-based or type-based folders structure). Asynchronous Communication Showcase your proficiency in handling asynchronous tasks by using an appropriate library (e.g., Kotlin Coroutines, LiveData, RxJava). Unit Tests Impress potential employers by including unit tests to validate the functionality of critical components (cover your ViewModel, UseCase, Repository classes with unit tests). Dependency Injection (DI): Implement and demonstrate your use of dependency injection for managing component dependencies (Hilt, Dagger, Koin). Why This Project Matters This concise project effectively showcases your abilities in: Displaying a list of items Fetching data from the internet Implementing navigation between screens

## Get current flavor in Android Gradle

DevFeed: [Get current flavor in Android Gradle](<https://devfeed.tech/articles/get-current-flavor-in-android-gradle-25847.md>)

Original publisher: [Read original article](<https://medium.com/@banmarkovic/get-current-flavor-in-android-gradle-6d23d27259e3?source=rss-8aced922ece------2>)

Author: Ban Markovic

Published: 2023-08-07T12:20:20Z

Content type: tutorial

Language: en

Sources: [Ban Markovic](<https://devfeed.tech/sources/stories-by-ban-markovic-on-medium.md>)

Topics: [Gradle](<https://devfeed.tech/topics/gradle.md>), [Android](<https://devfeed.tech/topics/android.md>), [Android Gradle Plugin](<https://devfeed.tech/topics/android-gradle-plugin.md>), [Groovy](<https://devfeed.tech/topics/groovy.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [android-development](<https://devfeed.tech/tags/android-development.md>), [androiddev](<https://devfeed.tech/tags/androiddev.md>), [flavors](<https://devfeed.tech/tags/flavors.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [groovy](<https://devfeed.tech/tags/groovy.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [programming](<https://devfeed.tech/tags/programming.md>)

### AI overview

The article's approach reads `gradle.startParameter.taskRequests` and extracts the flavor from a task name matching `assemble<Flavor><Debug|Release>` or `bundle<Flavor><Debug|Release>`. Its Kotlin DSL and Groovy versions choose the `assemble` pattern when the task request text contains `assemble`, otherwise the `bundle` pattern; both lowercase the captured flavor and return an empty string after printing `NO FLAVOR FOUND` if no match is found. The supplied text presents this as a way to conditionally include or exclude plugins or libraries based on the selected flavor.

### Source excerpt

Gradle is a topic that most Android developers postpone to learn as much as they can. This happens until we realize that it is a crucial part when it comes to packaging our apps or SDKs (here is my article that can help you out with understanding Gradle better). Since the diversity of Android devices is huge, we always need to strive not to package unnecessary things. Product flavors Sometimes it is required from us to publish different versions of our app, depending on the different requirements of our clients. This leads us to having one codebase that can support multiple configuration changes (enabling or disabling particular features) depending on our clients. To avoid changing our code each time we want to publish a different version of our app, we use product flavors. They enable us to set up different app variants at project level, and then we can reference them in our code, in order to enable or disable something. Problem Enabling or disabling particular features inside our Kotlin code is not that complex, but in order to follow those toggles, sometimes we would also like to include or exclude some plugins or libraries. Since this type of work is done in Gradle, there is a need for us to know which product flavor is selected in our Gradle file. Solution Writing Gradle scripts can be done with Kotlin DSL or Groovy, and since we already know Kotlin, I will focus on explaining the Kotlin DSL solution and later on I will also provide the full Groovy version of our getCurrentFlavor function. By using Kotlin DSL in our Gradle scripts, we can add any function at the bottom of our app/build.gradle.kts file, so let's create our getCurrentFlavor() function that returns an empty String. fun getCurrentFlavor(): String { return "" } Since we are inside our build.gradle.kts file, we have a reference to a Gradle object that belongs to our project. Inside it, we have the information of the parameters that the Gradle object uses for starting the build. By having that informa

## Which Cross-platform Framework to Choose For Building Startup as an Android Developer

DevFeed: [Which Cross-platform Framework to Choose For Building Startup as an Android Developer](<https://devfeed.tech/articles/which-cross-platform-framework-to-choose-for-building-startup-as-an-android-developer-25845.md>)

Original publisher: [Read original article](<https://blog.startupstash.com/which-cross-platform-framework-to-choose-for-building-startup-as-an-android-developer-45488d68a4d?source=rss-8aced922ece------2>)

Author: Ban Markovic

Published: 2023-05-02T09:34:59Z

Content type: opinion

Language: en

Sources: [Ban Markovic](<https://devfeed.tech/sources/stories-by-ban-markovic-on-medium.md>)

Topics: [Flutter](<https://devfeed.tech/topics/flutter.md>), [React Native](<https://devfeed.tech/topics/react-native.md>), [Android](<https://devfeed.tech/topics/android.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [app-development](<https://devfeed.tech/tags/app-development.md>), [cross-platform](<https://devfeed.tech/tags/cross-platform.md>), [css](<https://devfeed.tech/tags/css.md>), [dart](<https://devfeed.tech/tags/dart.md>), [developer](<https://devfeed.tech/tags/developer.md>), [flutter](<https://devfeed.tech/tags/flutter.md>), [framework](<https://devfeed.tech/tags/framework.md>), [ios](<https://devfeed.tech/tags/ios.md>), [java](<https://devfeed.tech/tags/java.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [native](<https://devfeed.tech/tags/native.md>), [next](<https://devfeed.tech/tags/next.md>), [programming](<https://devfeed.tech/tags/programming.md>), [project](<https://devfeed.tech/tags/project.md>), [react](<https://devfeed.tech/tags/react.md>), [react-native](<https://devfeed.tech/tags/react-native.md>), [skills](<https://devfeed.tech/tags/skills.md>), [startup](<https://devfeed.tech/tags/startup.md>), [typescript](<https://devfeed.tech/tags/typescript.md>), [users](<https://devfeed.tech/tags/users.md>)

### AI overview

The author chose Kotlin Multiplatform (KMM) for a startup app targeting Android and iOS, based on an Android background and a plan to share four of five common feature layers--ViewModel, UseCase, Repository, and DataSource--while building each platform's UI natively. KMM can also share UI states with ViewModels, leaving the iOS work focused on its UI layout. In brief practice projects, React Native felt messy to the author, who cited JavaScript libraries requiring TypeScript "any" types and a dislike of CSS. Flutter was enjoyable, and Dart seemed better than Java, but less appealing than Kotlin. The author acknowledges limited experience with both frameworks and says further learning would be needed; the choice is a personal assessment, not a detailed comparison.

### Source excerpt

I've been working as an Android developer for more than five years, and it is definitely an interesting job. Specializing in one field enables you to have a great career, as long as you are willing to improve day by day. Even though I like the path I've taken in my career, there is always one small voice in the back of my head that bugs me. It always reminds me that my skills are quite limited when working on some personal ideas. No business is focused solely on Android applications. There are some businesses that support only the iOS platform, but in most cases, it is expected of you to support both iOS and Android. Personal project For some time now, I had an idea regarding a mobile application that could help users in their self-improvement journey. I built the team necessary for developing it. We clarified the features we wanted to build and designed the actual MVP. Next step: development. Choosing cross-platform framework Since I'm the only one in the team that has experience in developing mobile apps, it is my duty to develop mobile apps for iOS and Android. I've experimented on my own with React Native and Flutter for a few practice projects over the past couple years. I can't say I spent a lot of time on them, but I did form some opinions. React Native was something that didn't click for me. Everything looked so messy, probably because I'm used to object-oriented programming approach and here I was using Javascript. I'm aware of Typescript, however several libraries are written in Javascript, thus I had to use a lot of undefined type "any" when interacting with them in Typescript. This felt really dirty to me, since I'm coming from the Java and Kotlin environment. Also, I'm not a big fan of CSS. Flutter was something that I enjoyed playing with. Especially for the first time I experimented with Dart. It seemed like a great improvement compared to the Java Android project. Later on, when I switched to Kotlin, I saw that even though Dart seemed better than Jav

## What is Gradle and why do we use it as Android developers?

DevFeed: [What is Gradle and why do we use it as Android developers?](<https://devfeed.tech/articles/what-is-gradle-and-why-do-we-use-it-as-android-developers-25852.md>)

Original publisher: [Read original article](<https://medium.com/@banmarkovic/what-is-gradle-and-why-do-we-use-it-as-android-developers-572a07b3675d?source=rss-8aced922ece------2>)

Author: Ban Markovic

Published: 2023-01-16T12:52:02Z

Content type: article

Language: en

Sources: [Ban Markovic](<https://devfeed.tech/sources/stories-by-ban-markovic-on-medium.md>)

Topics: [Gradle](<https://devfeed.tech/topics/gradle.md>), [Android](<https://devfeed.tech/topics/android.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [domain-specific language](<https://devfeed.tech/topics/domain-specific-language.md>), [Learning](<https://devfeed.tech/topics/learning.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [automate](<https://devfeed.tech/tags/automate.md>), [automation-tools](<https://devfeed.tech/tags/automation-tools.md>), [build-tool](<https://devfeed.tech/tags/build-tool.md>), [developers](<https://devfeed.tech/tags/developers.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [groovy](<https://devfeed.tech/tags/groovy.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [tasks](<https://devfeed.tech/tags/tasks.md>)

### AI overview

Gradle automates Android app builds and publishing; Android Studio's Run action triggers Gradle tasks to resolve dependencies, compile Java or Kotlin code, package code and resources into an APK, then install and run it. The article explains that Gradle build scripts use a Groovy or Kotlin DSL and walks through the project's settings.gradle, root build.gradle, and app module build.gradle: settings configures plugin and dependency repositories and included modules; the root file holds shared plugins and configuration; the app file defines module plugins, dependencies, SDK levels, versioning, flavors, and build types. It distinguishes dependencies, which provide libraries used in app code, from plugins, which provide Gradle build tasks, and illustrates how Groovy syntax such as omitted parentheses compares with Kotlin syntax.

### Source excerpt

At the start of a journey for an Android developer, no one pays attention to Gradle. We are mostly focused on writing Kotlin code and developing Android apps that bring great value to our customers and look as beautiful as possible. When building them, sometimes we stumble upon a problem that is already solved by someone else on the internet and they were kind enough to share their project in a form of library, that we are able to implement in our app, and customize it to our needs. To be able to do so, we are using build.gradle file for implementing those libraries that help us build our apps, by specifying their unique package names and versions. This is probably the most common use case of our Gradle usage inside our Android projects. Motivation At the beginning of my career I didn't see a need for better understanding of Gradle, because for me it represented only the place where I wrote the names of the libraries I wanted to use inside my project. With that kind of approach, I didn't have any knowledge regarding it, and I was scared to change anything inside those files, because I was afraid I would break everything. After some time I realized that gradle files are built with code.. And I am a programmer.. So why am I avoiding it when I can learn it like any other programming language. What an epiphany, right? That's why I decided to write an article regarding the gradle files inside Android project. Just so anyone can read and understand them. Gradle Gradle is a build tool that we use for Android development to automate the process of building and publishing apps. Now, you may think that building and running the application is quite easy; we can just press Run button in Android Studio. Well, that just triggers Gradle's built-in tasks (functions) that are responsible for running the application on our emulator or real device. This process requires a couple of steps to be successfully completed in order for us to see the running app. These are the general steps t

## Jetpack Compose clear back stack, popBackStack inclusive explained

DevFeed: [Jetpack Compose clear back stack, popBackStack inclusive explained](<https://devfeed.tech/articles/jetpack-compose-clear-back-stack-popbackstack-inclusive-explained-25849.md>)

Original publisher: [Read original article](<https://medium.com/@banmarkovic/jetpack-compose-clear-back-stack-popbackstack-inclusive-explained-14ee73a29df5?source=rss-8aced922ece------2>)

Author: Ban Markovic

Published: 2023-01-03T10:31:50Z

Content type: tutorial

Language: en

Sources: [Ban Markovic](<https://devfeed.tech/sources/stories-by-ban-markovic-on-medium.md>)

Topics: [jetpack-navigation](<https://devfeed.tech/topics/jetpack-navigation.md>), [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>)

Tags: [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [androiddev](<https://devfeed.tech/tags/androiddev.md>), [compose](<https://devfeed.tech/tags/compose.md>), [inclusive](<https://devfeed.tech/tags/inclusive.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [navigation](<https://devfeed.tech/tags/navigation.md>)

### AI overview

With Jetpack Compose navigation, `navigate(route)` adds a destination to the back stack, while `popBackStack()` removes the top destination. Passing a route and `inclusive` to `popBackStack` removes destinations above that route and optionally the route itself; if the route is absent, nothing closes. To clear the stack without knowing its first screen, the text says to pop to the root navigation graph, using its route or graph ID. It recommends `popUpTo` over `popBackStack` for this purpose because `popBackStack` must be followed by navigation to avoid an empty stack.

### Source excerpt

Jetpack Compose clear back stack, popUpTo/popBackStack inclusive explained Building the navigation for our Android app that is built with Jetpack Compose requires usage of navigation-compose library that is provided by Android team. In order to master closing the screens and tracking our back stack state, it is important to understand the stack data structure that is used for this purpose. Before we can close multiple screens, we need to open them. That's why I decided to separate this article into three sections that represent the most common ways used when navigating through apps: Opening a new screen, Closing current screen, Closing multiple screens at once. Open new screen Navigating from one to another screen is pretty straightforward using navigation-compose lib, we can just use NavHostController and call navigate(...) function with the route as parameter. This will lead into creating a new screen, that is going to be placed on top of our current screen. Example Let's say we have our Login screen opened, and after successful email and password input, we want to load Home screen, our stack would look like this. Close current screen Apart from navigating to a new screen, closing the currently opened one is also a pretty common action in navigation. To achieve this, we can use popBackStack() function from our NavHostController. As the name of the function suggests, it will take the top screen from the stack, and it will remove it. Example Removing our Home screen by calling the popBackStack function will make our stack look like this. Close multiple screens The past two examples were pretty simple, but I wanted to make sure that we understand how navigation-compose lib is storing the data regarding the order of our opened screens. When it comes to closing multiple screens, we can actually use an already known function, popBackStack, but we will need to pass two parameters: route -- represents the destination (screen) that already exists in our stack, and it will ena

## Jetpack Compose OTP input field

DevFeed: [Jetpack Compose OTP input field](<https://devfeed.tech/articles/jetpack-compose-otp-input-field-25853.md>)

Original publisher: [Read original article](<https://proandroiddev.com/jetpack-compose-otp-input-field-bcfa22c85e5f?source=rss-8aced922ece------2>)

Author: Ban Markovic

Published: 2022-12-19T14:51:05Z

Content type: tutorial

Language: en

Sources: [Ban Markovic](<https://devfeed.tech/sources/stories-by-ban-markovic-on-medium.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [Android](<https://devfeed.tech/topics/android.md>), [User interface design](<https://devfeed.tech/topics/ui-design.md>), [User Interfaces](<https://devfeed.tech/topics/user-interfaces.md>), [software-development](<https://devfeed.tech/topics/software-development.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [android-development](<https://devfeed.tech/tags/android-development.md>), [androiddev](<https://devfeed.tech/tags/androiddev.md>), [apps](<https://devfeed.tech/tags/apps.md>), [authentication](<https://devfeed.tech/tags/authentication.md>), [authorization](<https://devfeed.tech/tags/authorization.md>), [code](<https://devfeed.tech/tags/code.md>), [component](<https://devfeed.tech/tags/component.md>), [compose](<https://devfeed.tech/tags/compose.md>), [compose-ui](<https://devfeed.tech/tags/compose-ui.md>), [custom](<https://devfeed.tech/tags/custom.md>), [design](<https://devfeed.tech/tags/design.md>), [design-principles](<https://devfeed.tech/tags/design-principles.md>), [development](<https://devfeed.tech/tags/development.md>), [field](<https://devfeed.tech/tags/field.md>), [fields](<https://devfeed.tech/tags/fields.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [input](<https://devfeed.tech/tags/input.md>), [jetpack](<https://devfeed.tech/tags/jetpack.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [otp](<https://devfeed.tech/tags/otp.md>)

### AI overview

The excerpt describes building a six-digit OTP input in Jetpack Compose with BasicTextField. It recommends keyboardType NumberPassword because the Number keyboard may include punctuation, and limits input by ignoring updates longer than six characters. For a six-box display, it uses decorationBox to render the underlying field as a Row of six bordered Text composables with spacers; each box shows the character at its index or stays empty. The current position is based on the input length and can be highlighted with a darker, thicker border. The author favors this approach over coordinating six separate TextFields, which they describe as potentially complex for cursor movement. The supplied text ends during the length-restriction explanation, while the accompanying extracted text provides the later styling details.

### Source excerpt

One-time password (OTP), also called dynamic password, one-time PIN, and one-time authorization code (OTAC), is password that is only valid for one login session. Most commonly, it is received in a format of 4 or 6 digit code, through SMS, and it used for implementation of two-factor authentication. Implementing OTP support inside our mobile apps requires us to build a custom UI input field, which should be strictly customized for handling the received OTP code. Motivation Since Jetpack Compose is a new UI toolkit for Android development, I wanted to write an article regarding how we can make our own custom OTP input field using BasicTextField. Custom OTP input Creating input fields with Compose UI is quite simple. There is already an existing Material component called TextField, that we can use. It has a lot of built-in functionalities because it follows Material design principles. That also comes with some drawbacks, for example, if we wanted to customize our input field, we would have struggled to do so with TextField, because it isn't as flexible. That's why we need another component that is a bit lower-level compared to TextField, but it enables us to customize it the way that suits us the best. I'm talking about BasicTextField. Implementation Firstly, lets implement a simple BasicTextField that enables it to open a keyboard with only numbers. We can do that by setting up the keybaordOptions parameter with keyboardType set to NumberPassword. If you've wondered why we use NumberPassword and not just Number, it is because the keyboard that is opened for the Number keyboard type contains dot, comma and dash characters, and we don't need anything other than digits inside our OTP input field. Next step we need to do is to implement more restrictions inside our input field. In case we know that our OTP must be a 6 digit code, our input field should be able to receive max 6 digits, and not allow user to input more than that. To accomplish max characters restriction, w

## Jetpack Compose under the hood

DevFeed: [Jetpack Compose under the hood](<https://devfeed.tech/articles/jetpack-compose-under-the-hood-25851.md>)

Original publisher: [Read original article](<https://medium.com/@banmarkovic/jetpack-compose-under-the-hood-7bb88f08c47e?source=rss-8aced922ece------2>)

Author: Ban Markovic

Published: 2022-12-12T10:49:33Z

Content type: article

Language: en

Sources: [Ban Markovic](<https://devfeed.tech/sources/stories-by-ban-markovic-on-medium.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [User Interfaces](<https://devfeed.tech/topics/user-interfaces.md>), [Android](<https://devfeed.tech/topics/android.md>), [User interface design](<https://devfeed.tech/topics/ui-design.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [android-apps](<https://devfeed.tech/tags/android-apps.md>), [androiddev](<https://devfeed.tech/tags/androiddev.md>), [apis](<https://devfeed.tech/tags/apis.md>), [app-development](<https://devfeed.tech/tags/app-development.md>), [base](<https://devfeed.tech/tags/base.md>), [basic](<https://devfeed.tech/tags/basic.md>), [bind](<https://devfeed.tech/tags/bind.md>), [change](<https://devfeed.tech/tags/change.md>), [changes](<https://devfeed.tech/tags/changes.md>), [code](<https://devfeed.tech/tags/code.md>), [complexity](<https://devfeed.tech/tags/complexity.md>), [components](<https://devfeed.tech/tags/components.md>), [compose](<https://devfeed.tech/tags/compose.md>), [data](<https://devfeed.tech/tags/data.md>), [deprecated](<https://devfeed.tech/tags/deprecated.md>), [designers](<https://devfeed.tech/tags/designers.md>), [developers](<https://devfeed.tech/tags/developers.md>), [developing](<https://devfeed.tech/tags/developing.md>), [jetpack](<https://devfeed.tech/tags/jetpack.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>)

### AI overview

Android UI development has repeatedly changed how developers access and update XML views, from findViewById and Butter Knife through Kotlin synthetics, ViewBinding, and DataBinding. The excerpt attributes this churn to growing UX complexity and the demand for flexible, reusable code. It frames Jetpack Compose as a new system best understood by comparing it with the Android View System, and says the article will use a "Hello World" screen as a comparison example. The excerpt does not provide the Compose implementation or explain its internals.

### Source excerpt

The development of Android mobile apps is nothing new. We have been doing it since 2009, when the Android SDK was published. In the meantime, many APIs used for developing Android mobile apps were updated, but the general idea of app development remained. Looking at something as basic as accessing the UI elements and modifying them, we can see the constant need for improvement and change. We've started with findViewById, then we transferred to Butter Knife library. After we switched from Java to Kotlin, we were introduced to Kotlin synthetics, then it went deprecated soon enough, and it was replaced by ViewBinding. In the meantime, we also received a new support library, DataBinding, that enabled us to bind our UI components to data sources from our app. As we can see, even though the final goal was the same (accessing UI elements defined inside XML and modifying their values), the APIs for reaching our goal were changed quite drastically and quite often. Why so many changes? The constant need for polishing the UX of ours apps introduced a lot more complexity in our mobile app projects. Designers demand more and more from their developers, and developers constantly strive for making their code as flexible and reusable as possible. This is something that gets harder and harder to accomplish when your base is not particularly designed for handling new types of designers requirements. Motivation To better learn something new, we need to understand the differences between what we know (Android View System) and the new things that are introduced by the new system (Jetpack Compose). Sometimes this feels overwhelming, because at the beginning, most of it looks like magic as we don't know anything about it. By familiarizing ourselves with Jetpack Compose way of working, we are putting ourselves in a better position to utilize this new tool. Android View System The base for developing Android apps most of us are currently using is Android View System. It is here since 2009 a

## Jetpack Compose Bottom Border

DevFeed: [Jetpack Compose Bottom Border](<https://devfeed.tech/articles/jetpack-compose-bottom-border-25848.md>)

Original publisher: [Read original article](<https://medium.com/@banmarkovic/jetpack-compose-bottom-border-8f1662c2aa84?source=rss-8aced922ece------2>)

Author: Ban Markovic

Published: 2022-11-14T10:36:16Z

Content type: tutorial

Language: en

Sources: [Ban Markovic](<https://devfeed.tech/sources/stories-by-ban-markovic-on-medium.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [Tutorial](<https://devfeed.tech/topics/tutorial.md>), [User Interfaces](<https://devfeed.tech/topics/user-interfaces.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [androiddev](<https://devfeed.tech/tags/androiddev.md>), [border](<https://devfeed.tech/tags/border.md>), [canvas](<https://devfeed.tech/tags/canvas.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [jetpack-compose-tutorial](<https://devfeed.tech/tags/jetpack-compose-tutorial.md>)

### AI overview

Jetpack Compose's default border support does not cover drawing a single edge, so the excerpt shows how to draw a bottom border with `Modifier.drawBehind` and `DrawScope.drawLine`. Set the line's start to `(0, size.height)` and end to `(size.width, size.height)` to span the component's bottom edge. The example uses a red, 4 dp stroke; convert its width to pixels with `4.dp.toPx()` because `drawLine` expects pixel units. The excerpt notes that the same canvas approach can be adapted to other edges, but does not include the remainder of the implementation.

### Source excerpt

Android Jetpack Compose provides us API for drawing borders on any UI component, and it couldn't be any easier. But, drawing single edge borders isn't supported yet, by default. Goal This article will show you a custom way of drawing bottom borders step by step using Canvas. Hopefully at the end of it, you will learn not only how to draw a bottom border, but you will be able to use that knowledge to draw any border on any side (top, bottom, left, right) you want. Solution Drawing something on the screen basically leads to accessing the canvas and telling it where to draw which pixel. Luckily for us, Jetpack Compose's Modifier element comes with the method drawBehind, that provides us access to the canvas behind given UI element with a lot of drawing options through DrawScope. drawBehind -- Draw into a Canvas behind the modified content. DrawScope -- Creates a scoped drawing environment with the provided Canvas. The DrawScope has a lot of helper methods for drawing onto our canvas. In our case, we want to draw the bottom border, which is basically the simple line that is placed at the bottom of our UI component. By having access to the DrawScope and its Canvas, we can use DrawScope's helper function drawLine to draw our bottom border. drawLine To draw any line, there are a couple of parameters we need to define: color, width, start point, end point. In this example, we will draw a red line with the width of 4 dp (but you can change this to your liking, sky is the limit). The only step that is missing for drawing our bottom border is defining our start and end point. Let's first look at our Text UI component to have a better understanding of the canvas that we are working with. In this example, our canvas is basically everything that is gray, and the bottom of it we want to draw a line. Canvas is represented with a coordinate system, so every point is defined by two values x and y. Top-left corner of our UI component's canvas, is represented with (0, 0). Bottom-right co