<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Marlon López</title>
    <description>The latest articles on DEV Community by Marlon López (@marlonlom).</description>
    <link>https://dev.to/marlonlom</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1232008%2Fc3da8807-3eab-4182-8d68-16ab9b241389.jpg</url>
      <title>DEV Community: Marlon López</title>
      <link>https://dev.to/marlonlom</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/marlonlom"/>
    <language>en</language>
    <item>
      <title>Latin America and the AI Divide: Will We Shape the Future or Simply Consume It?</title>
      <dc:creator>Marlon López</dc:creator>
      <pubDate>Mon, 16 Nov 2026 02:34:18 +0000</pubDate>
      <link>https://dev.to/marlonlom/latin-america-and-the-ai-divide-will-we-shape-the-future-or-simply-consume-it-1ah7</link>
      <guid>https://dev.to/marlonlom/latin-america-and-the-ai-divide-will-we-shape-the-future-or-simply-consume-it-1ah7</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;The next major technological divide will not be determined solely by who has access to the Internet, but by who has the capacity to develop, operate, and control the infrastructure that makes artificial intelligence possible.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For years, when discussing the digital divide in Latin America, we primarily focused on Internet connectivity, access to technological devices, and opportunities for digital education. However, we are entering a new era in which these conditions, although still essential, are no longer enough.&lt;/p&gt;

&lt;p&gt;The rapid expansion of artificial intelligence (AI) is creating a new form of technological inequality: the computing capacity gap.&lt;/p&gt;

&lt;p&gt;This divide could have profound implications for economic development, competitiveness, and technological autonomy across our region.&lt;/p&gt;

&lt;h2&gt;
  
  
  Artificial Intelligence Requires Much More Than an Internet Connection
&lt;/h2&gt;

&lt;p&gt;Using artificial intelligence tools is becoming increasingly simple. Through a web browser or a smartphone, we can access models capable of generating text, analyzing information, creating images, and automating tasks.&lt;/p&gt;

&lt;p&gt;Yet behind this apparent simplicity lies an extraordinarily complex technological infrastructure.&lt;/p&gt;

&lt;p&gt;AI requires data centers, specialized servers, high-performance processors, semiconductors, communication networks, and enormous amounts of energy. It also depends on specialized talent, investment, research, and the ability to develop proprietary models.&lt;/p&gt;

&lt;p&gt;The problem is that much of this infrastructure and the technological capabilities required to build it are concentrated in a relatively small group of countries and companies.&lt;/p&gt;

&lt;p&gt;This creates a new imbalance: while some economies develop and control artificial intelligence technologies, others remain dependent on platforms and services created elsewhere.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Risk of Becoming Permanent Technology Consumers
&lt;/h2&gt;

&lt;p&gt;For Latin America, this scenario presents a challenge that goes far beyond purchasing software licenses or subscribing to artificial intelligence services.&lt;/p&gt;

&lt;p&gt;When a country depends exclusively on technologies developed in other markets, it also becomes subject to the decisions, costs, priorities, and capabilities of those who control these platforms.&lt;/p&gt;

&lt;p&gt;There is another particularly important concern: AI models do not always adequately reflect the cultural, linguistic, economic, and social characteristics of every region.&lt;/p&gt;

&lt;p&gt;Our contexts, languages, productive sectors, and institutional realities require solutions that may not be among the priorities of major global technology developers.&lt;/p&gt;

&lt;p&gt;Therefore, technological dependence is not simply a matter of cost or access. It is also about having the ability to decide how artificial intelligence should be used to address our own challenges.&lt;/p&gt;

&lt;p&gt;This brings us to a fundamental concept: digital sovereignty.&lt;/p&gt;

&lt;h2&gt;
  
  
  AI Infrastructure as a Driver of Development
&lt;/h2&gt;

&lt;p&gt;One of the most important ideas in this debate is that artificial intelligence should be understood as strategic infrastructure, comparable in importance to roads, ports, electricity grids, and telecommunications networks.&lt;/p&gt;

&lt;p&gt;This is not simply about having modern tools to improve productivity. It is about possessing the capabilities needed to participate actively in the emerging economy built around this technology.&lt;/p&gt;

&lt;p&gt;This requires progress on several fronts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Technological infrastructure: Developing computing capacity, data centers, connectivity, and reliable energy access.&lt;/li&gt;
&lt;li&gt;Talent and research: Strengthening education and training for professionals, scientists, and engineers capable of developing and adapting AI solutions.&lt;/li&gt;
&lt;li&gt;Regional innovation: Promoting AI models and applications that address the specific needs of our economies and societies.&lt;/li&gt;
&lt;li&gt;Investment and collaboration: Encouraging partnerships between governments, universities, businesses, and research institutions.&lt;/li&gt;
&lt;li&gt;Digital governance and sovereignty: Building the capabilities to manage data, assess technologies, and make strategic decisions about their implementation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Not every country needs to build the entire technological infrastructure independently or compete directly with the world's largest economies. Regional cooperation, shared investments, and complementary technological capabilities can create significant opportunities.&lt;/p&gt;

&lt;p&gt;What matters most is ensuring that Latin America is not excluded from the decisions that will shape the technological future.&lt;/p&gt;

&lt;h2&gt;
  
  
  An Opportunity Latin America Should Not Miss
&lt;/h2&gt;

&lt;p&gt;Artificial intelligence also represents an extraordinary opportunity for our region.&lt;/p&gt;

&lt;p&gt;Sectors such as agriculture, healthcare, education, manufacturing, energy, logistics, and financial services could benefit significantly from AI solutions tailored to their specific needs.&lt;/p&gt;

&lt;p&gt;However, taking advantage of this potential requires more than simply incorporating AI tools into existing processes. It requires developing knowledge, strengthening innovation ecosystems, and building the capabilities needed to create value from our own realities.&lt;/p&gt;

&lt;p&gt;The challenge is to move from dependent technology adoption toward active participation in the development of new solutions.&lt;/p&gt;

&lt;p&gt;This requires a long-term vision and strategic decisions that recognize digital infrastructure not as a luxury or an issue exclusive to the technology sector, but as an increasingly essential condition for development.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Question We Need to Ask Ourselves
&lt;/h2&gt;

&lt;p&gt;The next digital divide could separate those who have the capacity to develop, train, and run artificial intelligence systems from those who can only access them as consumers.&lt;/p&gt;

&lt;p&gt;If Latin America fails to strengthen its technological capabilities, it risks deepening existing dependencies that could limit its competitiveness and decision-making power in the global economy.&lt;/p&gt;

&lt;p&gt;That is why the conversation about artificial intelligence must go beyond applications, virtual assistants, and productivity tools.&lt;/p&gt;

&lt;p&gt;We must ask ourselves what infrastructure we want to build, what knowledge we need to develop, and what role we aspire to play in this emerging economy.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;True digital transformation is not simply about using technologies developed by others. It is about acquiring the capacity to participate in their creation and direct their application toward our own needs.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The final question is unavoidable:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Are we preparing Latin America to become a key player in the artificial intelligence economy, or are we becoming accustomed to consuming a technological future built by others?&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Reference and Inspiration
&lt;/h2&gt;

&lt;p&gt;This article draws inspiration from a reflection published by DW on its official YouTube channel about the emerging technological divide associated with artificial intelligence.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/shorts/g7x1cBiK8aA" rel="noopener noreferrer"&gt;DW – Watch the original video on YouTube&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The views and analysis developed in this article expand on the topic from a Latin American development, innovation, and digital sovereignty perspective.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>latinamerica</category>
      <category>digitaltransformation</category>
    </item>
    <item>
      <title>From Zero to Extreme Connectivity: Android Engineering Lessons from East Africa</title>
      <dc:creator>Marlon López</dc:creator>
      <pubDate>Wed, 28 Oct 2026 18:51:09 +0000</pubDate>
      <link>https://dev.to/marlonlom/-from-zero-to-extreme-connectivity-android-engineering-lessons-from-east-africa-3281</link>
      <guid>https://dev.to/marlonlom/-from-zero-to-extreme-connectivity-android-engineering-lessons-from-east-africa-3281</guid>
      <description>&lt;p&gt;Building software for emerging markets is a masterclass in engineering humility. While traditional software development environments often take fiber-optic connections, stable 5G networks, high-end smartphones, and all-day battery life for granted, the reality of mobile development in East Africa—especially in last-mile logistics—presents an entirely different set of architectural challenges.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: This article is an independent engineering case study written solely to explore Android architecture patterns, real-world trade-offs, and design lessons from building resilient mobile applications in extreme connectivity environments. There is no commercial affiliation, sponsorship, or endorsement with any company mentioned.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Background &amp;amp; Technical Context
&lt;/h2&gt;

&lt;p&gt;The architectural patterns discussed below are grounded in field-tested logistics operations in high-demand, low-connectivity environments, originally featured by the official &lt;strong&gt;Android Developers&lt;/strong&gt; team.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=bU71Mm8BTRI" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fva23e0t6pplmivme4ndz.jpg" alt="Watch the Case Study Video" width="640" height="480"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;▶ **Watch the official case study (3 mins):&lt;/em&gt;* &lt;a href="https://www.youtube.com/watch?v=bU71Mm8BTRI" rel="noopener noreferrer"&gt;Android Developer Story: Sendy&lt;/a&gt;*&lt;/p&gt;




&lt;h2&gt;
  
  
  1. The Background GPS Tracking Dilemma
&lt;/h2&gt;

&lt;p&gt;In real-time logistics, losing continuous visibility of a delivery driver means losing operational reliability. However, maintaining background GPS tracking directly conflicts with the aggressive battery optimization policies found in budget-friendly Android smartphones.&lt;/p&gt;

&lt;p&gt;Entry-level devices commonly used in emerging markets often terminate background processes within minutes of screen timeout to conserve power and memory.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Engineering Solution
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Foreground Services &amp;amp; Persistence:&lt;/strong&gt; Implementing a strict &lt;strong&gt;Foreground Service&lt;/strong&gt; pattern backed by persistent high-priority notifications, combined with &lt;strong&gt;WorkManager&lt;/strong&gt; to guarantee task execution and retry logic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Human-in-the-Loop OS Configuration:&lt;/strong&gt; Engineering required UX adaptation: designing targeted onboarding flows tailored to specific OEM brand skins (e.g., MIUI, xOS) to guide users step-by-step through manually disabling OS-level battery throttling.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2. Thriving in an "Offline-First" Reality
&lt;/h2&gt;

