Efficient Flow Management, High-Order Functions, Jetpack Compose, Circular Progress Indicator, Kotlin, and more! | by Shahla Aliyeva | Aug, 2023
Just as always, we are reachable via editors@proandroiddev.com. We look forward to reading your feedback, article submissions, and partnership ideas. Follow us on Facebook and Twitter, and see you soon! Cheers, ProAndroidDev Team Sergii Zhuk . Greg Fawson . Andy Dyer . Brian Gardner ….
Unleashing Creativity with Custom Modifiers in Android Jetpack Compose | by Nirbhay Pherwani | Aug, 2023
Example 1 — Gradient Background Modifier Create a custom modifier that applies a gradient background to a composable. This can be used to provide a consistent visual theme across your app’s components. Gradient Background Custom Modifier fun Modifier.gradientBackground(colors: List<Color>): Modifier = composed {drawWithContent {drawRect(brush =…
Animated Circular Progress Indicator using Jetpack Compose | by Shoaib Mushtaq | Aug, 2023
How do we show the progress status? Here is the progress status composable to show progress in text form. For example, we are showing 15/20 in the centre with different styles and colours based on typography. How do we draw an arc for Circular Progress…
Igniting High-Order Thinking: Empowering Code with High-Order Functions | by Stephen Siapno | Aug, 2023
FUN [CTIONAL] PROGRAMMING SERIES Unlocking Code Potential: Embracing High-Order Functions for Creative Thinking Photo by Simon Berger on Unsplash Have you ever wondered why we call it a “High-Order Function” in programming? The name sounds fancy, but there’s a reason behind it. To understand, let’s…
Let Kotlin do the code for you — Part II: Retrofit and Proxy | by André Oriani | Aug, 2023
Learning how to create a simple version of Retrofit from scratch A line of robots typing code in computers, pencil art — DALLE-2 Retrofit is undoubtedly one of the most important libraries for Android development. It allows implementing REST APIs by just specifying an interface,…
Recreating UseCase: Embracing a Fluent and Fun Approach (2023) | by Stephen Siapno | Aug, 2023
After delving into functional programming, I began to investigate ways to enhance my use case. I initiated the code below, which shares similarities with my second article on Fluent and Fun Clean Architecture. fun placeOrderUseCase(orderRepository: OrderRepository) {if (orderRepository.isLoggedIn()) {val cart = orderRepository.getCart()if (cart.isNotEmpty()) {if (orderRepository.hasEnoughFunds(getTotalPrice()))…
Kotlin’s Supercharged Flow API — Combining and Merging Flows for Reactive Programming | by Nirbhay Pherwani | Aug, 2023
.combine is a function provided by Kotlin’s Flow API. It allows us to combine two or more flows into a single flow, emitting values whenever any of the source flows emit a new value. This is useful for scenarios where you want to react to…
MenuProvider API— Android. In this article, we will learn how to… | by Nav Singh | Aug, 2023
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {super.onViewCreated(view, savedInstanceState)// Add options menu to the toolbarrequireActivity().addMenuProvider(object : MenuProvider {override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {menuInflater.inflate(R.menu.main_menu, menu)}override fun onMenuItemSelected(menuItem: MenuItem): Boolean {return when (menuItem.itemId) {R.id.settings -> {true}else -> false}}}, viewLifecycleOwner)} Source link
Compose Multiplatform — managing UI State on iOS | by Guilherme Delgado | Aug, 2023
When you use Compose Multiplatform on iOS, the Kotlin code for your UI is compiled to native code using Kotlin/Native. This native code is then used to create a UIKit-based UI that runs on the iOS platform. Compose Multiplatform for iOS provides the Kotlin APIs…
Seamless Play of D&D — Implementing Drag and Drop Across Multiple Screens in Your Android App with Jetpack Compose | by Nirbhay Pherwani | Aug, 2023
The LongPressDraggable composable function is the foundation of our seamless D&D experience. It allows us to wrap any content (ex. horizontal pager) with dragging behavior, making it draggable upon a long-press gesture. Code @Composablefun LongPressDraggable(modifier: Modifier = Modifier,content: @Composable BoxScope.() -> Unit) {val state =…