<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Gérard Paligot on Medium]]></title>
        <description><![CDATA[Stories by Gérard Paligot on Medium]]></description>
        <link>https://medium.com/@GerardPaligot?source=rss-7055bef5fa63------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Np7tVOyPRHslpXEaBARioA.jpeg</url>
            <title>Stories by Gérard Paligot on Medium</title>
            <link>https://medium.com/@GerardPaligot?source=rss-7055bef5fa63------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 07:03:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@GerardPaligot/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building for multi-form factor devices in Android: The optimal architecture]]></title>
            <link>https://proandroiddev.com/building-for-multi-form-factor-devices-in-android-the-optimal-architecture-6311221463ab?source=rss-7055bef5fa63------2</link>
            <guid isPermaLink="false">https://medium.com/p/6311221463ab</guid>
            <category><![CDATA[adaptive]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[architecture-components]]></category>
            <category><![CDATA[jetpack-compose]]></category>
            <dc:creator><![CDATA[Gérard Paligot]]></dc:creator>
            <pubDate>Tue, 12 Nov 2024 10:02:22 GMT</pubDate>
            <atom:updated>2024-11-29T04:25:01.707Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CmxybFjv1I2x-C6CbiPp7w.jpeg" /><figcaption>Generated by Ideogram.ai</figcaption></figure><p>This article is inspired by a talk I gave with David Ta in 2024, entitled <em>“Why is Adaptive Layout a Nightmare?”</em>. During that presentation, we wanted to explain how complex it was to migrate an existing Android application to be compatible with adaptive layouts and the unexpected obstacles which you face across different screen sizes and device configurations. The journey of creating adaptive layouts can indeed feel like a nightmare if you don’t have the proper architectural foundation.</p><p>In this post, I’ll present a summarized version of our talk on component modular architecture. This architectural pattern provides a structured solution to achieve designs that are adaptable and reusable in a layered manner. With its multiple layers, a developer can more easily handle navigation, the content at screen levels, and the UI components with ease, making adaptive layouts practical and less challenging to maintain.</p><h3>The component architecture: Modular design to support additional form factors</h3><p>As Android applications get more complex and need to handle new form factors like phones, tablets, and foldable devices, traditional architectures can be rigid to handle with the unique demands on each device type. Component architecture addresses these challenges by breaking the presentation layer into modular levels of granularity that are specifically designed for adaptability and scalability across diverse screen configurations.</p><h4>Overview of the component architecture</h4><p>The component architecture organizes the presentation layer into three hierarchical levels:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i9i5XlxvlrjSB2meC8neAw.jpeg" /><figcaption>Gradle modules categorized by component levels</figcaption></figure><ol><li><strong>App-Level (navigation layer):</strong> The app level deals with the global navigation of the application, structures, and flows across different screens. This level makes components handle centralized control over navigation while adapting to various device sizes. In such architecture, the use of navigation components is targeted to toggle between bottom navigation, navigation rails, or drawers concerning device configuration so that it can respond dynamically to changes in screen dimensions.</li><li><strong>Screen-Level (adaptive layouts and panes):</strong> Screen-level components are responsible for managing layout and structure within a given screen, such that on different screen sizes and orientations, it would adapt to them. Components that may change their layout as the window size changes. This level uses scaffolds like SupportingPaneScaffold or ListDetailPaneScaffold that enable adaptive layouts and make sure content is always presented in the most optimal way for each of the form factors. For example, a screen can display only one pane on a small device, but automatically switch to a dual-pane layout on larger screens.</li><li><strong>UI Component Level (reusable components):</strong> The UI component level consists of smaller reusable components across various screens. These components are isolated and focus on individual UI elements, which do not change in device configuration but are foundational to screen-level compositions. Examples include buttons, icons, or text fields. By modularizing these components, the architecture allows for reuse and rapid testing across a wide number of screens and layouts.</li></ol><h4>Key characteristics</h4><ol><li><strong>Modularity and reusability:</strong> Instead of having a single monolithic app strategy, the component approach really encourages modular components to make use of such things as navigation, displays of content, and specific UI elements, which can be reused across various devices and screen configurations. It becomes an ideal paradigm for multi-form factor compatibility whereby each component may independently be designed to adapt to various form factors without affecting the whole application.</li><li><strong>Adaptive UI components:</strong> Components are designed with adaptability in mind in top of WindowSizeClass add and adaptive scaffolds like NavigationSuiteScaffold, SupportingPaneScaffold, and ListDetailPaneScaffold. These scaffolds automatically change according to different screen dimensions, adapting screen real estate and screen orientation into proper layout.</li><li><strong>Separation of Concerns:</strong> Compared to other architectures, component architecture extends the principle of separation of concerns, decoupling UI logic from business logic and device-specific configurations. Each layer is going to stay independent, but the UI components will adjust dynamically due to screen size, whereas business logic with core functionalities would remain the same. Due to this approach, code will not be complex; testing is easy, and allows developers to avoid spreading changes in one layer across an entire codebase.</li></ol><h3>Component modular architecture: Structured for adaptability</h3><p>In the component modular architecture, components are organized in distinct modules of the presentation layer for better adaptability and maintainability on different screen sizes and device configurations. The modular structure may have three major levels: an application-level, screen-level and a UI component-level. Each of these levels corresponds to a separate module so that the structure of an application is able to cope with multi-form factor devices without noticeable efforts.</p><p>The modular architecture in the presentation layer is divided into three hierarchical levels:</p><p><strong>App-Level</strong>: App-level components, like AppNavigation, are placed in a centralized module, typically named <em>main</em> or <em>navigation</em>. This layer controls primary navigation elements across the app, managing the flow and layout of screens in response to different device configurations.</p><pre>@Composable<br>fun AppNavigation(<br>   navActions: Immutable&lt;NavAction&gt;,<br>   routeSelected: String,<br>   modifier: Modifier = Modifier,<br>   navController: NavHostController = rememberNavController(),<br>) {<br>   NavigationSuiteScaffold(<br>      modifier = modifier,<br>      navigationSuiteItems = {<br>         navActions.forEach { action -&gt;<br>            val selected = action.route == routeSelected<br>            item(<br>               selected = selected,<br>               icon = {<br>                  Icon(<br>                     imageVector = if (selected) action.iconSelected else action.icon,<br>                     contentDescription = action.contentDescription<br>                  )<br>               },<br>               onClick = {<br>                  // use navController to navigate to your screen<br>               }<br>            )<br>         }<br>      }<br>   ) {<br>      NavHost(<br>         navController = navController,<br>         startDestination = &quot;first-screen&quot;,<br>         builder = {<br>            // composables<br>         }<br>      )<br>   }<br>}</pre><p><strong>Screen-Level</strong>: Screen-level components, including those that manage adaptive layouts and link to ViewModels, are organized into a module called <em>presentation</em>. This module includes adaptive components like MyScreenAdaptive, which handles layout adjustments based on the device’s WindowSizeClass. Additionally, screen-level components specific to different panes are grouped in a module named <em>panes</em>.</p><pre>@Composable<br>fun MyScreenAdaptive(<br>   showFilterIcon: Boolean,<br>   modifier: Modifier = Modifier,<br>) {<br>   SupportingPaneScaffold(<br>       modifier = modifier,<br>       mainPane = {<br>           MyFirstPaneVM()<br>       },<br>       supportingPane = {<br>           MySecondPaneVM(showFilterIcon = showFilterIcon)<br>       }<br>   )<br>}</pre><p><strong>UI Component-Level (reusable components)</strong>: Contain small UI parts, such as buttons and icons. Those are organized in the <em>ui</em> module of each specific feature. For more general components, UI components are developed at the internal design system level for common use across different screens and features.</p><p>By assigning components to the <em>main</em>, <em>presentation</em>, <em>panes</em>, and <em>ui</em> modules, the architecture ensures a structured approach in both flexibility and high scalability. This modular hierarchy enables each layer independently to be tested, maintained, and updated while reducing dependency, thus best suited for multi-form factor design.</p><h3>Why Modular, component-based architecture is ideal for multi-form factors compatibility</h3><p>Embracing this modern architecture will greatly enhance the flexibility and adaptability of your app across devices. Let me just outline why this approach will fit perfectly for you:</p><h4>Enhanced adaptability with less code</h4><ul><li><strong>Automatic UI adjustment:</strong> Components such as NavigationSuiteScaffold will automatically handle different device configurations without requiring you to adjust the layout manually.</li><li><strong>Less redundancy:</strong> Due to the reusable elements, it is no longer a need for creating separate layouts or components for each device type. ListDetailPaneScaffold and SupportingPaneScaffold self-adjust according to the size of the screen, reducing redundancy of code per screen level.</li></ul><h4>Improved scalability and maintainability</h4><ul><li><strong>Modular codebase:</strong> Separation of navigation, panes and UI components will allow you to develop screens for any device without worrying about the device configuration.</li><li><strong>Lower maintenance costs</strong>: It reduces the total number of views or layouts to maintain, with fewer errors and easier updates. This modularity is extremely valuable when handling compatibility problems as new device types emerge.</li></ul><h4>Simplification of consistent UI</h4><p>This architecture lends itself to naturally forcing consistency of UI. Adaptive scaffolds, such as NavigationSuiteScaffold and SupportingPaneScaffold, keep design patterns consistent across devices for cohesiveness in user experience no matter the form factor.</p><h3>Conclusion</h3><p>The notion of building multi-form factor compatible applications for Android devices automatically requires a rethink in architecture. Conventional Android architectures are very efficient in building simple apps, probably single-screen apps, but start to limit the developers as screen variations grow. Google’s new component-based and modular architecture empowers developers to design adaptive UIs that can dynamically change with screen size and configuration with minimal redundancy in code and less load of maintenance. This is the architecture that would enable Android developers to create applications, keeping users in mind by providing a seamless experience on all devices while remaining efficient and highly scalable over time.</p><p>This new approach makes it even easier to deliver high-quality applications, giving one a consistent and adaptive experience across the diverse Android ecosystem.</p><p>Thanks for reading this blog post. If you like it, please clap this article and follow me on <a href="https://bsky.app/profile/paligot.com">Bluesky</a>, <a href="https://androiddev.social/@gerardpaligot">Mastodon</a>, <a href="https://github.com/GerardPaligot">GitHub</a> and <a href="https://medium.com/@GerardPaligot">Medium</a> to be notified about my next blog posts!</p><p>Thanks to my reviewer <a href="https://twitter.com/Smoochibi">David Ta</a> for this article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6311221463ab" width="1" height="1" alt=""><hr><p><a href="https://proandroiddev.com/building-for-multi-form-factor-devices-in-android-the-optimal-architecture-6311221463ab">Building for multi-form factor devices in Android: The optimal architecture</a> was originally published in <a href="https://proandroiddev.com/">ProAndroidDev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[String resources API for Compose Multiplatform]]></title>
            <link>https://proandroiddev.com/string-resources-api-for-compose-multiplatform-9e0bf6618506?source=rss-7055bef5fa63------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e0bf6618506</guid>
            <category><![CDATA[kotlin-multiplatform]]></category>
            <category><![CDATA[androiddev]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[jetpack-compose]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Gérard Paligot]]></dc:creator>
            <pubDate>Mon, 25 Mar 2024 19:56:58 GMT</pubDate>
            <atom:updated>2024-03-26T02:26:06.714Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Q3TOxGVRKgUt_A45" /><figcaption>Photo by <a href="https://unsplash.com/@camstejim?utm_source=medium&amp;utm_medium=referral">camilo jimenez</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>With Compose Multiplatform 1.6, Jetbrains finally provides an official solution to declare string resources for every supported platform in Kotlin Multiplatform projects. As described in the <a href="https://blog.jetbrains.com/kotlin/2024/02/compose-multiplatform-1-6-0-release/">official blog post</a>, you’ll be able to create <em>composeResources</em>, a new resource set, located at the same level as the <em>commonMain</em> source set. This resource set supports images, fonts, strings or any raw files that you want to display or use in your project.</p><p>In this article, we’ll focus on string resources. Before Compose Multiplatform, you probably used <a href="https://github.com/icerockdev/moko-resources">moko-resources</a> or <a href="https://github.com/adrielcafe/lyricist">lyricist</a>. These two libraries are good and do the job pretty well. But what we needed was an official solution to handle this key feature in a frontend application, evolving with Kotlin versions and tooling around the language. It is now a reality since it landed in Compose Multiplatform as a new feature.</p><h3>Configuring your KMP module</h3><p>Before starting to try the new resources API, don’t forget to update your Compose Multiplatform Gradle plugin to be able to test these new features.</p><pre>plugins {<br>   id(&quot;org.jetbrains.compose&quot;).version(&quot;1.6.0&quot;)<br>}</pre><p>When it is done, the plugin will generate a Kotlin class named <em>Res</em>, inside your build folder and add the target build folder as an additional source set in your module. With this new Gradle plugin, you’ll be able to add a new Gradle dependency, <strong>compose.components.resources</strong>. Declare it in <em>commonMain</em> source set in your <em>build.gradle.kts</em> file and you’ll be able to use string resources in your codebase.</p><pre>kotlin {<br>   sourceSets {<br>       val commonMain by getting {<br>           dependencies {<br>               implementation(compose.components.resources)<br>           }<br>       }<br>   }<br>}</pre><p>Now, if you are an Android developer, you’ll feel at home. Declaring a string resource is an XML file where you can add your string item or array. This <em>strings.xml</em> file is saved in a <em>values</em> folder (default language) under <em>composeResources</em> but you can add a language code (<a href="https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes">ISO 639–1</a>) and a regional code (<a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166–1 alpha-2</a>) to switch automatically at the runtime to the correct translation. e.g. <em>values-fr</em> contains all translations for the French language and <em>values-fr-rFR</em> only for the France region.</p><h3>How to use string resources?</h3><p>Here is an example of a string item you can declare in a <em>strings.xml</em> file.</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;resources&gt;<br>   &lt;string name=&quot;key1&quot;&gt;My value&lt;/string&gt;<br>&lt;/resources&gt;</pre><p>This string <strong>key1</strong> item is accessible by <em>Res.string.key1</em> and returns a <em>StringResource</em> instance class. This is the first big difference compared to the native way in Android development.</p><p>If you are an Android developer, you know that <em>R.string.key1</em> is an identifier that needs to be given to the Android SDK to get the correct translation from the resource files.</p><p>With Compose Multiplatform, the string resource location is described in <em>StringResource</em> and is read by string rendering functions to get the correct translation. The Android SDK is no more used by the UI framework.</p><pre>// string rendering Compose functions<br>fun stringResource(resource: StringResource): String<br>fun stringResource(resource: StringResource, vararg formatArgs: Any): String<br>fun stringArrayResource(resource: StringResource): List&lt;String&gt;<br><br>// string rendering no Compose functions<br>suspend fun getString(resource: StringResource): String<br>suspend fun getString(resource: StringResource, vararg formatArgs: Any): String<br>suspend fun getStringArray(resource: StringResource): List&lt;String&gt;</pre><p>Probably intentionally, string rendering functions are similar to the official ones in Jetpack Compose for Android. The only difference is essentially on the import side:</p><pre>import org.jetbrains.compose.resources.stringResource<br><br>Text(text = stringResource(Res.string.key1))</pre><blockquote><strong>Information:</strong> string rendering functions dedicated to non-Compose code doesn’t need anymore Android context. This allows you to use these functions anywhere in a Kotlin Multiplatform module without actual/expect mechanism to hide the Android context.</blockquote><h3>String templates</h3><p>If your strings are correctly configured, you can inject two kinds of arguments, string or decimal. You just need to follow this specification: <strong><em>%{order}${d or s}</em></strong>. “order” is the argument order in your string, “d” means decimal et “s” means string. Here are some examples:</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;resources&gt;<br>   &lt;string name=&quot;key1&quot;&gt;My value&lt;/string&gt;<br>   &lt;string name=&quot;key2&quot;&gt;%1$s value&lt;/string&gt;<br>   &lt;string name=&quot;key3&quot;&gt;%1$s and %2$d values&lt;/string&gt;<br>&lt;/resources&gt;</pre><ul><li><strong>key1</strong> is a classic string.</li><li><strong>key2</strong> is a string template where you can insert a string.</li><li><strong>key3</strong> is another string template but with two arguments. The first one is for a string, the second one is for a decimal.</li></ul><p>The usage is pretty simple, you can use string rendering functions with arguments parameter to inject your data at runtime.</p><pre>import org.jetbrains.compose.resources.stringResource<br><br>Text(text = stringResource(Res.string.key3, “Text”, 0))</pre><blockquote><strong>Warning:</strong> In Compose Multiplatform, the string template implementation is very basic and doesn’t have any check. More information in the last section about friction points.</blockquote><h3>Current limitations</h3><blockquote><strong>Information:</strong> These limitations will probably be fixed in the future. They are true with Compose Multiplatform 1.6.x but the more Jetbrains will work on resource management, the better will be the support of string resources.</blockquote><h4>Plurals</h4><p>In the <a href="https://developer.android.com/guide/topics/resources/string-resource#Plurals">Android documentation</a>, quantity strings are declared with a <em>plurals</em> item and inside zero, one, two, few, many or other. According to the language, you can use some of them to handle plurals for your strings.</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;resources&gt;<br>   &lt;plurals name=&quot;key_plural&quot;&gt;<br>      &lt;item quantity=&quot;one&quot;&gt;%1$d other&lt;/item&gt;<br>      &lt;item quantity=&quot;many&quot;&gt;%1$d others&lt;/item&gt;<br>   &lt;/plurals&gt;<br>&lt;/resources&gt;</pre><p>If you try to declare a plural in the compose resource set, you won’t have any error but the string won’t be accessible from the <em>Res</em> class either. As a workaround, you need to implement by yourself the choice between singular or plural which can become increasingly difficult depending on the countries you support.</p><p>Just declare a string with a suffix or prefix for the quantity and in the Kotlin codebase, choose the best translation according to your context.</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;resources&gt;<br>   &lt;string name=&quot;key_plural_one&quot;&gt;%1$d other&lt;/string&gt;<br>   &lt;string name=&quot;key_plural_many&quot;&gt;%1$d others&lt;/string&gt;<br>&lt;/resources&gt;</pre><h4>Arguments limitations</h4><p>When you are using an argument inside a string, you have to declare the argument order after the “%” character and if it is a string or a decimal after the “$” character. But when you check how these arguments are interpreted by Compose Multiplatform, you can notice something strange:</p><pre>private val SimpleStringFormatRegex = Regex(&quot;&quot;&quot;%(\d)\$[ds]&quot;&quot;&quot;)<br><br>@OptIn(ExperimentalResourceApi::class)<br>private suspend fun loadString(<br>   resource: StringResource,<br>   args: List&lt;String&gt;,<br>   resourceReader: ResourceReader,<br>   environment: ResourceEnvironment<br>): String {<br>   val str = loadString(resource, resourceReader, environment)<br>   return SimpleStringFormatRegex.replace(str) { matchResult -&gt;<br>       args[matchResult.groupValues[1].toInt() - 1]<br>   }<br>}</pre><p>No matter the order or if it is a string or a decimal, it’ll simply iterate over all arguments and replace argument tags by the value of the current argument.</p><p>Yes, this first implementation is a bit naive and will probably be enhanced in future versions.</p><h3>Multimodule support</h3><p>You can’t declare a compose resource set in a Gradle module and use these resources outside this module but the reason is pretty simple. When you build your project, the Compose Multiplatform plugin generates a <em>Res</em> object class with a <em>string</em> object class and every string resource is a Kotlin extension on this last object.</p><p>Even if <em>string</em> is public, <em>Res</em> is internal and therefore can’t be accessed outside the module.</p><pre>package project.module.generated.resources<br><br>internal object Res {<br> public object string<br>}<br><br>@ExperimentalResourceApi<br>internal val Res.string.key1: StringResource<br>  get() = String0.key1</pre><p>This limitation is a real constraint, since it requires you to create several compose resource sets in your modules, potentially duplicating resources, or to create a module dedicated to resources and expose your resources through your own object resource, which won’t be private.</p><pre>object Resource {<br>   object string<br>}<br><br><br>@OptIn(ExperimentalResourceApi::class)<br>val Resource.string.key1: StringResource<br>   get() = Res.string.key1</pre><p>It requires you to rewrite every generated Kotlin extension but it works. Note that the multi module support is already in the roadmap followed by Jetbrains and will be fixed in the future.</p><h4>Android optimizations</h4><p>You probably know but when you use an Android resource folder and package your application with aab, the Google Play Store is smart enough to optimize your application based on the device configuration (cpu architecture, locales, etc.) when your user downloads it.</p><p>The compose resource set isn’t an Android resource folder and won’t be optimized by the Google Play Store. So you have to accept the fact that your final artifact will be bit bigger.</p><h3>Conclusion</h3><p>Kotlin Multiplatform is an incredible technology and Compose Multiplatform is very interesting. Jetbrains will need time to clarify the future direction of this technology but is working hard to remedy certain shortcomings.</p><p>If you already develop a mobile application with Compose Multiplatform, I wouldn’t recommend basing your resources on this new feature yet. There are too many friction points for an application available in several countries and with stakes in reducing the size of the final archive.</p><p>But track new versions Compose Multiplatform to know when these friction points will be resolved. This official solution has the potential to become the new standard in Kotlin Multiplatform projects!</p><p>Thanks for reading this blog post. If you like it, please clap this article and follow me on <a href="https://androiddev.social/@gerardpaligot">Mastodon</a>, <a href="https://twitter.com/GerardPaligot">X</a>, <a href="https://github.com/GerardPaligot">GitHub</a> and <a href="https://medium.com/@GerardPaligot">Medium</a> to be notified about my next blog posts!</p><p>Thanks to my reviewer <a href="https://twitter.com/Smoochibi">David Ta</a> for this article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e0bf6618506" width="1" height="1" alt=""><hr><p><a href="https://proandroiddev.com/string-resources-api-for-compose-multiplatform-9e0bf6618506">String resources API for Compose Multiplatform</a> was originally published in <a href="https://proandroiddev.com/">ProAndroidDev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SwiftUI vs Jetpack Compose by an Android Engineer]]></title>
            <link>https://proandroiddev.com/swiftui-vs-jetpack-compose-by-an-android-engineer-6b48415f36b3?source=rss-7055bef5fa63------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b48415f36b3</guid>
            <category><![CDATA[jetpack-compose]]></category>
            <category><![CDATA[androiddev]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Gérard Paligot]]></dc:creator>
            <pubDate>Mon, 21 Mar 2022 13:02:44 GMT</pubDate>
            <atom:updated>2022-03-24T14:26:06.552Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zh0zDYoxpXNgzT_v" /><figcaption>Photo by <a href="https://unsplash.com/@vojtechbruzek?utm_source=medium&amp;utm_medium=referral">Vojtech Bruzek</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>If you think it is a good idea to use Jetpack Compose (or any other multi-platform UI library like Flutter or React Native) to build an Android and iOS application, it is probably because you’ve never developed or used an iOS application before. That was my case not so long ago and it was definitely a bad idea.</p><h3>Nice to meet you iOS</h3><p>For a recent project, I created a mobile application for Android and, for the first time, iOS. My first idea was to wait for the compatibility of Jetpack Compose with the iOS system, but that was also the opportunity for me to learn SwiftUI and I chose this last option.</p><p>This project is a real application, not just developed to write this article. It’ll be used as the mobile application for the Devfest Lille, a French tech event in Lille. You can find the entire source code in this GitHub repository.</p><p><a href="https://github.com/GerardPaligot/conferences4hall">GitHub - GerardPaligot/conferences4hall: Import Conference Hall event data to create an agenda and show it in an Android and iOS application</a></p><p>Now let’s go back to my story. Before I started to write my first line of Swift code, I took my wife’s iPhone to know more about the system. I was surprised to realize that there are a lot of differences between Android and iOS. Where in Android, we have Material and everyone can implement it like they want, on iOS you don’t have any choice. If you want to build an iOS application which respects the platform guidelines, you have only one way.</p><p>I started an exploration phase of the iOS system to know more about fundamental design principles and about the user experience on the navigation in order to understand the better approach to interact with components.</p><h3>Differences between SwiftUI and Jetpack Compose</h3><p>Compose and SwitfUI are both new declarative UI frameworks. Due to this paradigm, it is easy to develop with one of them if you know the other one. As an Android engineer, I develop a lot with Jetpack Compose and even if it was the first time I used SwiftUI and the language Swift, it was easy to get started. However, there are some key differences.</p><p>First difference is that SwiftUI is packaged with the OS where Compose is a library. Even if performance will be better with SwiftUI because it is pre-compiled in the system, I prefer the Compose approach. I know there is a better user adoption of new OS versions in the iOS ecosystem, but there are always two (sometimes three) versions in parallel. If you need a new feature in the framework, you need to wait for your project to configure the appropriate minimum version where you just need to upgrade the library version with Compose.</p><p>Second difference is that SwiftUI uses protocol implementation where Compose uses a compiler plugin and the composition. The composition is an elegant way to delegate a responsibility to another class but I’m forced to admit that the SwiftUI approach doesn’t require adding a Modifier equivalent to all my components.</p><p>Thirdly, maybe the worst idea but also the best one, is the strong coupling of SwiftUI with the system. Due to this decision, it is hard to write an application which doesn’t respect the design of iOS. With Compose, you can easily create a component which respects Material specifications but you need much more code to build an application with a beautiful UI.</p><p>This last point is a design decision from Google.</p><h3>Jim Sproch on Twitter: &quot;This was a conscious design decision on our part. We work hard to avoid baking platform assumptions into the framework and taking privileged positions; we believe it leads to better code quality and a more vibrant ecosystem, resulting in a better overall product in the long term. / Twitter&quot;</h3><p>This was a conscious design decision on our part. We work hard to avoid baking platform assumptions into the framework and taking privileged positions; we believe it leads to better code quality and a more vibrant ecosystem, resulting in a better overall product in the long term.</p><p>The reasons are good and understandable. With this design decision, Jetpack Compose is now multi-platform and can be used for desktop, web and soon iOS. But this decision is at the expense of a better experience for developers who build applications only for the Android platform.</p><h3>Where is SwiftUI better than Compose?</h3><p>Of course, this section won’t be exhaustive. I don’t know all things inside SwiftUI but I’ve a short list where I think that SwiftUI experience is insanely better compared to Jetpack Compose.</p><h4>Previews</h4><p>Previews are available in both technologies but with Compose and Android Studio, it is often broken (sometimes, you don’t know why) and you are quickly limited in possibilities. You can just preview a composable function which emits UI without any request call or a dependency to a ViewModel.</p><p>In SwiftUI and Xcode, it is much more permissive. You can interact with your preview and load data asynchronously. You don’t need to think about your composable architecture to get a preview. However, my application is pretty small and I’m curious to see SwiftUI previews with a large code base.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*vSc_4nirAzpU6QuuccTRNw.gif" /><figcaption>SwiftUI vs Jetpack Compose Previews</figcaption></figure><h4>Toolbar navigation</h4><p>Maybe the most critical component inside a mobile application because it is the main component for the navigation and it is where you display the title of your current screen or the name of the application. You can’t create a mobile application without this component but fortunately, declaring this component is super easy for both platforms.</p><p>However, where you need to declare a dedicated component with Compose, it is a decorator with SwiftUI. You can call navigationTitle (and all variants) anywhere in your components hierarchy. That could be dangerous for complex navigation but Compose is worse. It is quickly hard to customize a toolbar shared between multiple screens if you are also using a bottom navigation.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cfe20f0f48a8c40ff1125996269c5903/href">https://medium.com/media/cfe20f0f48a8c40ff1125996269c5903/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9dc5ac3526a2aea06c5ce60bd3bad4e7/href">https://medium.com/media/9dc5ac3526a2aea06c5ce60bd3bad4e7/href</a></iframe><p>Where in SwiftUI, you declare what you want to display and let the framework handle the navigation for you. In Compose, you need much more code to handle the navigation and define a suitable architecture.</p><h4>Bottom sheet</h4><p>For now, the bottom sheet with Compose is a nightmare. You need at least the documentation to create a bottom sheet, sometimes blog posts to know how to handle complex navigation, because you are forced to use a BottomSheetScaffold or a ModalBottomSheetLayout which aren’t trivial components.</p><p>The equivalent in SwiftUI is just a decorative call on a component which takes a boolean value to know if it should show or not the bottom sheet. Super simple, don’t need to check any documentation, only one call on a screen component. I didn’t had to check the documentation to create this user experience and it worked directly without any issue.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9ab8c31a33dd6c3e30895c468e282b5b/href">https://medium.com/media/9ab8c31a33dd6c3e30895c468e282b5b/href</a></iframe><h4>Form</h4><p>In my application, I created a form where the user can insert a first name, last name, email address and a company. With that, I generate a QRcode which respects the vCard standard to share personal data between participants at the event.</p><p>With Compose, I can create filled or outlined text fields to display a form but if I need to combine visually text inputs or separate them with sections, I need to make it manually. That was my first approach with SwiftUI but after a little research, Form and Section help a lot to build a form with the correct look and feel and user experience.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7ac9fd44f055b45ae3275956c54cf81d/href">https://medium.com/media/7ac9fd44f055b45ae3275956c54cf81d/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/357288473a23eac3f862559237e7e191/href">https://medium.com/media/357288473a23eac3f862559237e7e191/href</a></iframe><h3>But SwiftUI isn’t perfect…</h3><p>Yes, SwiftUI is a good library but it’s not perfect. In my opinion, there are two big pain points when you develop with this UI framework.</p><h4>Navigation</h4><p>In SwiftUI, you need to declare a NavigationView and use NavigationLink inside your components to handle the navigation. It works well. Back stack and transitions are handled automatically but I got into the habit of moving events as high as possible in the components hierarchy to handle the navigation at the top level.</p><p>This approach is better because you can build components with a fixed contract without any dependency between screens. Your component doesn’t know that if you click on a button, it’ll start a new screen. Due to this, you can easily share your components in your code base or across applications.</p><p>It is also easier to initialize a ViewModel for your screen components if you can pass it from the top level of your application rather than sharing repositories through all components until it reaches a NavigationLink which will use it to create a new screen with its own ViewModel.</p><h4>Documentation</h4><p>When you come from Compose and the awesome documentation written by Google teams, the Apple documentation is really poor. You can find a short documentation inside Xcode when you click on a component but it is really limited and you often need more information when you use a component for the first time.</p><p>Moreover, SwiftUI isn’t open source and I don’t understand the reason for that. I check the Compose source code all the time to know how it is built inside the library to do the same, or similar, or for inspiration. When you want to check the SwiftUI component source code, you can find only a header file without any additional information.</p><p>Fortunately, there is the <a href="https://www.hackingwithswift.com/">hacking with Swift</a> website to help you when you are blocked but it should be done by Apple teams to avoid obsolete documentation in the future.</p><h3>Conclusion</h3><p>Is SwiftUI better than Compose? In my opinion, yes and no.</p><p>One thing that is certain is that SwiftUI is easier to use than Compose because Apple teams build the framework to respect iOS platform only without the perspective to use it with other platforms.</p><p>If you think it is a good idea to use Compose for both Android and iOS, I’ll probably disagree with you. It is important to respect UI/UX guidelines of the platform and Compose can’t build an application like SwiftUI does.</p><p>But design decisions made by Google teams aren’t bad either. Even if it can require more code than SwiftUI to create an interface, it is less than the XML approach and like the father of Compose (Jim Sproch) said, “it leads to better code quality and a more vibrant ecosystem”.</p><p>Thanks for reading this blog post. If you like it, please clap this article and follow me on <a href="https://twitter.com/GerardPaligot">Twitter</a>, <a href="https://github.com/GerardPaligot">GitHub</a> and <a href="https://medium.com/@GerardPaligot">Medium</a> to be notified about my next blog posts!</p><p>Thanks to my reviewers <a href="https://twitter.com/mslimanii">Mehdi Slimani</a>, <a href="https://twitter.com/maxime_maraval">Maxime Maraval</a>, <a href="https://twitter.com/Djava7">Djavan Bertrand</a>, <a href="https://twitter.com/FannyDemey">Fanny Demey</a> and <a href="https://twitter.com/Flo5929">Florent Lotthé</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b48415f36b3" width="1" height="1" alt=""><hr><p><a href="https://proandroiddev.com/swiftui-vs-jetpack-compose-by-an-android-engineer-6b48415f36b3">SwiftUI vs Jetpack Compose by an Android Engineer</a> was originally published in <a href="https://proandroiddev.com/">ProAndroidDev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jetpack Compose: How to play with Canvas?]]></title>
            <link>https://medium.com/@GerardPaligot/jetpack-compose-how-to-play-with-canvas-36d3638996b6?source=rss-7055bef5fa63------2</link>
            <guid isPermaLink="false">https://medium.com/p/36d3638996b6</guid>
            <category><![CDATA[jetpack-compose]]></category>
            <category><![CDATA[canvas]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[androiddevchallenge]]></category>
            <dc:creator><![CDATA[Gérard Paligot]]></dc:creator>
            <pubDate>Thu, 01 Jul 2021 07:15:07 GMT</pubDate>
            <atom:updated>2021-07-01T07:15:07.311Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WxjUTz82M-69L39n5bPQGw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@kellysikkema?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Kelly Sikkema</a> on <a href="https://unsplash.com/?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Previously, we looked at <a href="https://medium.com/decathlondevelopers/jetpack-compose-how-to-make-a-scrollable-list-6c8b0a98c98e">how to make a scrollable list</a> and how to change the scroll position programmatically. In this article, we’ll see how to play with the Canvas API inside Jetpack Compose, what we can draw with it and how to animate our custom components.</p><blockquote><strong>Disclaimer</strong>: All source code is developed with Compose 1.0.0-beta09. Because Jetpack Compose is now in beta, Compose api used in this article should be the same for new versions.</blockquote><h3>Compose Canvas API</h3><p>Compose creates an abstract layer on top of Android SDK Canvas to create a Compose version. It allows Compose to be compatible with external platforms and open incredible possibilities for Kotlin Multiplatform Projects (<a href="https://kotlinlang.org/docs/multiplatform.html">KMP</a>).</p><p>If you need the native canvas, you can get it but take care about its usage. When you create a project compatible with more platforms than Android, you need to check if there isn’t any other alternative for your use case.</p><p>For this article, we’ll focus on Compose Canvas API and its geometrical shape functions you can use to draw on the screen.</p><ul><li>drawLine draw a single line between two positions.</li><li>drawRect draw a rectangle with a position and size.</li><li>drawRoundedRect draw a rounded rectangle with a position, size and radius for corners.</li><li>drawArc draw an arc between two degrees.</li><li>drawCircle draw a circle at the provided center coordinate and radius.</li><li>drawOval draw an oval with a position and radius.</li><li>drawPath draw a path with a color.</li><li>drawPoints draw a list of points.</li></ul><p>We’ll use some of these methods to show the Canvas API capabilities! To illustrate this article, we’ll draw a counter component with a circular progress bar and markers around the component which is animated every second. This timer has been developed for the <a href="https://android-developers.googleblog.com/2021/05/androiddevchallenge-its-wrap.html">#AndroidDevChallenge 2021</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/369/1*p66KqqZiM96W1Di8WG33xQ.png" /><figcaption>Time counter developed for #AndroidDevChallenge 2021</figcaption></figure><h3>Draw the circular progress bar</h3><p>When you want to draw with the canvas, you have two possibilities: a Canvas component or the Modifier drawBehind on Composable. The second solution is interesting because you can draw something behind the content of a box. We’ll use this option.</p><p>The structure of our circular progress bar is a 360 degree arc of a circle behind a second arc that depends on the current timer value. When the timer goes down, we can see the white arc hidden by the purple arc.</p><p>The specification of drawArc function is pretty simple. You give a color or a gradient, the start angle (where 0 is positioned at 3 hours), the end angle, a parameter to close the center of the bounds and the style of the arc (where you can choose a filled or a stroke style).</p><blockquote><strong>Information:</strong> If you want to know all parameters of this function, you can just check its <a href="https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/drawscope/DrawScope#drawArc(androidx.compose.ui.graphics.Brush,kotlin.Float,kotlin.Float,kotlin.Boolean,androidx.compose.ui.geometry.Offset,androidx.compose.ui.geometry.Size,kotlin.Float,androidx.compose.ui.graphics.drawscope.DrawStyle,androidx.compose.ui.graphics.ColorFilter,androidx.compose.ui.graphics.BlendMode)">official documentation</a>.</blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7cebf0589385124f6b1d3a722f32948d/href">https://medium.com/media/7cebf0589385124f6b1d3a722f32948d/href</a></iframe><h3>Draw markers</h3><p>The marker is a little bit touchy and need mathematics knowledge because we want to draw a line around a circular progress bar where the inclination depends on the degree of the marker.</p><p>For example, to compute the start point of the marker, first compute the theta which will be used to compute the starter position x and y of the marker.</p><p>θ = (angle - 90) * π / 180</p><p>Second, compute the radius (r) where the last parameter represent the distance (D) between the center of your component and your marker inside this component.</p><p>r = width / 2 * D</p><p>Finally, compute the position x and y where you’ll use the theta value and your radius. These positions will be used by drawLine function to draw our marker at the good distance and with the correct radius.</p><p>x = cos(θ) * r</p><p>y = sin(θ) * r</p><p>You can use these formulas to compute the starting point and the destination point of your markers and call the Canvas function to draw your line.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/69df74b52609562cd535817d8b397ade/href">https://medium.com/media/69df74b52609562cd535817d8b397ade/href</a></iframe><h3>Animate your timer</h3><p>First, we’ll create a ViewModel with start, pause and stop functions. They will be linked to our buttons under our timer. When the timer is started, the ViewModel will have the responsibility to recompose our UI at each second.</p><p>Second, between each recomposition, we’ll animate our circular progress bar and our markers to have something more smooth for our users.</p><h4>Recomposition at each second</h4><p>Thanks to coroutines and flows, we have an elegant way to create a loop of 30 seconds, an event at each second to notify a subscriber and a mechanism to cancel our timer.</p><p>Create a coroutine context from your ViewModel scope to cancel automatically our timer and iterates as long as your coroutine scope is active or not finished. Finally, for each iteration in this loop, call delay function to wait 1 second.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d0a02caa41c3cb8eba9067b0fdf71a68/href">https://medium.com/media/d0a02caa41c3cb8eba9067b0fdf71a68/href</a></iframe><p>The _timer variable is typed by a state flow and is used to notify our UI and job variable is typed by Job, which contains our coroutine scope, where you can cancel at any time your timer. Here is complete implementation of our ViewModel.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0a705ed18334afeb4615708ab684a3ec/href">https://medium.com/media/0a705ed18334afeb4615708ab684a3ec/href</a></iframe><h4>Chrono component</h4><p>We have almost all our composables to draw our chrono component. Note that there is also a ChronoBackground component which is just a circular Box with a text to display the timer in seconds.</p><p>We’ll see how to combine our custom components but before, we’ll create two variables to animate our circular progress bar and our markers by their input values.</p><p>You have so many ways to animate your components. From the <a href="https://developer.android.com/jetpack/compose/animation">official documentation</a>, you can find this useful and complete illustration to guide you in the best choice for your context.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*Hmlryrg2zC3Sm1Tiouiv6g.png" /><figcaption>Official decisional tree to choice the best way to animate your UI</figcaption></figure><p>In this article, we’ll use animate*AsState where * can be Float, Int, IntOffset, IntSize, Offset, Dp, Rect, Size, Value, Color, Vector or your custom implementation if these provided functions doesn’t suit your needs.</p><p>Find here the current signature of animateFloatAsState that will be used for our two variables:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/13fb7aceca16c0864e8cf90e3f961de0/href">https://medium.com/media/13fb7aceca16c0864e8cf90e3f961de0/href</a></iframe><p>You give the target value at the end of the animation, the specification to change the value through the time, the optional threshold value to decide when the animation value is considered close enough to the target value and a listener if you want to do something when the target value is reached.</p><p>If we assume that we have the number of markers (nbMarkers) we want to display and the current value of the timer (seconds), we can compute the angle progress of our circular progress bar and the number of active markers.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9b15c05f815ab259ed1825dedb151290/href">https://medium.com/media/9b15c05f815ab259ed1825dedb151290/href</a></iframe><p>It’s time to assemble all our previous work to create one single component to draw our animated timer. Inside a square Box, we draw all our markers, the text in the center and finally, the circular progress bar.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d26c77a501e1e0f9ce60d270579bfe47/href">https://medium.com/media/d26c77a501e1e0f9ce60d270579bfe47/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/278/1*qezzQ5GJpzLWuYfurlBCJg.gif" /></figure><p>In this post, we’ve taken a quick overview on the Canvas API usage and animations. If you have any questions related to Jetpack Compose, feel free to ping me here or on <a href="https://twitter.com/GerardPaligot">Twitter</a> and if you want to check the complete code of this timer application, it is available on Github.</p><p><a href="https://github.com/GerardPaligot/android-countdown">GerardPaligot/android-countdown</a></p><p>Big thanks to <a href="https://twitter.com/jklingenberg_">Jens Klingenberg</a> and <a href="https://twitter.com/JulienSalvi">Julien Salvi</a> for reviewing my article. 👏</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36d3638996b6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jetpack Compose: How to make a scrollable list?]]></title>
            <link>https://medium.com/decathlondigital/jetpack-compose-how-to-make-a-scrollable-list-6c8b0a98c98e?source=rss-7055bef5fa63------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c8b0a98c98e</guid>
            <category><![CDATA[scrollable]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[mobile-apps]]></category>
            <category><![CDATA[compose]]></category>
            <category><![CDATA[jetpack]]></category>
            <dc:creator><![CDATA[Gérard Paligot]]></dc:creator>
            <pubDate>Mon, 21 Sep 2020 14:57:39 GMT</pubDate>
            <atom:updated>2020-09-21T14:57:39.365Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TZCWfdsfcBIxMGtFphzzVg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@andrewtneel?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Andrew Neel</a> on <a href="https://unsplash.com/s/photos/lists?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>We previously looked at <a href="https://medium.com/decathlondevelopers/jetpack-compose-how-to-handle-states-inside-a-composable-98efc3205ea0">how to handle states inside a Composable</a> with the quantity selection component. In this article, we’ll see how to make a scrollable list. When it comes to display a list of elements, we need to use a RecyclerView with an adapter to define each item. This basic feature can become hard for so many cases but Jetpack Compose gives a new way to display a scrollable list!</p><blockquote><strong><em>Disclaimer</em></strong><em>: All source code is developed with Compose 1.0.0-alpha02. Because Jetpack Compose is still in alpha, some source code may change with new versions.</em></blockquote><h3>Scrollable Compose components</h3><p>Jetpack Compose offers two ways each to display a scrollable list in vertical or horizontal:</p><ul><li><a href="https://developer.android.com/jetpack/compose/layout#scrollable">ScrollableColumn (resp. ScrollableRow)</a> is a variant of Column (or Row) that scrolls when content is bigger than its height (or width). That can be the equivalent of the ScrollView in the previous framework UI.</li><li><a href="https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/package-summary#lazycolumnfor">LazyColumnFor</a> (resp. <a href="https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/package-summary#lazyrowfor">LazyRowFor</a>) is a vertically (or horizontally) scrolling list that only composes and lays out the currently visible items. That can be the equivalent of the RecyclerView and its adapter in the previous framework UI.</li></ul><blockquote><strong>Note:</strong> Because we are an Android developer, we want to use LazyColumnFor as much as possible but in the current version of Compose, we don’t have as much flexibility with <em>LazyColumnFor</em> as with <em>ScrollableColumn</em>. e.g. you can’t scroll at a specific position with <em>LazyColumnFor</em> for now.</blockquote><h3>Product item component</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9gJDBBGaPMDiX71v6fxyKg.png" /><figcaption>Product item</figcaption></figure><p>At Decathlon, each product item has a picture, a name and a price. In our example we are going to add the brand following theses specifications:</p><ul><li>The size of the picture is 70 dp in width and height.</li><li>The text for the brand and the name use Roboto Condensed font, according to the official Decathlon typography.</li><li>The font weight for the brand is bold W700 and for the name bold W400.</li><li>The price component developed in this <a href="https://medium.com/decathlondevelopers/jetpack-compose-how-to-write-conditional-composable-5fc4c3441d84">previous article</a>.</li></ul><p>This component can be reused when we need to display a product in a list. Our model is pretty simple.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3ec054428859399cab318058b66b574b/href">https://medium.com/media/3ec054428859399cab318058b66b574b/href</a></iframe><blockquote><strong>Info:</strong> Our picture loads its content from a URL. To do that, you can use <a href="https://github.com/chrisbanes/accompanist">accompanist</a> from Chris Banes to load a picture with <a href="https://github.com/coil-kt/coil">Coil</a>, an image loader developed and adapted for Kotlin.</blockquote><h3>ScrollableColumn and ScrollableRow components</h3><p>As mentioned earlier we will be using a ScrollableColumn to make a list which you can scroll vertically or a ScrollableRow to scroll horizontally. Let’s have a look at the source code, both of these scrollers have a similar method signature.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dfcc5ed79ecd57edf67b829c586732c1/href">https://medium.com/media/dfcc5ed79ecd57edf67b829c586732c1/href</a></iframe><p>This is similar to any other component in Jetpack Compose. We can update the modifier to modify the UI according to our needs, the last parameter is the content of the scrollable area and there are some settings available for the scroll. If we want a simple scrollable list with a divider between each product, we can create our composable like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6c39196f32374b5b35e1f75a5f57b7d3/href">https://medium.com/media/6c39196f32374b5b35e1f75a5f57b7d3/href</a></iframe><p>We declare our ScrollableColumn and we iterate inside this component to display our product item. Nothing more. Thanks to declarative UI, we describe what we want to display and Jetpack Compose does the rest!</p><h3>LazyColumnFor and LazyRowFor components</h3><p>Lazy versions of scrollable components are simpler. You don’t have settings for the scroll but they can take your list of models and you just need to declare your product item depending on the current model given in the itemContent lambda.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/50a9e5dc21e43ce338eb9fed71e621d8/href">https://medium.com/media/50a9e5dc21e43ce338eb9fed71e621d8/href</a></iframe><p>Similar to our previous example, the implementation looks like:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/35d9ec3081ba02be18f60805fb3ec7ea/href">https://medium.com/media/35d9ec3081ba02be18f60805fb3ec7ea/href</a></iframe><p>You don’t need to declare a RecyclerView with an adapter. Jetpack Compose doesn’t recycle any views. It will just draw what the user should see and you don’t need to care about internal stuff.</p><p>Lists with Jetpack Compose are magic! ✨</p><h3>Smooth scroll at a specific position</h3><p>In many cases, you want to scroll at a specific position in your list. Because your list is sorted alphabetically and you want to go at the first item of a letter or you want to come back at the beginning of the list. If you want to do this, you need to manipulate a <a href="https://developer.android.com/reference/kotlin/androidx/compose/foundation/ScrollState">ScrollState</a> from the function <a href="https://developer.android.com/reference/kotlin/androidx/compose/foundation/package-summary#rememberScrollState(kotlin.Float)">rememberScrollState</a>.</p><p>In our example, we display a floating action button at the bottom of our screen. Clicking it will bring us back to the first list item.</p><blockquote><strong>Warning:</strong> This feature isn’t available with lazy components. In the current version of Compose, you need to use a scrollable component.</blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/af7c13f4c8b84917b7ae965d6243960d/href">https://medium.com/media/af7c13f4c8b84917b7ae965d6243960d/href</a></iframe><p>In our composable, we declare a scrollState variable from rememberScrollState function, we give this state to our scrollable component and we just need to call the needed function to scroll to a specific position, here <a href="https://developer.android.com/reference/kotlin/androidx/compose/foundation/ScrollState#smoothscrollto">smoothScrollTo</a> with 0f that corresponds to the beginning of our list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*9ZPWz0RChT--o3vWIz1UJw.gif" /><figcaption>Smooth scroll at the beginning of the list</figcaption></figure><p>In this post, we’ve taken a quick dive into displaying a product list using LazyColumnFor and ScrollableColumn and see how to scroll at a specific position.</p><p>Stay tuned for the next post about Jetpack Compose at Decathlon!</p><p>Follow our latest posts on <a href="https://twitter.com/decathlondev">Twitter</a> and <a href="https://www.linkedin.com/company/decathlondevelopers/">LinkedIn</a> and discover our sport tech initiatives like open APIs on our <a href="https://developers.decathlon.com/">developers</a> website 🚀</p><p>If you are interested in joining Decathlon Tech Team, check out our <a href="https://developers.decathlon.com/careers">carriers portal</a> to see the different exciting opportunities ! 👩‍💻👨‍💻</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c8b0a98c98e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/decathlondigital/jetpack-compose-how-to-make-a-scrollable-list-6c8b0a98c98e">Jetpack Compose: How to make a scrollable list?</a> was originally published in <a href="https://medium.com/decathlondigital">Decathlon Digital</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jetpack Compose: How to handle states inside a Composable?]]></title>
            <link>https://medium.com/decathlondigital/jetpack-compose-how-to-handle-states-inside-a-composable-98efc3205ea0?source=rss-7055bef5fa63------2</link>
            <guid isPermaLink="false">https://medium.com/p/98efc3205ea0</guid>
            <category><![CDATA[jetpack]]></category>
            <category><![CDATA[mobile-apps]]></category>
            <category><![CDATA[compose]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[composables]]></category>
            <dc:creator><![CDATA[Gérard Paligot]]></dc:creator>
            <pubDate>Tue, 25 Aug 2020 16:14:54 GMT</pubDate>
            <atom:updated>2020-08-25T16:14:54.002Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G_Cmo0ZZLnjGyHuM-kzG0g.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@tfrants?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Tyler Franta</a> on <a href="https://unsplash.com/s/photos/technology?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>We previously looked at <a href="https://medium.com/decathlondevelopers/jetpack-compose-how-to-write-conditional-composable-5fc4c3441d84">how to write conditional composable</a> with the price component. In this article, we’ll develop a new component, named quantity selection, and see how we can handle an internal state inside and how to get its value when a user interact with it.</p><blockquote><strong>Disclaimer</strong>: All source code exposed here has been developed with artifact 0.1.0-dev17 of Compose. Because Jetpack Compose is still in an early developer preview, note that some source code may change with new versions.</blockquote><h3>Quantity selection component</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*03okNwot7vcBU--S.png" /><figcaption>Specifications of quantity selection component</figcaption></figure><p>When you build a retail Android application, you need a component to select quantities needed. At Decathlon, a component has been designed for this case.</p><ul><li>Minimum value can’t be negative, by default it’s 0 and if the current quantity is 0, the minus button is disabled with a grey color.</li><li>Maximum value is optional, by default it’s the max value of an integer and if you define a maximum, the increment button is disabled when the max value is reached.</li><li>You can edit the quantity when you press the text field, it takes the focus and the bottom bar become green. When the focus is lost, you go back to its default state.</li></ul><p>That makes it the perfect candidate for our topic because it retains its current quantity and notifies its parent composable when the value changes.</p><h3>State variable declaration</h3><p>There is no state saved between two screen compositions. Composable can take a model in input and Compose will draw the expected visual. When you don’t declare an explicit state, we say your Composable is stateless.</p><p>This is a pretty good practice to keep state as small as possible to avoid side effects. But in our case we want to save a data between two renderings. To do so there are 2 types of functions available. First one is called remember and the second one state.</p><ul><li><a href="https://developer.android.com/reference/kotlin/androidx/compose/package-summary#remember">remember</a> saves the value produced by a lambda in parameter. This lambda will be evaluated during the composition and each recomposition will always return the value produced by composition.</li><li><a href="https://developer.android.com/reference/kotlin/androidx/compose/package-summary#state">state</a> is used to locally mutate and use data within the composition context.</li></ul><p>We’ll focus on state function for our topic. Remember function might be described in another article.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/18d053932e52343a4fbf9c2cc7e01359/href">https://medium.com/media/18d053932e52343a4fbf9c2cc7e01359/href</a></iframe><p>We declare a QuantitySelection function which is our Composable and take several parameters:</p><ul><li>value is the initial value of the component.</li><li>maxValue is our optional maximum value sets to Int.MAX_VALUE by default.</li><li>onValueChanged will be triggered whenever the value is modified from the text field, minus or more buttons.</li><li>onMinusClicked will be triggered whenever the user press the minus button.</li><li>onMoreClicked will be triggered whenever the user press the more button.</li></ul><p>Note that the state isn’t declared as parameter of the Composable but can be initialized by values of parameters. The lambda of the state function will be evaluated during the first composition and at each change on the variable quantityState, it’ll force the recomposition of our component!</p><blockquote><strong>Note:</strong> You don’t need to declare a data class to save a state. A state function can take a primitive type as parameter. Depends on what you need and what you want.</blockquote><h3>Modify state value</h3><p>Let’s focus on the minus button to see how we can change the value of a state and use it to update UI.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2b6b2f89c00c02fe93e5760b0730b6cd/href">https://medium.com/media/2b6b2f89c00c02fe93e5760b0730b6cd/href</a></iframe><p>In the Box, we declare a clickable modifier to handle changes of the state but we need to disable this behavior if the button is disabled and change the color of the icon.</p><p>In the clickable callback, we implement the UI logic to decrement the quantity value if the current value isn’t negative. To get our QuantityState object value inside a state variable, we need to call the value property. This value is mutable and can be changed by a simple assignment. Our implementation is pretty simple:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/aff5f6181b1cee965c81a01ec7b3ec4a/href">https://medium.com/media/aff5f6181b1cee965c81a01ec7b3ec4a/href</a></iframe><p>When the callback is evaluated and the state modified, it’ll force recomposition of our Composable and our UI can react with the new value of our internal quantity state value:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/56de0c89f92715440542da82d097dd03/href">https://medium.com/media/56de0c89f92715440542da82d097dd03/href</a></iframe><p>To disable our button or to change the color of our icon, we use the value of our internal state. When the quantity will be 0, our button is no more clickable and the color change to greyLight1.</p><p>The principle is the exact same for the more button and for our text field! Our component is finished and can be used everywhere in our application.</p><p>In this post, we’ve taken a quick dive into how to handle internal state in a Composable component with state function provided by Jetpack Compose library.</p><p>Stay tuned for the next post about Jetpack Compose at Decathlon! Follow our latest posts on <a href="https://twitter.com/decathlondev">Twitter</a> and <a href="https://www.linkedin.com/company/decathlondevelopers/">Linkedin</a> and discover our sport tech initiatives like open APIs on our <a href="https://developers.decathlon.com/">developers</a> website.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=98efc3205ea0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/decathlondigital/jetpack-compose-how-to-handle-states-inside-a-composable-98efc3205ea0">Jetpack Compose: How to handle states inside a Composable?</a> was originally published in <a href="https://medium.com/decathlondigital">Decathlon Digital</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jetpack Compose: How to write conditional Composable?]]></title>
            <link>https://medium.com/decathlondigital/jetpack-compose-how-to-write-conditional-composable-5fc4c3441d84?source=rss-7055bef5fa63------2</link>
            <guid isPermaLink="false">https://medium.com/p/5fc4c3441d84</guid>
            <category><![CDATA[jetpack]]></category>
            <category><![CDATA[mobile-apps]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[composables]]></category>
            <category><![CDATA[jetpack-compose]]></category>
            <dc:creator><![CDATA[Gérard Paligot]]></dc:creator>
            <pubDate>Wed, 22 Jul 2020 16:09:21 GMT</pubDate>
            <atom:updated>2020-07-22T16:09:21.334Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yKCRYzrnFkLivh_f8FtLfA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@grohsfabian?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Fabian Grohs</a> on <a href="https://unsplash.com/s/photos/developer?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Jetpack Compose is the new future UI toolkit to develop views in Android development. In this article, we’ll see how to create a custom view who reacts depending on a condition from the model object in input. If you don’t know Jetpack Compose at all, I advise you to read the official documentation first on <a href="https://developer.android.com/jetpack/compose">Android documentation website</a>.</p><blockquote><strong>Disclaimer</strong>: All source code exposed here has been developed with artifact 0.1.0-dev14 of Compose. Because Jetpack Compose is still in an early developer preview, note that some source code may change with new versions.</blockquote><h3>Price component</h3><p>At Decathlon, each product has a price and a strict design specification.</p><ul><li>if your price is not on special offer, the background is yellow, the text is black, the currency is at the end of the price and there is a padding between the text and the background.</li><li>If your price is on special offer, the background switch in red, the text in white and a banner is displayed at the top of the price block with the strikeout price and the percentage applied.</li></ul><p>We can already see the condition that will react depending on whether the price has a promotion or not. A model that meets these specifications might look like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6984d7a820907cb276844f354b925dde/href">https://medium.com/media/6984d7a820907cb276844f354b925dde/href</a></iframe><h3>Write our first composable function</h3><p>Price block composable function displays the product price. To write a composable, you need to declare a function that starts with an uppercase letter by convention and annotated by @Composable annotation.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f6a36d3114114ee631b7be408f8cdfdd/href">https://medium.com/media/f6a36d3114114ee631b7be408f8cdfdd/href</a></iframe><p>This function displays nothing for now. Price block is pretty simple, we want to draw a background in yellow and the price on top of it. To do so, we use 3 composable functions provided by Compose library:</p><ul><li>Surface: To draw our yellow background</li><li>Box: To encapsulate our text to add a padding between the background and the text</li><li>Text: To display a text with our price and currency</li></ul><p>Note that we are using Decathlon’s colors for the red, yellow, black and white. Create a Kotlin files with these colors:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/19db7fc3fcd6ea24aaf4f7283e03fa29/href">https://medium.com/media/19db7fc3fcd6ea24aaf4f7283e03fa29/href</a></iframe><p>We can use these colors everywhere in our module with a simple import. Now, we can create the yellow background of our composable:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a2772f9d2e5937c2a078ec405adadeb8/href">https://medium.com/media/a2772f9d2e5937c2a078ec405adadeb8/href</a></iframe><p>There are a lot of parameters available for Surface composable (like elevation, shape, borders, etc.). For now we don’t need these parameters to build our composable, it will be the topic of another article.</p><p>To add a padding between our background and our text, we add a Box with a Modifier. A Modifier isn’t a composable but it can be used inside a lot of them with the parameter modify, and are used to modifier how the component is drawn.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d605e8b1ad0dbb341934507358d6a46d/href">https://medium.com/media/d605e8b1ad0dbb341934507358d6a46d/href</a></iframe><p>We could do a lot more with Modifier but in our case, we’ll focus on a Surface containing a Box, a padding and a simple Text.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0d1f5a43b678feb9b0129598fb6e9783/href">https://medium.com/media/0d1f5a43b678feb9b0129598fb6e9783/href</a></iframe><p>Finally, we declare our Text that shows our price with a specific style. To do so, we customize color, fontWeight, fontSize and fontFamily properties.</p><p>You’re done! You’ve just completed your first composable capable of drawing a price on a mobile device. Note that you can test your view thanks to @Preview annotation. To see it in action, you can create another Composable function using this annotation. You’ll see the preview within a side panel in Android Studio.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b06738f4689958903f104f765a7cd7e6/href">https://medium.com/media/b06738f4689958903f104f765a7cd7e6/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/163/1*9RRW4372fk_jSRNT1eFCJw.png" /></figure><h3>Small conditional changes</h3><p>In our final composable, we would like to handle various styles based on various parameters such as discount or not. To achieve this goal, we can improve our previous composable function to update its colors according to the model Price in input.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8550e382ec1c7f406f72823a612d0052/href">https://medium.com/media/8550e382ec1c7f406f72823a612d0052/href</a></iframe><p>In this example, we check if we want to display our PriceBlock with a promo or not (price.promo != null) and according to the result, we use red or yellow for the background and white or black for the text color.</p><p>To see the difference between a price with a promotion or not in our preview panel, we can create another preview function in the same file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/df6d9388383c81626885c58d69ca39e8/href">https://medium.com/media/df6d9388383c81626885c58d69ca39e8/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/237/1*FFcz0eBh7B74TT7rrLzZWA.png" /></figure><h3>Inline multiple Composable</h3><p>When we show a price with a promo, we display the strikeout price and the discount percentage above it. These elements are drawn next to each other with a spacing. To define a line, you can use Row and all children inside this component will be drawn on a line.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/15b07b22b9ac727e8e01422cec7374b3/href">https://medium.com/media/15b07b22b9ac727e8e01422cec7374b3/href</a></iframe><p>We declare two texts, one for the strikeout price and the other for the percentage in a Row. To cross out the base price, we just have to add a textDecoration properly sets to LineThrough. For the spacing, you have many solutions but the simplest way is to declare a Spacer component with a modifier to fix the width.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9b906d35190c00cf4edc8a98942c4a81/href">https://medium.com/media/9b906d35190c00cf4edc8a98942c4a81/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/243/1*YvqB498uwKC1b-bl6ELOqg.png" /></figure><h3>Final component</h3><p>We’ve created 2 small components with a single responsibility, we can combine them to create a final component to display a price component who reacts differently if the price contains a promo or not.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d2d3acd4d44d081e82a21e2ee1f6059a/href">https://medium.com/media/d2d3acd4d44d081e82a21e2ee1f6059a/href</a></iframe><p>We’ve encapsulated our two previous components inside a Column to draw them next to each other but vertically and we call PriceStrikeoutBanner only if promo attribute is not null in price model. If you want to see how it looks, just create another preview function for the composable state you want to check.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*y3qUOovHxi462kO-HpA9wg.png" /></figure><p>In this post, we’ve taken a quick dive to create Composable component with some simple conditions.</p><p>Stay tuned for the next post about Jetpack Compose at Decathlon! Follow our latest posts on <a href="https://twitter.com/decathlondev">Twitter</a> and <a href="https://www.linkedin.com/company/decathlondevelopers/">Linkedin</a> and discover our sport tech initiatives like open APIs on our <a href="https://developers.decathlon.com/">developers</a> website.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5fc4c3441d84" width="1" height="1" alt=""><hr><p><a href="https://medium.com/decathlondigital/jetpack-compose-how-to-write-conditional-composable-5fc4c3441d84">Jetpack Compose: How to write conditional Composable?</a> was originally published in <a href="https://medium.com/decathlondigital">Decathlon Digital</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>