&lt;p&gt;Consider a driver delivering packages in a zone where cellular coverage suddenly drops to zero. If the Android application relies on a standard HTTP request to confirm a delivery, the entire workflow freezes: the recipient cannot sign, proof-of-delivery photos fail to upload, and the driver is unable to accept subsequent tasks.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Engineering Solution
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Single Source of Truth (SSOT):&lt;/strong&gt; Utilizing a strict local-first architecture powered by &lt;strong&gt;Room Database&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Optimistic Local Completion:&lt;/strong&gt; When a driver completes a delivery, the app writes directly to the local database with a &lt;code&gt;pending_sync = true&lt;/code&gt; flag and immediately releases the UI thread, allowing the driver to proceed without waiting for network ACK.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reactive Sync Workers:&lt;/strong&gt; A background process monitors device connectivity via &lt;code&gt;ConnectivityManager&lt;/code&gt;. As soon as network availability is detected—even a transient 2G connection—it dispatches a compressed payload containing the digital signature and delivery metadata.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  3. The Battle Against 2 GB RAM and APK Constraints
&lt;/h2&gt;

&lt;p&gt;Field logistics apps frequently run on entry-level hardware featuring low-spec processors, 1 GB to 2 GB of RAM, and chronically full storage partitions. Heavy dependencies or unmanaged bitmap caches quickly lead to &lt;em&gt;Out-Of-Memory (OOM)&lt;/em&gt; crashes during active map navigation.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Engineering Solution
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Dynamic Delivery:&lt;/strong&gt; Enforcing &lt;strong&gt;Android App Bundles (AAB)&lt;/strong&gt; to ensure devices download only the necessary language resources, screen densities, and ABI binaries (&lt;code&gt;arm64-v8a&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lifecycle-Aware Cache Cleanup:&lt;/strong&gt; Rigorously purging map view caches during &lt;code&gt;onStop()&lt;/code&gt; and &lt;code&gt;onDestroy()&lt;/code&gt; lifecycle callbacks to prevent RAM accumulation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;On-Device Image Processing:&lt;/strong&gt; High-resolution camera captures for proof-of-delivery are compressed and resized locally before network transmission, reducing large images to lightweight JPEG payloads under 100 KB without compromising signature or document legibility.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Key Takeaways for Modern Android Engineers
&lt;/h2&gt;

&lt;p&gt;Designing resilient Android software isn't just about adopting the latest Jetpack libraries; it requires deep empathy for the constraints of the execution environment. When building apps for regions with fluctuating connectivity, diverse hardware specs, and strict data limits, offline resilience, memory hygiene, and background reliability are not optional enhancements—they are fundamental architectural requirements.&lt;/p&gt;

</description>
      <category>android</category>
      <category>devstories</category>
      <category>googlemaps</category>
    </item>
    <item>
      <title>Eleva tu app Android: patrones de arquitectura con Jetpack Compose</title>
      <dc:creator>Marlon López</dc:creator>
      <pubDate>Sun, 14 Dec 2025 00:36:07 +0000</pubDate>
      <link>https://dev.to/marlonlom/eleva-tu-app-android-patrones-de-arquitectura-con-jetpack-compose-5gh</link>
      <guid>https://dev.to/marlonlom/eleva-tu-app-android-patrones-de-arquitectura-con-jetpack-compose-5gh</guid>
      <description>&lt;h2&gt;
  
  
  📱 ¿A qué llamamos los patrones de arquitecturas Android?
&lt;/h2&gt;

&lt;p&gt;Son &lt;strong&gt;formas recomendadas de organizar el código&lt;/strong&gt; de una app Android para que sea:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Más &lt;strong&gt;mantenible&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Más &lt;strong&gt;escalable&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Más &lt;strong&gt;testeable&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Más fácil de entender en equipo&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Con &lt;strong&gt;Kotlin + Jetpack Compose&lt;/strong&gt;, Google promueve arquitecturas &lt;strong&gt;reactivas y unidireccionales&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧩 Componentes clave con Jetpack Compose
&lt;/h2&gt;

&lt;p&gt;Antes de los patrones, es importante entender los &lt;strong&gt;roles principales&lt;/strong&gt;:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. UI (Compose)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Funciones &lt;code&gt;@Composable&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Solo muestran el estado&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;No contienen lógica de negocio&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Reaccionan a cambios de estado
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="nd"&gt;@Composable&lt;/span&gt;
&lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;HomeScreen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;HomeState&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. ViewModel
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Maneja el &lt;strong&gt;estado de la UI&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Contiene la &lt;strong&gt;lógica de presentación&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Sobrevive a cambios de configuración&lt;/li&gt;
&lt;li&gt;Expone &lt;code&gt;StateFlow&lt;/code&gt; o &lt;code&gt;LiveData&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;HomeViewModel&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;ViewModel&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;_state&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;MutableStateFlow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;HomeState&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;state&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;asStateFlow&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Domain / Business Logic
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Reglas de negocio&lt;/li&gt;
&lt;li&gt;Casos de uso (&lt;em&gt;UseCases&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;Independiente de Android&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Data Layer
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Repositorios&lt;/li&gt;
&lt;li&gt;APIs (Retrofit)&lt;/li&gt;
&lt;li&gt;Base de datos (Room)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🏗️ Patrones de arquitectura más usados
&lt;/h2&gt;

&lt;h3&gt;
  
  
  🔹 1. MVVM (Model–View–ViewModel) ⭐⭐⭐⭐⭐
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;El más usado y recomendado con Compose&lt;/strong&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Estructura
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;UI (Compose)
   ↓
ViewModel
   ↓
Repository
   ↓
Data Source (API / DB)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Flujo de datos (unidireccional)
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User Action → ViewModel → State → UI
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Ejemplo simple
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="nd"&gt;@Composable&lt;/span&gt;
&lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;HomeScreen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;viewModel&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;HomeViewModel&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;viewModel&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;state&lt;/span&gt; &lt;span class="k"&gt;by&lt;/span&gt; &lt;span class="n"&gt;viewModel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;collectAsState&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="nc"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;onClick&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;viewModel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loadData&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Cargar"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Ventajas:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Separación clara de responsabilidades&lt;/li&gt;
&lt;li&gt;Fácil testing&lt;/li&gt;
&lt;li&gt;Ideal para Compose&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🔹 2. MVI (Model–View–Intent) ⭐⭐⭐⭐
&lt;/h3&gt;

&lt;p&gt;Muy popular en apps grandes&lt;/p&gt;

&lt;h4&gt;
  
  
  Conceptos clave
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Intent&lt;/strong&gt;: acción del usuario&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;State&lt;/strong&gt;: estado completo de la pantalla&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reducer&lt;/strong&gt;: transforma el estado&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Flujo
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Intent → ViewModel → Reducer → New State → UI
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Ejemplo conceptual
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="k"&gt;sealed&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;HomeIntent&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;object&lt;/span&gt; &lt;span class="nc"&gt;LoadData&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;HomeIntent&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;data class&lt;/span&gt; &lt;span class="nc"&gt;HomeState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;loading&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Boolean&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;false&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Ventajas:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Estado inmutable&lt;/li&gt;
&lt;li&gt;Flujo predecible&lt;/li&gt;
&lt;li&gt;Ideal para UIs complejas&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Desventajas:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Más código y complejidad&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🔹 3. Clean Architecture con Compose ⭐⭐⭐⭐⭐
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;No es un patrón UI&lt;/strong&gt;, sino una &lt;strong&gt;arquitectura completa&lt;/strong&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Capas
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Presentation (Compose + ViewModel)
Domain (UseCases)
Data (Repository, API, DB)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Reglas
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Las capas internas &lt;strong&gt;no dependen&lt;/strong&gt; de las externas&lt;/li&gt;
&lt;li&gt;UI no conoce detalles de datos&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Ventajas:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Escalable&lt;/li&gt;
&lt;li&gt;Muy testeable&lt;/li&gt;
&lt;li&gt;Ideal para proyectos grandes&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🧠 Recomendación oficial de Google
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;MVVM + Unidirectional Data Flow + StateFlow + Jetpack Compose&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;ViewModel como fuente única de estado&lt;/li&gt;
&lt;li&gt;Compose solo observa y renderiza&lt;/li&gt;
&lt;li&gt;Estado inmutable&lt;/li&gt;
&lt;li&gt;Eventos separados del estado&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🔁 Unidirectional Data Flow (UDF)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Event → ViewModel → State → Compose UI
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Esto evita bugs y hace la UI predecible.&lt;/p&gt;

&lt;h2&gt;
  
  
  📌 ¿Cuál usar?
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Proyecto&lt;/th&gt;
&lt;th&gt;Recomendación&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;App pequeña&lt;/td&gt;
&lt;td&gt;MVVM&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;App mediana&lt;/td&gt;
&lt;td&gt;MVVM + Clean&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;App grande&lt;/td&gt;
&lt;td&gt;MVI + Clean&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;UI compleja&lt;/td&gt;
&lt;td&gt;MVI&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  ✅ Conclusión
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Jetpack Compose cambia la forma de pensar la UI&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;MVVM sigue siendo la base&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;El estado es el corazón de la app&lt;/li&gt;
&lt;li&gt;Flujo unidireccional = menos errores&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🔹 Referencias
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.android.com/jetpack/compose" rel="noopener noreferrer"&gt;Jetpack Compose Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.android.com/jetpack/guide" rel="noopener noreferrer"&gt;Guide to app architecture&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://proandroiddev.com/clean-architecture-on-android-with-kotlin-43f4b0f0b3d8" rel="noopener noreferrer"&gt;Clean Architecture in Kotlin&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>android</category>
      <category>architecture</category>
      <category>kotlin</category>
    </item>
    <item>
      <title>📐 Material 3 Adaptive: Implementing Window Size Classes in Kotlin Compose</title>
      <dc:creator>Marlon López</dc:creator>
      <pubDate>Wed, 12 Nov 2025 02:59:14 +0000</pubDate>
      <link>https://dev.to/marlonlom/material-3-adaptive-implementing-window-size-classes-in-kotlin-compose-40po</link>
      <guid>https://dev.to/marlonlom/material-3-adaptive-implementing-window-size-classes-in-kotlin-compose-40po</guid>
      <description>&lt;p&gt;Hey everyone! 👋&lt;/p&gt;

&lt;p&gt;I wanted to share a look at a crucial technique for modern Android development: implementing Window Size Classes to create truly adaptive layouts that align with the recent updates to &lt;strong&gt;Material 3 Adaptive Guidance&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo6ckbboeaxafnlitz9j5.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo6ckbboeaxafnlitz9j5.jpeg" alt="MobileWindowSize.kt" width="800" height="1140"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;MobileWindowSize&lt;/code&gt; enum in this code snippet is the foundation. It categorizes the available screen space based on Google's defined &lt;code&gt;WindowWidthSizeClass&lt;/code&gt; and &lt;code&gt;WindowHeightSizeClass&lt;/code&gt; (Compact, Medium, Expanded).&lt;/p&gt;

&lt;h3&gt;
  
  
  🧐 Material 3 &amp;amp; Component Placement:
&lt;/h3&gt;

&lt;p&gt;This code directly drives key design decisions based on the available screen space, like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Navigation: Deciding whether to use a bottom &lt;code&gt;NavigationBar&lt;/code&gt; (Compact), a &lt;code&gt;NavigationRail&lt;/code&gt; (Medium), or a permanent &lt;code&gt;NavigationDrawer&lt;/code&gt; (Expanded).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Content Layout: Reorganizing content (e.g., using a master-detail pattern) to maximize screen utility on tablets and desktops.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By mapping screen dimensions to profiles like MOBILE_PORTRAIT or DESKTOP, we ensure our app components are always displayed according to Material 3's best practices for large screens.&lt;/p&gt;

&lt;h3&gt;
  
  
  📚 Resources &amp;amp; Official Documentation
&lt;/h3&gt;

&lt;p&gt;For the full guide on implementation and understanding the key breakpoints used in M3 Adaptive, these are the best resources:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Official Google Guide&lt;/strong&gt;: Check out the complete guide on implementing this strategy: &lt;a href="https://developer.android.com/develop/ui/compose/layouts/adaptive/use-window-size-classes" rel="noopener noreferrer"&gt;Use window size classes | Adaptive layouts in Compose | Android Developers&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Practical Course&lt;/strong&gt;: To see another code implementation of Window Size Classes using Material 3 Adaptive, check out this Compose crash course from Philipp Lackner: &lt;a href="https://youtu.be/jU_BAQI4DiM?t=1881" rel="noopener noreferrer"&gt;The Full Jetpack Compose Responsive UI Crash Course&lt;/a&gt; (The topic starts at [31:21]).&lt;/p&gt;

&lt;p&gt;Implementing this logic is non-negotiable for delivering a high-quality, multi-form factor user experience!&lt;/p&gt;

</description>
      <category>android</category>
      <category>jetpackcompose</category>
      <category>kotlin</category>
      <category>materialdesign3</category>
    </item>
    <item>
      <title>🪟 Window Size Class: Migrating from androidx.window to Material 3 Adaptive</title>
      <dc:creator>Marlon López</dc:creator>
      <pubDate>Sun, 02 Nov 2025 18:39:57 +0000</pubDate>
      <link>https://dev.to/marlonlom/-window-size-class-migrating-from-androidxwindow-to-material-3-adaptive-2g0g</link>
      <guid>https://dev.to/marlonlom/-window-size-class-migrating-from-androidxwindow-to-material-3-adaptive-2g0g</guid>
      <description>&lt;p&gt;(Cover image: Window size class representations based on width, courtesy of Google)&lt;/p&gt;

&lt;h6&gt;
  
  
  &lt;strong&gt;Spanish version&lt;/strong&gt;: &lt;em&gt;&lt;a href="https://dev.to/marlonlom/window-size-class-migrando-de-androidxwindow-a-material-3-adaptive-32n5"&gt;Here.&lt;/a&gt;&lt;/em&gt;
&lt;/h6&gt;

&lt;p&gt;In recent years, the Android ecosystem has increasingly embraced adaptive design. From the rise of foldable devices to large screens, managing the window size (&lt;code&gt;WindowSizeClass&lt;/code&gt;) became key to offering seamless experiences across any form factor.&lt;/p&gt;

&lt;p&gt;With the arrival of &lt;strong&gt;Material 3 Adaptive&lt;/strong&gt;, Google proposes a new way to handle window size classes, integrating this concept directly into the Material Design libraries.&lt;/p&gt;

&lt;p&gt;In this article, I want to share my experience migrating from &lt;code&gt;androidx.window&lt;/code&gt; to the new Material 3 API, the challenges I encountered, and the advantages this change brings.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧩 1. Context: The Previous Approach (&lt;em&gt;androidx.window&lt;/em&gt;)
&lt;/h2&gt;

&lt;p&gt;Until recently, the most common way to calculate size classes was using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.window.layout.WindowMetricsCalculator&lt;/span&gt;

&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;metrics&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;WindowMetricsCalculator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getOrCreate&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;computeCurrentWindowMetrics&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;activity&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;width&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;metrics&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;bounds&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;width&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;height&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;metrics&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;bounds&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;height&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The size class (compact, medium, expanded) was then derived manually or by using the &lt;code&gt;WindowSizeClass&lt;/code&gt; extension from &lt;code&gt;androidx.compose.material3.windowsizeclass&lt;/code&gt;.&lt;br&gt;
This worked well, but it required manual configuration and was somewhat separate from modern Material 3 practices.&lt;/p&gt;
&lt;h2&gt;
  
  
  🧱 2. Material 3 Adaptive: The New Path
&lt;/h2&gt;

&lt;p&gt;Material 3 introduces a new unified API for handling adaptive layouts, better integrating size classes with design components.&lt;/p&gt;

&lt;p&gt;Now you can use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.compose.material3.adaptive.WindowAdaptiveInfo&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.compose.material3.adaptive.currentWindowAdaptiveInfo&lt;/span&gt;
&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;adaptiveInfo&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;currentWindowAdaptiveInfo&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;windowSizeClass&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;adaptiveInfo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;windowSizeClass&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This simplifies access to the current window size and connects it with other elements of the adaptive system (e.g., &lt;code&gt;NavigationSuiteScaffold&lt;/code&gt; or &lt;code&gt;PaneScaffold&lt;/code&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  🔄 3. The Migration Process
&lt;/h2&gt;

&lt;p&gt;During the migration, the main steps were:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Remove &lt;code&gt;androidx.window&lt;/code&gt; dependencies (e.g., &lt;code&gt;androidx.window:window&lt;/code&gt; or &lt;code&gt;androidx.window:window-java&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt; Update Material 3 dependencies to a version that supports adaptive features.&lt;/li&gt;
&lt;li&gt; Replace metric calculation functions with the use of &lt;code&gt;currentWindowAdaptiveInfo()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt; Adjust breakpoints if you were using custom values.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  💡 4. Benefits of the New Approach
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;✅ Direct integration with Material 3 adaptive components.&lt;/li&gt;
&lt;li&gt;🧭 Less boilerplate: no need to calculate metrics manually.&lt;/li&gt;
&lt;li&gt;💥 Better future support for foldable screens and multitasking.&lt;/li&gt;
&lt;li&gt;🧩 Visual cohesion: Material 3 adapts interfaces more easily based on size.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ⚠️ 5. Considerations and Limitations
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Some advanced &lt;code&gt;androidx.window&lt;/code&gt; functions (like &lt;code&gt;FoldingFeature&lt;/code&gt;) may still require&lt;/li&gt;
&lt;li&gt;additional code.&lt;/li&gt;
&lt;li&gt;Full support depends on the version of Compose and Material 3 libraries.&lt;/li&gt;
&lt;li&gt;It is still evolving, so there may be minor changes in the APIs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🚀 6. Conclusion
&lt;/h2&gt;

&lt;p&gt;The migration to Material 3 Adaptive is not only straightforward but also aligns your app with the future of adaptive design on Android.&lt;br&gt;
If you are already using &lt;code&gt;WindowSizeClass&lt;/code&gt;, the change will allow you to maintain a cleaner, modern, and more scalable foundation.&lt;/p&gt;

</description>
      <category>android</category>
      <category>mobile</category>
      <category>tutorial</category>
      <category>ui</category>
    </item>
    <item>
      <title>🪟 Window Size Class: migrando de androidx.window a Material 3 Adaptive</title>
      <dc:creator>Marlon López</dc:creator>
      <pubDate>Sun, 02 Nov 2025 18:36:46 +0000</pubDate>
      <link>https://dev.to/marlonlom/window-size-class-migrando-de-androidxwindow-a-material-3-adaptive-32n5</link>
      <guid>https://dev.to/marlonlom/window-size-class-migrando-de-androidxwindow-a-material-3-adaptive-32n5</guid>
      <description>&lt;p&gt;(Imagen de portada: Representaciones de clases de tamaños de ventana basadas en el ancho, creditos a Google).&lt;/p&gt;

&lt;h6&gt;
  
  
  &lt;strong&gt;Versión en inglés&lt;/strong&gt;: &lt;em&gt;&lt;a href="https://dev.to/marlonlom/-window-size-class-migrating-from-androidxwindow-to-material-3-adaptive-2g0g"&gt;Aquí.&lt;/a&gt;&lt;/em&gt;
&lt;/h6&gt;

&lt;p&gt;En los últimos años, el ecosistema Android ha ido abrazando cada vez más el diseño adaptativo. Desde el auge de los dispositivos plegables hasta las pantallas grandes, la gestión del tamaño de ventana (&lt;code&gt;WindowSizeClass&lt;/code&gt;) se volvió clave para ofrecer experiencias fluidas en cualquier formato.&lt;/p&gt;

&lt;p&gt;Con la llegada de &lt;strong&gt;Material 3 Adaptive&lt;/strong&gt;, Google propone una nueva forma de manejar las clases de tamaño de ventana, integrando este concepto directamente en las librerías de Material Design.&lt;br&gt;
En este artículo quiero compartir mi experiencia migrando de &lt;code&gt;androidx.window&lt;/code&gt; a la nueva API de Material 3, los retos que encontré y las ventajas que trae este cambio.&lt;/p&gt;
&lt;h2&gt;
  
  
  🧩 1. Contexto: el enfoque anterior (&lt;em&gt;androidx.window&lt;/em&gt;)
&lt;/h2&gt;

&lt;p&gt;Hasta hace poco, la forma más común de calcular clases de tamaño era usando:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.window.layout.WindowMetricsCalculator&lt;/span&gt;

&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;metrics&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;WindowMetricsCalculator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getOrCreate&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;computeCurrentWindowMetrics&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;activity&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;width&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;metrics&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;bounds&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;width&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;height&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;metrics&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;bounds&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;height&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Luego, se derivaba manualmente la clase de tamaño (compact, medium, expanded) o se usaba la extensión WindowSizeClass de &lt;code&gt;androidx.compose.material3.windowsizeclass&lt;/code&gt;.&lt;br&gt;
Esto funcionaba bien, pero requería una configuración manual y estaba algo separado de las prácticas modernas de Material 3.&lt;/p&gt;
&lt;h2&gt;
  
  
  🧱 2. Material 3 Adaptive: el nuevo camino
&lt;/h2&gt;

&lt;p&gt;Material 3 introduce una nueva API unificada para manejar layouts adaptativos, integrando mejor las clases de tamaño con los componentes de diseño.&lt;/p&gt;

&lt;p&gt;Ahora puedes usar:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.compose.material3.adaptive.WindowAdaptiveInfo&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.compose.material3.adaptive.currentWindowAdaptiveInfo&lt;/span&gt;
&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;adaptiveInfo&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;currentWindowAdaptiveInfo&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;windowSizeClass&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;adaptiveInfo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;windowSizeClass&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Esto simplifica el acceso al tamaño actual de la ventana y lo conecta con otros elementos del sistema adaptativo (por ejemplo, &lt;code&gt;NavigationSuiteScaffold&lt;/code&gt; o &lt;code&gt;PaneScaffold&lt;/code&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  🔄 3. El proceso de migración
&lt;/h2&gt;

&lt;p&gt;Durante la migración, los pasos principales fueron:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Eliminar dependencias de androidx.window (por ejemplo, &lt;code&gt;androidx.window:window&lt;/code&gt; o &lt;code&gt;androidx.window:window-java&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Actualizar las dependencias de Material 3 a una versión que soporte adaptive.&lt;/li&gt;
&lt;li&gt;Reemplazar las funciones de cálculo de métricas por el uso de &lt;code&gt;currentWindowAdaptiveInfo()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Ajustar los puntos de quiebre (breakpoints) si usabas valores personalizados&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  💡 4. Beneficios del nuevo enfoque
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;✅ Integración directa con los componentes adaptativos de Material 3.&lt;/li&gt;
&lt;li&gt;🧭 Menos boilerplate: no hay que calcular métricas manualmente.&lt;/li&gt;
&lt;li&gt;💥 Mejor soporte futuro para pantallas plegables y multitareas.&lt;/li&gt;
&lt;li&gt;🧩 Cohesión visual: Material 3 adapta más fácilmente las interfaces según el tamaño.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ⚠️ 5. Consideraciones y limitaciones
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Algunas funciones avanzadas de androidx.window (como &lt;code&gt;FoldingFeature&lt;/code&gt;) aún pueden requerir&lt;/li&gt;
&lt;li&gt;código adicional.&lt;/li&gt;
&lt;li&gt;El soporte completo depende de la versión de Compose y de las librerías de Material 3.&lt;/li&gt;
&lt;li&gt;Aún está en evolución, así que puede haber cambios menores en las APIs`.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🚀 6. Conclusión
&lt;/h2&gt;

&lt;p&gt;La migración a Material 3 Adaptive no solo es sencilla, sino que alinea tu app con el futuro del diseño adaptativo en Android.&lt;br&gt;
Si ya estás usando &lt;code&gt;WindowSizeClass&lt;/code&gt;, el cambio te permitirá mantener una base más limpia, moderna y escalable.&lt;/p&gt;

</description>
      <category>android</category>
      <category>materialdegisn3</category>
      <category>jetpackcompose</category>
      <category>windowsizeclass</category>
    </item>
    <item>
      <title>First steps using Material3 in a WearOS Android App</title>
      <dc:creator>Marlon López</dc:creator>
      <pubDate>Sun, 22 Sep 2024 18:43:20 +0000</pubDate>
      <link>https://dev.to/marlonlom/first-steps-using-material3-in-a-wearos-android-app-1l92</link>
      <guid>https://dev.to/marlonlom/first-steps-using-material3-in-a-wearos-android-app-1l92</guid>
      <description>&lt;p&gt;Would you like your WearOS app to have the same modern and sophisticated look as the latest Android apps? Material Design 3, design system built and supported by Google, has already transformed the look and feel of millions of apps. Now, it’s your wearable apps’ turn. Although the library responsible for applying material3 in WearOS is still in alpha phase, this new specification promises to take smartwatch user interfaces to the next level.&lt;/p&gt;

&lt;p&gt;In the following text, I will share some aspects to take into account when changing from current material design system library to material3 in our Android applications for WearOS.&lt;/p&gt;

&lt;h2&gt;
  
  
  About WearOS Compose Material 3 Library
&lt;/h2&gt;

&lt;p&gt;This library makes it easier for developers to write Jetpack Compose applications for Wearable devices that implement Wear Material 3 Design UX guidelines and specifications.&lt;/p&gt;

&lt;h3&gt;
  
  
  Let's start the migration
&lt;/h3&gt;

&lt;p&gt;In Android studio, create a new project that generates a WearOS App. you can check the instructions from the &lt;a href="https://developer.android.com/training/wearables/get-started/creating" rel="noopener noreferrer"&gt;Android Official Guide&lt;/a&gt;, After created, lets check that the the app is successfully built and running in an emulator or phisical wearable device.&lt;/p&gt;

&lt;h3&gt;
  
  
  Adding the Wear Compose Material 3 library
&lt;/h3&gt;

&lt;p&gt;When moving from the actual Wear Compose Material library to the Material3 one, its important to note that, at the time of writing, it was straightforward to change the composables used, just be careful with this, not all composables available in the material2 version have the corresponding material3 composable for WearOS.&lt;/p&gt;

&lt;p&gt;Android Wear Compose Material 3 library can be installed using the instructions from &lt;a href="https://mvnrepository.com/artifact/androidx.wear.compose/compose-material3" rel="noopener noreferrer"&gt;Maven central&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="nf"&gt;dependencies&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="o"&gt;..&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
  &lt;span class="nf"&gt;implementation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"androidx.wear.compose:compose-material3:1.0.0-alpha25"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="o"&gt;..&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;  
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The library version at the time of writing is &lt;code&gt;1.0.0-alpha25&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Inside the &lt;code&gt;build.gradle.kts&lt;/code&gt; file in the wearos app module, replace the previous wear compose material dependency &lt;code&gt;androidx.wear.compose:compose-material&lt;/code&gt; with the above one. If youre using version catalogs, apply the adjustments in the respective &lt;code&gt;gradle/libs.version.toml&lt;/code&gt; file as well.&lt;/p&gt;

&lt;p&gt;Next, clean and rebuild the project, at this moment, the errors related to the replaced wear compose material library starts to show up.&lt;/p&gt;

&lt;h3&gt;
  
  
  Adjusting the MaterialTheme
&lt;/h3&gt;

&lt;p&gt;So far so good, now, we're gonna fix the material theme properties (colors, typography, theme composable) using the new material3 classes for wearos.&lt;/p&gt;

&lt;p&gt;Keep in mind that we're using an alpha version of the Android Wear Compose Material 3 library, so, the foundations of the library can be changed in the future.&lt;/p&gt;

&lt;h4&gt;
  
  
  Part 01: Color schemes
&lt;/h4&gt;

&lt;p&gt;Firstly, the material 3 colors are different from previous material color system, so, in the Color.kt file, we see the contents like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="cm"&gt;/* Color.kt */&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.compose.ui.graphics.Color&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.wear.compose.material.Colors&lt;/span&gt;

&lt;span class="k"&gt;internal&lt;/span&gt; &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;wearColorPalette&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Colors&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Colors&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;primary&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFFAECBFA&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;primaryVariant&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFF8AB4F8&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;secondary&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFFFDE293&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;secondaryVariant&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFF594F33&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;background&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Black&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;surface&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFF303133&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;error&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFFEE675C&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;onPrimary&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFF303133&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;onSecondary&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFF303133&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;onBackground&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;White&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;onSurface&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;White&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;onSurfaceVariant&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFFDADCE0&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;onError&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFF000000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, we change the &lt;code&gt;Colors&lt;/code&gt; variable with the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="cm"&gt;/* Color.kt */&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.compose.ui.graphics.Color&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.wear.compose.material3.ColorScheme&lt;/span&gt;

&lt;span class="k"&gt;internal&lt;/span&gt; &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;wearColorPalette&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ColorScheme&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;primary&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFF1F3701&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;primaryDim&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFF1F3701&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;primaryContainer&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFFCDEDA3&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;onPrimary&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFF354E16&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;onPrimaryContainer&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFFBFCBAD&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;secondary&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFF2A331E&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;secondaryDim&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFF2A331E&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;secondaryContainer&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFFDCE7C8&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;onSecondary&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFF404A33&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;onSecondaryContainer&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFFA0D0CB&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;tertiary&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFF003735&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;tertiaryDim&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFF003735&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;tertiaryContainer&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFFBCECE7&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;onTertiary&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFF1F4E4B&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;onTertiaryContainer&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFFFFB4AB&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;onSurface&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFF44483D&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;onSurfaceVariant&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFF8F9285&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;surfaceContainerLow&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFF1E201A&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;surfaceContainer&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFF282B24&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;surfaceContainerHigh&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFF33362E&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;outline&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFF44483D&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;outlineVariant&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFF000000&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;background&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFF12140E&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;onBackground&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFFE2E3D8&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;error&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFF690005&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;onError&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFF93000A&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;errorContainer&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFFFFDAD6&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;onErrorContainer&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xFFE2E3D8&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When using &lt;code&gt;ColorScheme&lt;/code&gt; class, the attributes are quite similar to the m3 color available in &lt;a href="https://m3.material.io/styles/color/system/how-the-system-works" rel="noopener noreferrer"&gt;the official m3 website&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For the color selection process, we refer to the &lt;a href="https://material-foundation.github.io/material-theme-builder/" rel="noopener noreferrer"&gt;material3 theme builder website&lt;/a&gt;. When picking the colors and fonts, and finally exporting the theme (in this scenario, export the compose theme), inside the exported theme it exists the &lt;code&gt;Color.kt&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;Check the exported theme, open the &lt;code&gt;Color.kt&lt;/code&gt; file, check the color pallete for light and dark theme, alog with the dynamic color contrast color palette, in it, you can find the dark color palette.&lt;/p&gt;

&lt;p&gt;In this topic, the color palette for wearos takes the dark theme and not the light theme (not recommended, by the way), so, you use the dark colors pallete (os the dynamic color contrast color palettes) for initializing the color attributes in the &lt;code&gt;ColorScheme&lt;/code&gt; class, with those attributes, the color palette.&lt;/p&gt;

&lt;p&gt;After creating the color scheme for wearos, you can change the colors, but, keep in mind the material 3 color system definitions when doing so.&lt;/p&gt;

&lt;h4&gt;
  
  
  Part 02: Typography
&lt;/h4&gt;

&lt;p&gt;In WearOS apps, there is a recommendation &lt;a href="https://developer.android.google.cn/design/ui/wear/guides/styles/typography" rel="noopener noreferrer"&gt;in the official ui design guide&lt;/a&gt; for using the default typography, which includes the Roboto font and the default settings (weight, size, style, etc.).&lt;/p&gt;

&lt;p&gt;Now, let's change the typography for wearos app module using the m3 new &lt;code&gt;Typography&lt;/code&gt; class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="cm"&gt;/* Type.kt */&lt;/span&gt;

&lt;span class="cm"&gt;/* NOTE: New import, the old one is:&amp;lt;br&amp;gt; 
 * import androidx.wear.compose.material.Typography 
 */&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.wear.compose.material3.Typography&lt;/span&gt;

&lt;span class="c1"&gt;// Set of Material typography styles to start with&lt;/span&gt;
&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;appTypography&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Typography&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;..&lt;/span&gt;&lt;span class="p"&gt;.)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this topic, the textstyles for the Typography class are very different, for reference, lets see the following table:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;M2 Typography Text styles&lt;/th&gt;
&lt;th&gt;M3 Typography Text styles&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;display1&lt;br&gt;display2&lt;br&gt;display3&lt;br&gt;title1&lt;br&gt;title2&lt;br&gt;title3&lt;br&gt;body1&lt;br&gt;body2&lt;br&gt;button&lt;br&gt;caption1&lt;br&gt;caption2&lt;br&gt;caption3&lt;/td&gt;
&lt;td&gt;displayLarge&lt;br&gt;displayMedium&lt;br&gt;displaySmall&lt;br&gt;titleLarge&lt;br&gt;titleMedium&lt;br&gt;titleSmall&lt;br&gt;labelLarge&lt;br&gt;labelMedium&lt;br&gt;labelSmall&lt;br&gt;bodyLarge&lt;br&gt;bodyMedium&lt;br&gt;bodySmall&lt;br&gt;bodyExtraSmall&lt;br&gt;numeralExtraLarge&lt;br&gt;numeralLarge&lt;br&gt;numeralMedium&lt;br&gt;numeralSmall&lt;br&gt;numeralExtraSmall&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The typography attributes / text styles are defined in a similar way to the official material 3 documentation, so, after changing the class, you can make the customizations that you want for default font family, sizes, etc. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;NOTE: At the time of writing this, I am not aware of the &lt;code&gt;numeral&lt;/code&gt; TextStyle and where to use it in composables, so we will keep an eye out for future updates to the Android Wear Compose Material 3 library.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  Part 03: Shapes
&lt;/h4&gt;

&lt;p&gt;Following with the material 3 Shapes for WearOS, they have similar recommendations and default settings as the previous section: For shapes, the official documentation generally recommend using the default Material Wear shapes which are optimized for round and non-round devices.&lt;/p&gt;

&lt;p&gt;Now, let's change the shapes configuration for wearos app module using the m3 new &lt;code&gt;Shapes&lt;/code&gt; class, if it doesn not exist, create the &lt;code&gt;Shape.kt&lt;/code&gt; file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="cm"&gt;/* Shape.kt */&lt;/span&gt;

&lt;span class="cm"&gt;/* NOTE: New import, the old one is:&amp;lt;br&amp;gt; 
 * import androidx.wear.compose.material.Shapes 
 */&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.wear.compose.material3.Shapes&lt;/span&gt;

&lt;span class="c1"&gt;// Set of Material typography styles to start with&lt;/span&gt;
&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;appShapes&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Shapes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;..&lt;/span&gt;&lt;span class="p"&gt;.)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The new Shapes class have added 2 more shape configurations, for reference, lets check the following table:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;M2 Shapes&lt;/th&gt;
&lt;th&gt;M3 Shapes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;small&lt;br&gt;medium&lt;br&gt;large&lt;/td&gt;
&lt;td&gt;extraSmall&lt;br&gt;small&lt;br&gt;medium&lt;br&gt;large&lt;br&gt;extraLarge&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;You can customize the Shapes configuration for any of the listed shape sizes, but, keep in mind the material 3 color system definitions when doing so.&lt;/p&gt;

&lt;h4&gt;
  
  
  Part 04: Theme Composable
&lt;/h4&gt;

&lt;p&gt;Now, let's glue the previous settings into the MaterialTheme composable function, in this topic, we do the following:&lt;/p&gt;

&lt;p&gt;1- Fix the import, so we call &lt;code&gt;MaterialTheme&lt;/code&gt; from material3 package.&lt;br&gt;
2- Check that the colorScheme, typoghaphy (and shapes, if you did a customization of shapes) are compatible.&lt;/p&gt;

&lt;p&gt;After this, the results is described in the following snippet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="cm"&gt;/* Theme.kt */&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.compose.runtime.Composable&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.wear.compose.material3.MaterialTheme&lt;/span&gt;

&lt;span class="nd"&gt;@Composable&lt;/span&gt;
&lt;span class="nc"&gt;WearosTheme&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nd"&gt;@Composable&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Unit&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nc"&gt;MaterialTheme&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;colorScheme&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;wearColorPalette&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;typography&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;appTypography&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="cm"&gt;/* For shapes, we generally recommend using the default 
     * Material Wear shapes which are optimized for round 
     * and non-round devices.
     */&lt;/span&gt;
    &lt;span class="n"&gt;shapes&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;appShapes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;content&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;    
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After doing this, let's clean and rebuild the project, since here we are ding the migration in a newly created wearos project, the error could be found in the &lt;code&gt;MainActivity&lt;/code&gt; class and they are related to some imports and classes, so, let's fix them in the next section.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fixing the errors in MainActivity class
&lt;/h3&gt;

&lt;p&gt;Inside the &lt;code&gt;mainActivity&lt;/code&gt; class, the following errors appeared:&lt;/p&gt;

&lt;p&gt;a. Fix the imports related to &lt;code&gt;androidx.wear.compose.material&lt;/code&gt; package:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.wear.compose.material3.MaterialTheme&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.wear.compose.material3.Text&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.wear.compose.material3.TimeText&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;b. Fix the usage of &lt;code&gt;MaterialTheme.colors&lt;/code&gt; to &lt;code&gt;MaterialTheme.colorScheme&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="nc"&gt;MaterialTheme&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;colors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;background&lt;/span&gt; &lt;span class="p"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;MaterialTheme&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;colorScheme&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;background&lt;/span&gt;
&lt;span class="nc"&gt;MaterialTheme&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;colors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;primary&lt;/span&gt; &lt;span class="p"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;MaterialTheme&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;colorScheme&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;primary&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;c. Fix the &lt;code&gt;TimeText&lt;/code&gt; composable invocation, inside the &lt;code&gt;WearApp&lt;/code&gt; composable function body, here, we adjust the &lt;code&gt;WearApp&lt;/code&gt; composable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="cm"&gt;/* MainActivity.kt */&lt;/span&gt;
&lt;span class="nd"&gt;@Composable&lt;/span&gt;
&lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;WearApp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;greetingName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nc"&gt;MyApplicationTheme&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;Box&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="n"&gt;modifier&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Modifier&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fillMaxSize&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;background&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;MaterialTheme&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;colorScheme&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;background&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="n"&gt;contentAlignment&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Alignment&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Center&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nc"&gt;TimeText&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nf"&gt;time&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="nc"&gt;Greeting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;greetingName&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;greetingName&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  ¿What happened in &lt;code&gt;TimeText&lt;/code&gt; composable?
&lt;/h4&gt;

&lt;p&gt;The mentioned composable has been upgraded, you can check the information from &lt;a href="https://composables.com/wear-compose-material3/timetext" rel="noopener noreferrer"&gt;the composables.com website&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The complete &lt;code&gt;MainActivity&lt;/code&gt; class looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="cm"&gt;/* MainActivity.kt */&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;android.os.Bundle&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.activity.ComponentActivity&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.activity.compose.setContent&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.compose.foundation.background&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.compose.foundation.layout.Box&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.compose.foundation.layout.fillMaxSize&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.compose.foundation.layout.fillMaxWidth&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.compose.runtime.Composable&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.compose.ui.Alignment&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.compose.ui.Modifier&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.compose.ui.res.stringResource&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.compose.ui.text.style.TextAlign&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.compose.ui.tooling.preview.Preview&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.wear.compose.material3.MaterialTheme&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.wear.compose.material3.Text&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.wear.compose.material3.TimeText&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;androidx.wear.tooling.preview.devices.WearDevices&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MainActivity&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;ComponentActivity&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;override&lt;/span&gt; &lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;onCreate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;savedInstanceState&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Bundle&lt;/span&gt;&lt;span class="p"&gt;?)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;installSplashScreen&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;super&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;onCreate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;savedInstanceState&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;setTheme&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;android&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;R&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;style&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Theme_DeviceDefault&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;setContent&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nc"&gt;WearApp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Android"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nd"&gt;@Composable&lt;/span&gt;
&lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;WearApp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;greetingName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nc"&gt;MyApplicationTheme&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;Box&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="n"&gt;modifier&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Modifier&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fillMaxSize&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;background&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;MaterialTheme&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;colorScheme&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;background&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="n"&gt;contentAlignment&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Alignment&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Center&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nc"&gt;TimeText&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nf"&gt;time&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="nc"&gt;Greeting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;greetingName&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;greetingName&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nd"&gt;@Composable&lt;/span&gt;
&lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;Greeting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;greetingName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;modifier&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Modifier&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fillMaxWidth&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="n"&gt;textAlign&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;TextAlign&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Center&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;color&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;MaterialTheme&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;colorScheme&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;primary&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;stringResource&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;R&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hello_world&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;greetingName&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nd"&gt;@Preview&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;device&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;WearDevices&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;SMALL_ROUND&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;showSystemUi&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nd"&gt;@Composable&lt;/span&gt;
&lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;DefaultPreview&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nc"&gt;WearApp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Preview Android"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this, the next step is reabuild the project, there will be no errors at this point, so, from here, you can test the wearos app in the emulator or device.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdjtinl3kqd3p0zrn60hg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdjtinl3kqd3p0zrn60hg.png" alt="Wearos sample app running in emulator" width="456" height="456"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusions
&lt;/h2&gt;

&lt;p&gt;In this 'first steps' blog post, we learned to apply the Android Wear Compose Material 3 library, as a first glance, we found similar configs for the color schemes, typography, shapes and theme composable function, but, there are more changes, like the &lt;code&gt;TimeText&lt;/code&gt; composable, that we could apply while using the library.&lt;/p&gt;

&lt;p&gt;Keep in mind that the library is in alpha state, and, while so, there will be changes inside it, which can affect the usage of the composables/classes/values described here.&lt;/p&gt;

&lt;p&gt;I hope you find this informative and useful and that at some point you can follow these steps in your Android applications, in order to apply a good migration to material 3 when developing Wearos apps.&lt;/p&gt;

&lt;p&gt;Thanks for reading, happy coding! 😊&lt;/p&gt;

</description>
      <category>wearos</category>
      <category>android</category>
      <category>jetpackcompose</category>
    </item>
    <item>
      <title>Adapt Kotlin 2.0 in Android applications</title>
      <dc:creator>Marlon López</dc:creator>
      <pubDate>Sat, 01 Jun 2024 23:43:07 +0000</pubDate>
      <link>https://dev.to/marlonlom/adapt-kotlin-20-in-android-applications-3cmk</link>
      <guid>https://dev.to/marlonlom/adapt-kotlin-20-in-android-applications-3cmk</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://dev.to/marlonlom/adaptar-kotlin-20-en-aplicaciones-android-1kfa"&gt;Read this post in Spanish here.&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Recently, version 2.0 of Kotlin has been released, and with it, several adjustments to Android projects to adapt or implement code with this new version of the programming language officially supported by Google for Android mobile development (Multiplatform, according to the latest versions of the Google I/O event).&lt;/p&gt;

&lt;p&gt;In this short article, I explain my experience migrating from version &lt;code&gt;1.9.23&lt;/code&gt; to version &lt;code&gt;2.0.0&lt;/code&gt;; This, due to the novelties that the use of this new version covers in projects that use Kotlin as a programming language, and also the possible difficulty for many of us developers to apply migrations from versions of Kotlin much lower than &lt;code&gt;1.9.0&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  About the K2 compiler
&lt;/h2&gt;

&lt;p&gt;The K2 compiler is a complete reimplementation of the original Kotlin compiler, designed to offer significant improvements in Android application development. Introduced in Kotlin 2.0, K2 provides several advantages, among which are: faster compilation speed, performance improvements, and improved cross-platform support; These advantages applied to Android projects allow a reduction in the size of the applications by generating more compact code, as well as the generation of native code which implies greater performance in mobile applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to test K2 compiler on Android?
&lt;/h3&gt;

&lt;p&gt;It is worth mentioning that this section covers the configuration aspect from the point of view of Android projects. I will not mention details of KMP, although several of the details indicated are easy to assimilate if one already has experience in cross-platform projects using Kotlin.&lt;/p&gt;

&lt;h4&gt;
  
  
  1. A new build directory
&lt;/h4&gt;

&lt;p&gt;Kotlin 2.0 introduces a new build output directory: &lt;code&gt;.kotlin&lt;/code&gt;. you must add it to the &lt;code&gt;.gitignore&lt;/code&gt; file so that its contents do not appear in commits:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#.gitignore
# Kotlin 2.0
.kotlin/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  2. Apply new version of kotlin
&lt;/h4&gt;

&lt;p&gt;Now we go to the gradle/libs.versions.toml file, in this section, it is assumed that Version Catalogs are being used to control the dependencies of the mobile application (versions, plugins, etc.), The reference to the Kotlin version is located, and it is changed to version 2.0.0. So:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# gradle/libs.versions.toml
[versions]
agp="8.4.1"
kotlin="2.0.0"
ksp="2.0.0-1.0.21"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Regarding compatibility, the versions of the Kotlin symbol processor (KSP) libraries and the gradle plugin for Android (AGP, acronym used for reference) must also be updated. The previous snippet indicates the versions for review.&lt;/p&gt;

&lt;p&gt;At the library level, the following Kotlin libraries are also updated:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# gradle/libs.versions.toml
[libraries]
kotlin-gradle-plugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.0"
kotlin-serialization-plugin = "org.jetbrains.kotlin:kotlin-serialization:2.0.0"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Note: there are libraries that, at the time of writing this article, did not present problems in terms of changing versions, such as &lt;code&gt;kotlin-coroutines&lt;/code&gt;, &lt;code&gt;kotlin-serialization&lt;/code&gt;, &lt;code&gt;kotlin-serialization-json&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;At the plugin level, the Kotlin libraries are also updated below, taking into account the version reference already indicated previously:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# gradle/libs.versions.toml
[plugins]
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this done, run the command &lt;code&gt;gradle clean build&lt;/code&gt; or from Android Studio, build the project.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Update the Compose compiler
&lt;/h4&gt;

&lt;p&gt;Another important aspect regarding the configuration of Android projects, especially using Jetpack Compose, is related to the Compose compiler for Kotlin, which is a configuration that allows the transformation of functions annotated as &lt;code&gt;@Composable&lt;/code&gt; in order to apply optimizations In the compilation of these functions, now, the way of defining the version of the compose compiler has presented a big change, which is described below.&lt;/p&gt;

&lt;p&gt;Previously, the version of the compose compiler had to be placed inside the build.gradle file of the gradle project module that has the Android implementations and that also contains the Jetpack Compose implementations.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* build.gradle.kts */
…
composeOptions {
 kotlinCompilerExtensionVersion="1.5.3"
}
…
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And if you use Version Catalogs, the version would be indicated as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# gradle/libs.versions.toml
[versions]
compose-compiler = “1.5.3”
…
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* build.gradle.kts */
…
composeOptions {
 kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get()
}
…
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This initiative was good at the time, but it has some maintenance problems, since it is required to be compatible with the current version of Kotlin. It is different from the Compose version and the IDE did not propose to improve it. Every time you update your Kotlin version, you have to Google the Jetpack Compose documentation for the compatible version of the Compose compiler. Kotlin 2.0 solves this problem.&lt;/p&gt;

&lt;p&gt;Now, the inclusion of a new gradle plugin is applied to the &lt;code&gt;gradle/libs.versions.toml&lt;/code&gt; file, which is responsible for managing the more organized version of the compose compiler and linked to the Kotlin version.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# gradle/libs.versions.toml
[plugins]
…
kotlin-compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After this action, the &lt;code&gt;build.gradle.kts&lt;/code&gt; file of the Android module that has the Jetpack Compose capabilities is modified, removing the &lt;code&gt;composeOptions configuration. kotlinCompilerExtensionVersion&lt;/code&gt; and adding the reference to the &lt;code&gt;kotlin-compose-compiler&lt;/code&gt; plugin in the &lt;code&gt;plugins { .. }&lt;/code&gt; section.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* build.gradle.kts */
…
plugins {
 …
 alias(libs.plugins.compose.compiler)
}
…
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this done, run the &lt;code&gt;gradle clean build&lt;/code&gt; command or from Android Studio, build the project or synchronize.&lt;/p&gt;

&lt;p&gt;And that's it! This plugin will configure the Compose compiler version based on the current Kotlin version.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusions
&lt;/h2&gt;

&lt;p&gt;Overall, the K2 compiler represents a significant step forward for Android app development with Kotlin. Improvements in speed, performance, and extensibility make it a valuable tool for Android developers.&lt;/p&gt;

&lt;p&gt;Now that the use of Kotlin 2.0.0 is becoming standard, now is a good time to update our Android applications so that they support more of the technology that goes and evolves in terms of Kotlin, KMP, Jetpack Compose, and the other technologies that Google and app developers and mobile libraries are adapting for more modern mobile apps with better features.&lt;/p&gt;

&lt;p&gt;I hope you find this informative and useful and that at some point you can follow these steps in your Android applications, in order to apply a good migration to Kotlin 2.0.0.&lt;/p&gt;

&lt;p&gt;Thanks for reading, happy coding! 😊&lt;/p&gt;

</description>
      <category>kotlin</category>
      <category>android</category>
      <category>jetpackcompose</category>
      <category>k2</category>
    </item>
    <item>
      <title>Adaptar Kotlin 2.0 en aplicaciones Android</title>
      <dc:creator>Marlon López</dc:creator>
      <pubDate>Sat, 01 Jun 2024 18:06:06 +0000</pubDate>
      <link>https://dev.to/marlonlom/adaptar-kotlin-20-en-aplicaciones-android-1kfa</link>
      <guid>https://dev.to/marlonlom/adaptar-kotlin-20-en-aplicaciones-android-1kfa</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://dev.to/marlonlom/adapt-kotlin-20-in-android-applications-3cmk"&gt;Lee este post en inglés aquí.&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Recientemente, se ha liberado la versión 2.0 de Kotlin, y con ello, varios ajustes a los proyectos Android para adaptar o implementar código con esta nueva versión del lenguaje de programación oficialmente soportado por Google para desarrollo móvil Android (Multiplataforma, según las últimas versiones del evento Google I/O).&lt;/p&gt;

&lt;p&gt;En este corto artículo, explico mi experiencia migrando de la versión &lt;code&gt;1.9.23&lt;/code&gt; a la versión &lt;code&gt;2.0.0&lt;/code&gt;; Esto, debido a las novedades que abarca el uso de esta nueva versión en proyectos que usan Kotlin como lenguaje de programación, y también la posible dificultad de muchos de nosotros los desarrolladores para aplicar migraciones desde versiones de Kotlin muy inferiores a la &lt;code&gt;1.9.0&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Acerca del compilador K2
&lt;/h2&gt;

&lt;p&gt;El compilador K2 es una reimplementación completa del compilador Kotlin original, diseñado para ofrecer mejoras significativas en el desarrollo de aplicaciones Android. Introducido en Kotlin 2.0, K2 aporta varias ventajas, entre las que se destacan: mayor velocidad de compilación, mejoras en rendimiento, y soporte multiplataforma mejorado; Estas ventajas aplicadas a proyectos Android, permiten una reducción en el tamaño de las aplicaciones al generar código más compacto, así como la generación de código nativo lo cual implica mayor rendimiento en las aplicaciones móviles.&lt;/p&gt;

&lt;h3&gt;
  
  
  ¿Cómo probar el compilador K2 en Android?
&lt;/h3&gt;

&lt;p&gt;Cabe mencionar, en este apartado se cubre el aspecto de configuración desde el punto de vista de proyectos Android, no mencionaré detalles de KMP, aunque varios de los detalles indicados son fáciles de asimilar si uno ya tiene experiencia en proyectos multiplataforma usando Kotlin.&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Un nuevo directorio de compilación
&lt;/h4&gt;

&lt;p&gt;Kotlin 2.0 presenta un nuevo directorio de salida de compilación: &lt;code&gt;.kotlin&lt;/code&gt;. debes agregarlo al archivo &lt;code&gt;.gitignore&lt;/code&gt; para que su contenido no aparezca en las confirmaciones:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# .gitignore 
# Kotlin 2.0
.kotlin/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  2. Aplicar nueva versión de kotlin
&lt;/h4&gt;

&lt;p&gt;Ahora vamos al archivo gradle/libs.versions.toml, en este apartado, se asume se está utilizando Version Catalogs para controlar las dependencias de la aplicación móvil (versiones, plugins, etc.), Se localiza la referencia a la versión de Kotlin, y se cambia a la versión 2.0.0. así:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# gradle/libs.versions.toml
[versions]
agp = "8.4.1"
kotlin = "2.0.0"
ksp = "2.0.0-1.0.21"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A propósito de la compatibilidad, se debe actualizar también las versiones de las librerías Kotlin symbol processor (KSP) y el plugin gradle para Android (AGP, siglas usadas para referencia), en el snippet anterior se indican las versiones para revisión.&lt;/p&gt;

&lt;p&gt;A nivel de librerías, se actualizan también las librerias de kotlin a continuación:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# gradle/libs.versions.toml
[libraries]
kotlin-gradle-plugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.0"
kotlin-serialization-plugin = "org.jetbrains.kotlin:kotlin-serialization:2.0.0"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Nota: hay librerías que, al momento de la redacción del presente artículo, no presentaron inconvenientes en cuanto a cambio de versiones, como &lt;code&gt;kotlin-coroutines&lt;/code&gt;, &lt;code&gt;kotlin-serialization&lt;/code&gt;, &lt;code&gt;kotlin-serialization-json&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A nivel de plugins, se actualizan también las librerias de kotlin a continuación, esto, tomando en cuenta la referencia de versión ya indicada previamente:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# gradle/libs.versions.toml
[plugins]
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Con esto realizado, ejecutar el comando &lt;code&gt;gradle clean build&lt;/code&gt; o desde Android Studio, hacer build del proyecto.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Actualizar el compilador de Compose
&lt;/h4&gt;

&lt;p&gt;Otro aspecto importante en cuanto a la configuración de proyectos Android, especialmente utilizando Jetpack Compose, es el relacionado con el compilador de Compose para Kotlin, el cual es una configuración que permite la transformación de funciones anotadas como &lt;code&gt;@Composable&lt;/code&gt; en pro de aplicar optimizaciones en la compilación de dichas funciones, ahora, la forma de definir la versión del compilador de compose ha presentado un gran cambio, el cual se describe a continuación.&lt;/p&gt;

&lt;p&gt;Anteriormente, se tenia que colocar la versión del compilador de compose dentro del archivo build.gradle del modulo del proyecto gradle que posea las implementaciones Android y que contengan también las implementaciones de Jetpack Compose.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* build.gradle.kts */
…
composeOptions {
  kotlinCompilerExtensionVersion = "1.5.3"
}
…
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Y en caso de utilizar Version Catalogs, se indicaría la versión de la siguiente manera:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# gradle/libs.versions.toml
[versions]
compose-compiler = “1.5.3”
…
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* build.gradle.kts */
…
composeOptions {
  kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get()
}
…
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Esta iniciativa fue buena en su momento, pero presenta algunos problemas de mantenimiento, ya que se requiere que sea compatible con la versión actual de Kotlin. Es diferente de la versión Compose y el IDE no propuso mejorarla. Cada vez que se actualiza la versión de Kotlin, se tiene que buscar en la documentación de Jetpack Compose en Google la versión compatible del compilador Compose. Kotlin 2.0 soluciona este problema.&lt;/p&gt;

&lt;p&gt;Ahora, se aplica en el archivo &lt;code&gt;gradle/libs.versions.toml&lt;/code&gt; la inclusión de un nuevo plugin de gradle, que se encarga de manejar la versión del compilador de compose mas organizada y ligada a la versión de Kotlin.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# gradle/libs.versions.toml
[plugins]
…
kotlin-compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Luego de esta accion, se modifica el archivo &lt;code&gt;build.gradle.kts&lt;/code&gt; del módulo Android que posea las capacidades de Jetpack Compose, removiendo la configuración &lt;code&gt;composeOptions. kotlinCompilerExtensionVersion&lt;/code&gt; y agregando la referencia al plugin  &lt;code&gt;kotlin-compose-compiler&lt;/code&gt;  en la sección &lt;code&gt;plugins { .. }&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* build.gradle.kts */
…
plugins {
  …
  alias(libs.plugins.compose.compiler)
}
…
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Con esto realizado, ejecutar el comando &lt;code&gt;gradle clean build&lt;/code&gt; o desde Android Studio, hacer build del proyecto o sincronizar.&lt;/p&gt;

&lt;p&gt;¡Y eso es todo! Este complemento configurará la versión del compilador Compose según la versión actual de Kotlin.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusiones
&lt;/h2&gt;

&lt;p&gt;En general, el compilador K2 representa un avance significativo para el desarrollo de aplicaciones Android con Kotlin. Las mejoras en la velocidad, el rendimiento y la extensibilidad lo convierten en una herramienta valiosa para los desarrolladores Android.&lt;/p&gt;

&lt;p&gt;Ahora que ya se está volviendo como estándar el uso de Kotlin 2.0.0, Ahora es buen momento para actualizar nuestros aplicativos Android para que estos soporten más de la tecnología que va y va evolucionando en cuando a Kotlin, KMP, Jetpack Compose, y las demás tecnologías que desde Google y desarrolladores de apps y librerias móviles van adaptando para unas apps móviles mas modernas y con mejores prestaciones.&lt;/p&gt;

&lt;p&gt;Espero que encuentres esto informativo y útil y que en algún momento puedas seguir estos pasos en tus aplicaciones de Android, en pro de aplicar una buena migración hacia Kotlin 2.0.0.&lt;/p&gt;

&lt;p&gt;Gracias por leer, ¡feliz código! 😊&lt;/p&gt;

</description>
      <category>kotlin</category>
      <category>android</category>
      <category>compose</category>
      <category>k2</category>
    </item>
    <item>
      <title>Using launcher and themed icons in Android studio, the manual way</title>
      <dc:creator>Marlon López</dc:creator>
      <pubDate>Sat, 23 Dec 2023 19:41:42 +0000</pubDate>
      <link>https://dev.to/marlonlom/using-launcher-and-themed-icons-in-android-studio-the-manual-way-1h2a</link>
      <guid>https://dev.to/marlonlom/using-launcher-and-themed-icons-in-android-studio-the-manual-way-1h2a</guid>
      <description>&lt;p&gt;As per android official documentation: An adaptive icon can display differently depending on individual device capabilities and user theming. Adaptive icons are primarily used by the launcher on the home screen, but they can also be used in shortcuts, the Settings app, sharing dialogs, and the overview screen.&lt;/p&gt;

&lt;p&gt;In this short article, you can see a way to create and use adaptive icons using png or webp images, this also can be done using svg files, remember that for svg files you have to use a dedicated tool for designing the images.&lt;/p&gt;

&lt;h2&gt;
  
  
  Finding the images
&lt;/h2&gt;

&lt;p&gt;You can use images from the internet for making the launcher icon for your android apps, in most cases, you can grab one from a external site, but, when using the file you must credit to its author.&lt;/p&gt;

&lt;p&gt;The images we'll be using are found in the &lt;a href="https://www.flaticon.com/free-icon/swimming_5200536?related_id=5200536" rel="noopener noreferrer"&gt;Flaticon website&lt;/a&gt;, i like swimming, so the icons choosen.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8z9y2q9c7qbu42pai0mn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8z9y2q9c7qbu42pai0mn.png" alt="Swimming free icon"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.flaticon.com/" rel="noopener noreferrer"&gt;Flaticon&lt;/a&gt; is the largest free database of editable icons with over 7 million resources available.&lt;/p&gt;

&lt;h2&gt;
  
  
  Themed icons
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjbqy7ez2ckak4z3trrtz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjbqy7ez2ckak4z3trrtz.png" alt="Adaptive icons inheriting from the user's wallpaper and themes."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With Android 13 (API level 33) or above, users can theme their adaptive icons, the feature can be enabled via device system settings.&lt;/p&gt;

&lt;p&gt;For the exercise, i selected the icons provided for the normal launcher icon and the themed icon.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2t6kfpua41ukjgebw1p5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2t6kfpua41ukjgebw1p5.png" alt="Launcher and monochrome icons"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The icons used has to have equal size (512px in this case), both the launcher and the themed/monochrome icon has to be with transparent background.&lt;/p&gt;

&lt;h2&gt;
  
  
  Add adaptive icons in android studio
&lt;/h2&gt;

&lt;p&gt;In this section, we go to android studio, we can choose to create a new project or use an existing one, just keep in mind that if the following actions are applied, it is recommended to keep in mind that when creating the adaptive icons they replace the existing icons (it is assumed there is version control applied in these cases).&lt;/p&gt;

&lt;p&gt;Once in the IDE, check the res folder, right-click on it and select the option &lt;em&gt;New&lt;/em&gt; &amp;gt; &lt;em&gt;Image asset&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0koltwmu70cg77zea0cr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0koltwmu70cg77zea0cr.png" alt="Opening image asset generator in android studio"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once the image asset configuration dialog appears, we can select the image for the icon in the foreground layer tab, for this part we select the monochrome icon that we chose earlier, also, we set the scaling for the icon to be trimmed and to have a zoom of 60%.&lt;/p&gt;

&lt;p&gt;Later, in the background layer tab, we select the source asset type to color, and set the color using the hex color #FFFBFE, additional settings remain as the default in the dialog.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyyrilrxidufymgm5mw0y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyyrilrxidufymgm5mw0y.png" alt="Image asset configuration for monochrome icon"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After configured the icon, we do click Next, for reviewing the icon files to be generated.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F80qd1tf12hv06h9j27xf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F80qd1tf12hv06h9j27xf.png" alt="Confirming icon path"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this screen, we can see that the images are stored in the mipmap folders for each available app density, also, the images generated using the filenames &lt;code&gt;ic_launcher.xml&lt;/code&gt;, &lt;code&gt;ic_launcher_round.webp&lt;/code&gt; and  &lt;code&gt;ic_launcher_foreground.webp&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;At this point, we are going to use the &lt;code&gt;ic_launcher_foreground.webp&lt;/code&gt; files, because those icons represent the monochrome foreground layer for the themed icon.&lt;/p&gt;

&lt;p&gt;The following step is to rename the &lt;code&gt;ic_launcher_foreground.webp&lt;/code&gt; files to &lt;code&gt;ic_launcher_monochrome.webp&lt;/code&gt;. for this, we can use the menu &lt;em&gt;Refactor&lt;/em&gt; &amp;gt; &lt;em&gt;Rename (Mayus + F6)&lt;/em&gt; option.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdg31c0e143oroglyuz2y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdg31c0e143oroglyuz2y.png" alt="Renaming the generated 'ic_launcher_foreground' webp files"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw6bwdv27dcn23n3dff1v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw6bwdv27dcn23n3dff1v.png" alt="Changing name to 'ic_launcher_foreground' webp files"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After renamimg, the files are shown like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyou0kbismsulxwfi3u37.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyou0kbismsulxwfi3u37.png" alt="Displaying ic_launcher_monochrome files"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, we repeat the steps for adding a launcher icon, this time, adding the normal icon we choosed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7qwge2gf4jl639kama6k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7qwge2gf4jl639kama6k.png" alt="Image asset configuration for colored icon"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As result, we have both the monochrome and the colored foreground layer for the adaptive icon.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3huaavcmo2vtnim7yapt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3huaavcmo2vtnim7yapt.png" alt="Monochrome and normal foreground layers for adaptive icon"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Now, check the results for the adaptive icon display
&lt;/h3&gt;

&lt;p&gt;Now that we have ready the launcher icon using the normal colored image we used, this time we check the launcher.xml files, which contains the setting for the foreground layer and the background layer for the adaptive icon.&lt;/p&gt;

&lt;p&gt;In the exercise, we made both the not-round and the round launcher icon based on the configuration we used before for creating the launcher icons, so, we check both xml files:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

{root project folder}/app/src/main/res/mipmap-anydpi-v26
res/mipmap-anydpi-v26/
 ic_launcher.xml
 ic_launcher_round.xml


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Both files have the following xml content for the adaptive icon configuration, in which is used the &lt;code&gt;&amp;lt;adaptive-icon&amp;gt;&lt;/code&gt; element to define the foreground, background, and monochromatic layer drawables for the icons:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;

&lt;span class="cp"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;adaptive-icon&lt;/span&gt; &lt;span class="na"&gt;xmlns:android=&lt;/span&gt;&lt;span class="s"&gt;"http://schemas.android.com/apk/res/android"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;background&lt;/span&gt; &lt;span class="na"&gt;android:drawable=&lt;/span&gt;&lt;span class="s"&gt;"@color/ic_launcher_background"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;foreground&lt;/span&gt; &lt;span class="na"&gt;android:drawable=&lt;/span&gt;&lt;span class="s"&gt;"@mipmap/ic_launcher_foreground"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/adaptive-icon&amp;gt;&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;For the monochrome we add the &lt;code&gt;&amp;lt;monochrome&amp;gt;&lt;/code&gt; drawable xml element after the foreground xml element.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;

&lt;span class="cp"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;adaptive-icon&lt;/span&gt; &lt;span class="na"&gt;xmlns:android=&lt;/span&gt;&lt;span class="s"&gt;"http://schemas.android.com/apk/res/android"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;background&lt;/span&gt; &lt;span class="na"&gt;android:drawable=&lt;/span&gt;&lt;span class="s"&gt;"@color/ic_launcher_background"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;foreground&lt;/span&gt; &lt;span class="na"&gt;android:drawable=&lt;/span&gt;&lt;span class="s"&gt;"@mipmap/ic_launcher_foreground"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;monochrome&lt;/span&gt; &lt;span class="na"&gt;android:drawable=&lt;/span&gt;&lt;span class="s"&gt;"@mipmap/ic_launcher_monochrome"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/adaptive-icon&amp;gt;&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;With that, the themed adaptive icon is configured. Now, let's check the result visually, for that, open the &lt;code&gt;ic_launcher.xml&lt;/code&gt; file and ensure to have clicked the split option for viewing both the code and the design result.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpdsvfzj9ed3ascsajzbf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpdsvfzj9ed3ascsajzbf.png" alt="Split view for ic_launcher.xml"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the upper right side of the split view, we can see the icon with a representation for dark/night mode, when we click that option, we can see the options for selecting the theme mode (night/not-night) and the dynamic color theme.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F78z5vyfkwlg1lejwljyv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F78z5vyfkwlg1lejwljyv.png" alt="Changing display for adaptive icon"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At this point, we can change the mode and the dynamic color for display the themed icon variant.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0tfzw8eca39s1vbkfziz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0tfzw8eca39s1vbkfziz.png" alt="Themed icon preview with dynamic, not-night mode"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8x4gbqz3y56typ4xtsn0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8x4gbqz3y56typ4xtsn0.png" alt="Themed icon preview with dynamic, night mode"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Preview in devices
&lt;/h2&gt;

&lt;p&gt;After creating the launcher icon and the themed / monochrome variant, we can test the icon displayed in the device or the emulator, for that, just build and test the android app, for the device, try to use a device/emulator using android version 13 or above.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy0h8ad5mfpbccfw9568c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy0h8ad5mfpbccfw9568c.png" alt="Displaying launcher icon (normal -&gt; themed)"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From left to right:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Displayed normal launcher icon in the home screen&lt;/li&gt;
&lt;li&gt;Wallpaper and style system configuration, here, select themed icons &lt;/li&gt;
&lt;li&gt;Displayed themed launcher icon in the home screen&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;With this exercise it was possible to perform a manual configuration of the launcher icon for an Android application using the adaptive icon concept.&lt;/p&gt;

&lt;p&gt;Although it can also be done using SVG files, as recommended by Google's Android developers, in cases where you have png image files, this way can be very useful when creating these launcher icons.&lt;/p&gt;

&lt;p&gt;Adaptive icons not only apply to launchers, they can also be applied to notification icons and shortcut icons, but the content of this article covers launcher icons.&lt;/p&gt;

&lt;p&gt;...&lt;/p&gt;

&lt;p&gt;Thank you for taking the time to read my article, it has been a while since I last wrote any long text in these parts. If you find something isn't quite right or have other information to add, feel free to add a respectful comment.&lt;br&gt;
If you like this article, please click the clap icon or share it on social media (or both).&lt;/p&gt;

&lt;p&gt;I Hope that you find this informative and useful and in some time you can use these steps in your android apps.&lt;/p&gt;

&lt;p&gt;Thanks for reading, Happy coding!! 😊&lt;/p&gt;

&lt;p&gt;...&lt;/p&gt;

&lt;h1&gt;
  
  
  Further reading
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.android.com/develop/ui/views/launch/icon_design_adaptive" rel="noopener noreferrer"&gt;Use launcher adaptive icons, Official Android documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>android</category>
      <category>androidstudio</category>
      <category>themedicons</category>
      <category>design</category>
    </item>
  </channel>
</rss>
