<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Lucas Yuji Yoshimine on Medium]]></title>
        <description><![CDATA[Stories by Lucas Yuji Yoshimine on Medium]]></description>
        <link>https://medium.com/@lucasyujideveloper?source=rss-ee6891af97c8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*1y2iESxdT9HMQD_8xcNjcQ.jpeg</url>
            <title>Stories by Lucas Yuji Yoshimine on Medium</title>
            <link>https://medium.com/@lucasyujideveloper?source=rss-ee6891af97c8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 08:42:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@lucasyujideveloper/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Camposer: Jetpack Compose camera library for Android]]></title>
            <link>https://medium.com/@lucasyujideveloper/camposer-camera-library-using-jetpack-compose-for-android-3af63220fa00?source=rss-ee6891af97c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/3af63220fa00</guid>
            <category><![CDATA[jetpack-compose]]></category>
            <category><![CDATA[android-libraries]]></category>
            <category><![CDATA[android-camera]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Lucas Yuji Yoshimine]]></dc:creator>
            <pubDate>Fri, 25 Nov 2022 13:05:20 GMT</pubDate>
            <atom:updated>2022-11-25T13:24:52.481Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8RIWPIqZLH-E6FYscNTK1g.jpeg" /><figcaption>Photo by <a href="https://www.pexels.com/@pixabay?utm_content=attributionCopyText&amp;utm_medium=referral&amp;utm_source=pexels">Pixabay</a> from <a href="https://www.pexels.com/photo/clear-light-bulb-on-black-surface-356043/?utm_content=attributionCopyText&amp;utm_medium=referral&amp;utm_source=pexels">Pexels</a></figcaption></figure><p>Tired to use a camera library with interoperability using Jetpack Compose? so <a href="https://github.com/ujizin/Camposer">Camposer</a> was made for you, a camera library only using Jetpack Compose.</p><p>This story will guide you on how to implement Camposer into your project, so let’s start!</p><figure><img alt="camera preview recording video" src="https://cdn-images-1.medium.com/max/320/1*rJDnooeuBmX2wqvw53QI3g.gif" /><figcaption><a href="https://github.com/ujizin/Camposer/tree/main/camposer">https://github.com/ujizin/Camposer/tree/main/camposer</a></figcaption></figure><h3>Setup</h3><p>First, you need to add a dependency, with the <a href="https://github.com/ujizin/Camposer">latest version</a>, to your build.gradle (module):</p><pre>dependencies {<br>  implementation(&quot;io.github.ujizin:camposer:&lt;version&gt;&quot;)<br>}</pre><h3>How it works</h3><p>Let’s begin using CameraPreview to display on UI.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/49775c391d5f6694488711f016cc3f91/href">https://medium.com/media/49775c391d5f6694488711f016cc3f91/href</a></iframe><ul><li>CameraPreview is the composable function to display the camera preview.</li><li>CameraState is not required for preview, but it’s necessary for action as taking a picture, recording videos, and for internal states (flash &amp; image analyzer)</li></ul><h4>Switch Cameras</h4><p>To switch cameras, use CamSelector.Back or CamSelector.Front, and it can be used with a state like the below example:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b95c635ddf40b8432cadfe4238d9ea08/href">https://medium.com/media/b95c635ddf40b8432cadfe4238d9ea08/href</a></iframe><h4>Taking pictures</h4><p>for this, you’ll just need to use CameraState and call takePicture method from it, like the example below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e20fe7e826865ba32f117c32ac14f10d/href">https://medium.com/media/e20fe7e826865ba32f117c32ac14f10d/href</a></iframe><h4>Recording Video</h4><p>It’s very similar to taking pictures. For this, you need to change the capture mode for CaptureMode.Video and call toggleRecording twice times for stop recording.</p><p><strong><em>ps</em></strong>: you can use startRecording and stopRecording separately.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/038d35673904ea70e4ae34c0e46cdd6e/href">https://medium.com/media/038d35673904ea70e4ae34c0e46cdd6e/href</a></iframe><h4>Other Configurations</h4><p>There are a lot of other configurations on Camposer, if you want to use some of them check out the <a href="https://github.com/ujizin/Camposer/wiki">Camposer Wiki</a> for more information!</p><p><a href="https://github.com/ujizin/Camposer/wiki">Home · ujizin/Camposer Wiki</a></p><p>And that’s all folks!</p><p>Check out the sample projects (including this from the story).</p><ul><li><a href="https://github.com/ujizin/camera-compose">GitHub - ujizin/camera-compose: Camera using Jetpack Compose with no interoperability (Camposer) 📸</a></li><li><a href="https://github.com/ujizin/Camposer/tree/main/sample">Camposer/sample at main · ujizin/Camposer</a></li></ul><p>Have a fun code()!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3af63220fa00" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Organizing dependencies with version catalogs in gradle]]></title>
            <link>https://medium.com/@lucasyujideveloper/organizing-dependencies-with-version-catalogs-in-gradle-426cc22598f5?source=rss-ee6891af97c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/426cc22598f5</guid>
            <category><![CDATA[groovy]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[gradle]]></category>
            <dc:creator><![CDATA[Lucas Yuji Yoshimine]]></dc:creator>
            <pubDate>Fri, 01 Apr 2022 21:02:49 GMT</pubDate>
            <atom:updated>2022-11-07T23:56:29.171Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tOuA3kpMjzoW3UrJvWSGig.jpeg" /><figcaption>Photo by <a href="https://www.pexels.com/@pixabay?utm_content=attributionCopyText&amp;utm_medium=referral&amp;utm_source=pexels">Pixabay</a> from <a href="https://www.pexels.com/photo/clear-light-bulb-on-black-surface-356043/?utm_content=attributionCopyText&amp;utm_medium=referral&amp;utm_source=pexels">Pexels</a></figcaption></figure><p>When starting a project, it is always necessary to implement dependencies before development, however it is quite common these implementations get left behind, disorganized or even forgotten if they aren’t done with due attention, that’s why many developers choose to create and maintain a dependency manager in their projects centralizing them. But what if there was something official from gradle that could help us with this? 🤔<br>Fortunately, in gradle version 7.0, there’s a new way to centralize your dependencies, with version catalogs.</p><h3>Setting Up New Project</h3><p>First, to enable this feature you need to add the following in settings.gradle.</p><pre>enableFeaturePreview(&quot;VERSION_CATALOGS&quot;)</pre><p><strong>ps</strong>: this implementation doesn’t need if the version of gradle is 7.4 or higher.</p><p>When the feature is activated, it is necessary to create a file where the management of dependencies will be done. In this feature the TOML file format is used, which is specialized for configuration and readability, with a minimal syntax. With this information, the addition of this file must be done in gradle/libs.versions.toml.<br>After adding the file, for dependency management four types of configuration are possible: versions, libraries, bundles and plugins.</p><ul><li><strong>[versions]: </strong>versioning of dependencies;</li><li><strong>[libraries]: </strong>modules and their dependencies, together with the version reference;</li><li><strong>[bundles]: </strong>library groups, allowing you to implement multiples dependencies in a single implementation;</li><li><strong>[plugins]</strong>: plugin ids, also containing versioning</li></ul><p>Sample preview of a project with dependencies:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/afe8857dece120689c826502a381a61c/href">https://medium.com/media/afe8857dece120689c826502a381a61c/href</a></iframe><p>After setting up the dependencies, now you need to implement them in your project:<br>To implement a library, just use the libs prefix and then the dependency name set in [libraries].</p><pre>dependencies {<br>    implementation libs.androidx.core<br>}</pre><p>ps: use period (.) instead of hyphen (-) in the implementation, as in the example above.</p><p>It is also possible to add bundles in the same way that libraries are implemented, but containing a bundle prefix, e.g:</p><pre>dependencies {<br>    implementation libs.bundles.coroutines<br>}</pre><p>Last but not least important, to add a plugin, use the alias method with the applied plugin from the manager as a parameter:</p><pre>plugins <strong>{</strong><br>    alias(libs.plugins.android.application)<br>}</pre><h3>Conclusion</h3><p>Dependency management, regardless of the project, is something that is always needed to stay maintainable, readable and centralized. With the new gradle feature, this becomes easier to add and increases the developer’s productivity. To learn more about the feature version catalog, I strongly recommend the gradle documentation.</p><ul><li><a href="https://docs.gradle.org/7.0/release-notes.html">Gradle Release Notes</a></li><li><a href="https://docs.gradle.org/7.0/userguide/platforms.html#sub:central-declaration-of-dependencies">Sharing dependency versions between projects</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=426cc22598f5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Organização de dependências com version catalogs no gradle]]></title>
            <link>https://medium.com/android-dev-br/organiza%C3%A7%C3%A3o-de-depend%C3%AAncias-com-version-catalogs-no-gradle-28ba050f9e52?source=rss-ee6891af97c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/28ba050f9e52</guid>
            <category><![CDATA[groovy]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[gradle]]></category>
            <dc:creator><![CDATA[Lucas Yuji Yoshimine]]></dc:creator>
            <pubDate>Sat, 26 Mar 2022 03:54:58 GMT</pubDate>
            <atom:updated>2023-03-14T09:20:27.962Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tOuA3kpMjzoW3UrJvWSGig.jpeg" /><figcaption>Photo by <a href="https://www.pexels.com/@pixabay?utm_content=attributionCopyText&amp;utm_medium=referral&amp;utm_source=pexels">Pixabay</a> from <a href="https://www.pexels.com/photo/clear-light-bulb-on-black-surface-356043/?utm_content=attributionCopyText&amp;utm_medium=referral&amp;utm_source=pexels">Pexels</a></figcaption></figure><p>Ao iniciar um projeto, sempre é necessário ser implementado as suas dependências antes de seu desenvolvimento, entretanto é bastante comum essas implementações ficarem largadas, desorganizadas ou até esquecidas se caso não forem realizadas com devida atenção, por isso muitos desenvolvedores optam em criar e manter um gerenciador de dependências em seus projetos centralizando-os. Mas e se tivesse algo oficial do gradle que nos ajudasse nisso? 🤔</p><p>Por sorte, na versão 7.0 do gradle, há um novo jeito de gerenciar as suas dependências, o <em>version catalogs.</em></p><h3><strong>Configurando novo projeto</strong></h3><p>primeiramente, para habilitar essa feature é necessário adicionar o seguinte trecho em <em>settings.gradle.</em></p><pre>enableFeaturePreview(&quot;VERSION_CATALOGS&quot;)</pre><p>obs: essa implementação não é necessária se a versão do gradle for 7.4 ou superior.</p><p>Ao ativar a funcionalidade, agora é necessário a criação do arquivo em que será feito o gerenciamento das dependências. Nessa feature é utilizado o formato de arquivo <strong><em>TOML</em></strong>, que é especializado para configuração e legibilidade, com uma sintaxe mínima. Com essa informação, a adição desse arquivo deve realizada em <strong><em>gradle/libs.versions.toml</em></strong><em>.</em></p><p>Após adicionar o arquivo, para o gerenciamento das dependências são possiveis quatros tipos de configurações, sendo elas: <strong><em>versions, libraries, bundles e plugins</em></strong><em>.</em></p><ul><li><strong>[versions]: </strong>versionamento das dependências;</li><li><strong>[libraries]: </strong>módulos de suas dependências, junto com a referência da versão;</li><li><strong>[bundles]: </strong>grupos de libraries, permitindo implementar <strong><em>N</em></strong> dependências em uma única implementação;</li><li><strong>[plugins]</strong>: ids de plugins, também contendo versionamento</li></ul><p>Visualização exemplo de um projeto com dependências:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/afe8857dece120689c826502a381a61c/href">https://medium.com/media/afe8857dece120689c826502a381a61c/href</a></iframe><p>Ao efetuar a configuração das dependências, agora é preciso implementar em seu projeto, o seu uso é bastante simples:</p><p>Para implementar uma <strong><em>library</em></strong>, utilize apenas o prefixo <strong><em>libs </em></strong>e depois o nome da dependência setado em <em>[libraries].</em></p><pre>dependencies {<br>    implementation libs.androidx.core<br>}</pre><p><strong><em>obs</em></strong><em>: utilize o ponto (.) ao invés de hífen (-) na implementação, como exemplo acima.</em></p><p>Também é possivel adicionar <strong><em>bundles </em></strong>da mesma forma que é implementado <strong><em>libraries</em></strong><em>, </em>porém contendo um prefixo de <strong><em>bundles</em></strong>, ex:</p><pre>dependencies {<br>    implementation libs.bundles.coroutines<br>}</pre><p>Por último, mas não menos importante, para adicionar um <strong><em>plugin, </em></strong>use o método <strong><em>alias </em></strong>com o <strong><em>plugin </em></strong>aplicado do gerenciador como parâmetro:</p><pre>plugins <strong>{</strong><br>    alias(libs.plugins.android.application)<br>}</pre><h3>Conclusão</h3><p>O gerenciamento de dependências, independente do projeto, É algo sempre necessário para manter uma fácil manutenção, legibilidade e centralizado. Com a nova feature do <em>gradle</em>, isso se torna cada vez mais fácil para adicionar e consequentemente aumenta a produtividade dos desenvolvedores. Para saber mais sobre a feature <em>version catalog </em>indico fortemente a documentação do <em>gradle.</em></p><ul><li><a href="https://docs.gradle.org/7.0/release-notes.html">Gradle Release Notes</a></li><li><a href="https://docs.gradle.org/7.0/userguide/platforms.html#sub:central-declaration-of-dependencies">Sharing dependency versions between projects</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=28ba050f9e52" width="1" height="1" alt=""><hr><p><a href="https://medium.com/android-dev-br/organiza%C3%A7%C3%A3o-de-depend%C3%AAncias-com-version-catalogs-no-gradle-28ba050f9e52">Organização de dependências com version catalogs no gradle</a> was originally published in <a href="https://medium.com/android-dev-br">Android Dev BR</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a custom theme in Jetpack Compose]]></title>
            <link>https://medium.com/@lucasyujideveloper/creating-a-custom-theme-in-jetpack-compose-54cbcbde1ace?source=rss-ee6891af97c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/54cbcbde1ace</guid>
            <category><![CDATA[compose]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[jetpack]]></category>
            <category><![CDATA[jetpack-compose]]></category>
            <dc:creator><![CDATA[Lucas Yuji Yoshimine]]></dc:creator>
            <pubDate>Thu, 28 Oct 2021 23:05:53 GMT</pubDate>
            <atom:updated>2022-11-08T00:21:30.917Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VCOIUsH5rdUHZOyWd2V7uw.jpeg" /></figure><p>Recently, I’ve been studying Jetpack Compose, which is a new way to develop UI on Android, making declarative. By default, Jetpack Compose uses Material Design to create themes, it’s great and contains a design system consistent, and it’s very simple to use on Jetpack Compose.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4c851c6b82213b30c36b45f457459cd4/href">https://medium.com/media/4c851c6b82213b30c36b45f457459cd4/href</a></iframe><p>here we have a <strong><em>composable </em></strong>method from MaterialTheme, it contains 4 parameters, <strong><em>colors</em></strong>, <strong><em>typography</em></strong>, <strong><em>shapes,</em></strong> and <strong><em>content</em></strong>. each one is to implement its own colors, typography, and shapes which desire as long as it follows the <a href="https://material.io/develop/android/theming/theming-overview"><strong>Materia</strong>l</a> pattern. However, sometimes the pattern that offers is not enough, and with that comes the question… how create your own theme that maintains like Material Design?</p><h3>Creating a custom theme!</h3><p>For that, we need to understand a little bit of how the Material works “under the hood”:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0606361abde4cf3492d27cfc35b70dc3/href">https://medium.com/media/0606361abde4cf3492d27cfc35b70dc3/href</a></iframe><p>This object contains all the properties that we pass in the MaterialTheme method, they support us when we need to use something from the theme within the context we are in, knowing that, we will create our own custom object.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0d8be8db3a3ef005a5cc144087710357/href">https://medium.com/media/0d8be8db3a3ef005a5cc144087710357/href</a></iframe><p>In this example, we added a property called <strong>spaces </strong>to illustrate, which contains the type <strong>CustomSpaces </strong>that will have the role of performing the spaces (margins) within the theme. We also set <strong><em>colors </em></strong>as <strong><em>CustomColors</em></strong>, which will be a class created later. Also, the assignments (<em>Locals</em>) will be implemented later.</p><p>In this example, we use <strong><em>customSpaces</em></strong> with the following properties:</p><ul><li>small</li><li>medium</li><li>large</li><li>extra large</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/df76803a11a54c1ffcc3c7f268757418/href">https://medium.com/media/df76803a11a54c1ffcc3c7f268757418/href</a></iframe><p>For typography, we will use <strong><em>customTypography </em></strong>with the following properties:</p><ul><li>H1 (Headline 1)</li><li>Body1</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/823a2acb14b9c8cc9cfc899e98e7b8e4/href">https://medium.com/media/823a2acb14b9c8cc9cfc899e98e7b8e4/href</a></iframe><p>Finally, we will use <strong><em>customColors </em></strong>with the properties:</p><ul><li>Primary</li><li>Text</li><li>Background</li><li>Success</li><li>Error</li><li>isLight</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c59b27981301ad03891771aad99c008c/href">https://medium.com/media/c59b27981301ad03891771aad99c008c/href</a></iframe><blockquote><strong><em>why use MutableStateOf?</em></strong></blockquote><blockquote>The MutableStateOf creates a value stored in the cache, preventing the composable from recomposing every time the method is called by the composable, and it’s only emitted to the UI when its value is updated, so we need its uses to store color states and to maintain dynamics.</blockquote><p>Because of <strong>MutableState </strong>we can’t create a Data Class, but we’ll create the <strong><em>copy </em></strong>and <strong><em>updateColorsFrom </em></strong>methods ’cause we will need it after</p><p>After creating our object, it’s time to store the values ​​in the object we’ve created, and for that, we’ll need to use <strong><em>CompositionLocal</em></strong>, roughly speaking, it serves to provide data when it’s within its context, and need to be injected only once to use. We’ll use the <strong><em>staticCompositionLocalOf </em></strong>method because it’s static, also we won’t need (or almost never) to change the values ​​after they are used by the provider, besides that the performance improves considerably.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0ee2686fe1a7c2a16c9f859c9e8a2d9c/href">https://medium.com/media/0ee2686fe1a7c2a16c9f859c9e8a2d9c/href</a></iframe><blockquote><strong>lightColors/darkColors </strong>are methods that return <strong>CustomColors</strong>, if you have questions how to implement, <a href="https://github.com/DevLucasYuji/custom-themes/blob/0eafefb14750ef90779c107527dd4f460033c605/app/src/main/java/br/com/yujiyoshimine/customthemes/ui/theme/Theme.kt#L12-L28"><strong>click here</strong></a> to see in the project</blockquote><p>After that, it’s only necessary to create our <strong><em>CustomTheme </em></strong>method, which is what we’ll use in our project. To provide our CompostionLocal, we will use the CompositionLocalProvider method, which accepts any providers. We also take advantage of the <strong><em>ProvideTextStyle </em></strong>method that makes the content already starts with a default text style (in the example it is body1).</p><p>at this point, we need to use the <strong><em>copy/updateColorsFrom</em></strong> methods of <strong><em>CustomColors</em></strong>, as they are placed to prevent the initial state changing their original value after instances on provider. The copy creates another instance of the class, and <strong><em>updateColorsFrom </em></strong>will do as a “double check” so that everything is the same as the original class creating no link to it by reference. The method will look like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8862eed2b3d8f2ad2681411a8cb056ef/href">https://medium.com/media/8862eed2b3d8f2ad2681411a8cb056ef/href</a></iframe><p>If you want to add support for Dark Theme (System), there’s other method in which <strong><em>darkColors </em></strong>is an optional parameter:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/660960f2dceca7c5c86107667310d10a/href">https://medium.com/media/660960f2dceca7c5c86107667310d10a/href</a></iframe><p>now your <strong><em>content</em></strong> will be able to fully enjoy your theme, and if you want to use any property, remember to use the <strong><em>CustomTheme </em></strong>object to get the value.</p><h3>Result</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S_-daNfpKGrL80MVMQmm5w.jpeg" /><figcaption>Preview custom themes</figcaption></figure><h3>Conclusion</h3><p>Themes are important and widely used in the developer’s day to day and Jetpack Compose got it right by making something customizable and easy to use. And remember, we used <strong><em>CompositionLocalProvider </em></strong>to create the theme, but it is capable of doing many other things, for example the <strong>Google accompanist</strong> <strong><em>insets </em></strong>that also uses.</p><h3>Project repository</h3><p>If you have any questions about anything or how the UI was implemented, I’ll post the repository link with the implementation of this article below.</p><p><a href="https://github.com/DevLucasYuji/custom-themes">https://github.com/ujizin/custom-themes</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54cbcbde1ace" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Criando um tema customizável com Jetpack Compose!]]></title>
            <link>https://medium.com/android-dev-br/criando-um-tema-customiz%C3%A1vel-com-jetpack-compose-3bb7b7a845ed?source=rss-ee6891af97c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/3bb7b7a845ed</guid>
            <category><![CDATA[jetpack-compose]]></category>
            <category><![CDATA[compose]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[jetpack]]></category>
            <dc:creator><![CDATA[Lucas Yuji Yoshimine]]></dc:creator>
            <pubDate>Thu, 28 Oct 2021 23:03:43 GMT</pubDate>
            <atom:updated>2022-11-08T00:25:46.415Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VCOIUsH5rdUHZOyWd2V7uw.jpeg" /></figure><p>Por padrão, o Jetpack Compose usa o Material Design para realizar temas, ele é ótimo e contém um <em>design system</em> bem implementado e consistente, e seu uso é bastante simples com o Compose.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4c851c6b82213b30c36b45f457459cd4/href">https://medium.com/media/4c851c6b82213b30c36b45f457459cd4/href</a></iframe><p>Este é o método <strong><em>composable</em></strong> do <em>MaterialTheme</em>, que contém 4 parâmetros, sendo: <strong><em>colors</em></strong>, <strong><em>typography</em></strong>, <strong><em>shapes</em></strong> e <strong><em>content</em></strong>. Cada um deles é possível de implementar as cores, tipografias e formas que desejam desde que sigam o padrão do <a href="https://material.io/develop/android/theming/theming-overview"><strong>Materia</strong>l</a>. Entretanto, as vezes o padrão que ele oferece não é o suficiente para o uso, e com isso vem a dúvida… Como criar um próprio tema que se mantenha no contexto como <em>Material Design</em>?</p><h3><strong>Criando o próprio tema!</strong></h3><p>Para isso, é preciso entender um pouco de como o <em>Material </em>funciona por &quot;debaixo dos panos&quot;:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0606361abde4cf3492d27cfc35b70dc3/href">https://medium.com/media/0606361abde4cf3492d27cfc35b70dc3/href</a></iframe><p>Este objeto contém todas as propriedades passadas no método <strong><em>MaterialTheme</em></strong>, eles que dão o suporte de quando se necessita utilizar algo do tema dentro do contexto que o abrange. Sabendo disso, criaremos o nosso próprio objeto customizado.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0d8be8db3a3ef005a5cc144087710357/href">https://medium.com/media/0d8be8db3a3ef005a5cc144087710357/href</a></iframe><p>Neste exemplo, foi adicionada uma propriedade chamada <strong><em>spaces </em></strong>para exemplificar, que contém o tipo <strong><em>CustomSpaces</em></strong><em> </em>e terá o papel de realizar os espaçamentos (margens) dentro do tema. Também foi atribuído para <strong><em>colors</em></strong> como <strong><em>CustomColors</em></strong>, que será uma classe criada posteriormente. Além disso, as atribuições (<em>Locals</em>)<strong> </strong>serão implementadas depois.</p><p>Neste exemplo, o <strong><em>customSpaces </em></strong>é usado com as seguintes propriedades:</p><ul><li>Small</li><li>Medium</li><li>Large</li><li>Extra large</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/df76803a11a54c1ffcc3c7f268757418/href">https://medium.com/media/df76803a11a54c1ffcc3c7f268757418/href</a></iframe><p>Para a tipografia, o <strong><em>customTypography </em></strong>é utilizado com as seguintes propriedades<em>:</em></p><ul><li>H1 (Headline 1)</li><li>Body1</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/823a2acb14b9c8cc9cfc899e98e7b8e4/href">https://medium.com/media/823a2acb14b9c8cc9cfc899e98e7b8e4/href</a></iframe><p>Por fim, a <strong><em>customColors </em></strong>utilizam-se das respectivas propriedades:</p><ul><li>Primary</li><li>Text</li><li>Background</li><li>Success</li><li>Error</li><li>isLight</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c59b27981301ad03891771aad99c008c/href">https://medium.com/media/c59b27981301ad03891771aad99c008c/href</a></iframe><blockquote><strong><em>Por que usar MutableStateOf nesse caso?</em></strong></blockquote><blockquote>O MutableStateOf cria um valor armazenado no cache, evitando que o composable fique recompondo toda vez que o método é chamado pelo <strong>composable</strong>, e apenas é emitida para UI quando o seu valor é atualizado, por isso necessitamos do seu uso para guardar os estados das cores e mantê-las dinâmicas.</blockquote><p>Pelo fato de utilizar um <em>MutableState</em>, não se pode criar uma <em>Data Class</em>, porém serão criados os métodos <strong><em>copy</em></strong> e <strong><em>updateColorsFrom</em> </strong>para a necessidade futura.</p><p>Após a criação do objeto, chegou a vez de armazenar os valores no objeto que foi criado, e para isso, é necessário utilizar o <a href="https://developer.android.com/reference/kotlin/androidx/compose/runtime/CompositionLocal"><strong><em>CompositionLocal</em></strong></a><em>, </em>de grosso modo, serve para prover os dados quando estiver dentro de um contexto, precisando ser injetado apenas uma vez para o seu uso. Por ser estático, será usufruído o método<em> </em><strong><em>staticCompositionLocalOf</em></strong>, sabendo também que não é preciso (ou quase nunca) mudar os valores depois que usados pelo <strong><em>provider</em></strong>, além de que a performance melhora consideravelmente.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0ee2686fe1a7c2a16c9f859c9e8a2d9c/href">https://medium.com/media/0ee2686fe1a7c2a16c9f859c9e8a2d9c/href</a></iframe><blockquote><strong><em>lightColors/darkColors</em></strong> são métodos no quais retornam <strong><em>CustomColors </em></strong><em>personalizados</em>, caso fique com dúvidas de como implementar, <a href="https://github.com/DevLucasYuji/custom-themes/blob/0eafefb14750ef90779c107527dd4f460033c605/app/src/main/java/br/com/yujiyoshimine/customthemes/ui/theme/Theme.kt#L12-L28"><strong>clique aqui</strong></a> para ver no projeto.</blockquote><p>Após isso, é necessário apenas criar o método <strong><em>CustomTheme</em></strong>, que será implementado no projeto. Para prover o <strong><em>CompostionLocal</em></strong>, é usado o método <strong><em>CompositionLocalProvider</em></strong>, que aceita <em>N providers</em>. Também é colocado o método <strong><em>ProvideTextStyle </em></strong>para que o tema já inicie com um estilo de texto padrão (no exemplo é o body1).</p><p>Neste momento, é preciso dos métodos <strong><em>copy/updateColorsFrom </em></strong>de <strong><em>CustomColors</em></strong>, pois eles são necessários para evitar que o estado inicial das cores não alterem seu valor original depois que fornecida, ou seja, o <strong><em>copy</em></strong> cria uma outra instância da classe para que não haja vínculo por referência, e o <strong><em>updateColorsFrom</em></strong> serve como um “<em>double-check</em>” para evitar recomposições dentro do sistema, fazendo com que todos os <strong><em>mutableStateOf</em></strong><em> </em>tenham um valor armazenado. O método ficará dessa maneira:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8862eed2b3d8f2ad2681411a8cb056ef/href">https://medium.com/media/8862eed2b3d8f2ad2681411a8cb056ef/href</a></iframe><p>Caso queira adicionar suporte para <em>Dark Theme </em>(<em>System</em>), há esse outro método no qual <em>darkColors </em>é um parâmetro opcional:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/660960f2dceca7c5c86107667310d10a/href">https://medium.com/media/660960f2dceca7c5c86107667310d10a/href</a></iframe><p>agora o <strong><em>content </em></strong>conseguir irá usufruir totalmente do tema aplicado e caso queira usar alguma propriedade, lembre-se de utilizar o objeto <strong>CustomTheme </strong>para resgatar o valor.</p><h3><strong>Resultado</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S_-daNfpKGrL80MVMQmm5w.jpeg" /><figcaption>Preview custom themes</figcaption></figure><h3><strong>Conclusão</strong></h3><p>Temas são importantes e muito utilizados no dia a dia do desenvolvedor e o Jetpack Compose acertou em cheio ao deixar algo customizável e fácil de ser implementado. E lembre-se, a criação do tema deu-se pelo <strong><em>Composition Local Provider</em></strong>, porém ele é capaz de realizar muitas outras coisas, por exemplo o <a href="https://google.github.io/accompanist/insets/"><strong><em>insets</em></strong></a><strong><em> </em></strong>do <a href="https://github.com/google/accompanist"><strong><em>Google accompanist</em></strong></a><strong><em> </em></strong>que também o utiliza.</p><h3><strong>Repositório do projeto</strong></h3><p>Caso tenha ficado com alguma dúvida, tanto no nível de aplicação quanto de como a <em>UI </em>foi realizada, segue logo abaixo o link para o repositório com a implementação deste artigo.</p><p><a href="https://github.com/DevLucasYuji/custom-themes">https://github.com/ujizin/custom-themes</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3bb7b7a845ed" width="1" height="1" alt=""><hr><p><a href="https://medium.com/android-dev-br/criando-um-tema-customiz%C3%A1vel-com-jetpack-compose-3bb7b7a845ed">Criando um tema customizável com Jetpack Compose!</a> was originally published in <a href="https://medium.com/android-dev-br">Android Dev BR</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Internacionalização com Flutter]]></title>
            <link>https://medium.com/@lucasyujideveloper/internacionaliza%C3%A7%C3%A3o-com-flutter-4b3fb821ee09?source=rss-ee6891af97c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b3fb821ee09</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[internationalization]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[mobile]]></category>
            <dc:creator><![CDATA[Lucas Yuji Yoshimine]]></dc:creator>
            <pubDate>Wed, 22 Apr 2020 18:51:46 GMT</pubDate>
            <atom:updated>2020-04-23T01:45:20.628Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f3_yiDqNht6u4aeO4qGP4g.png" /></figure><p>Seu projeto está crescendo com o <strong>Flutter</strong> e você ainda não sabe como fazer a<strong> internacionalização</strong>? Bom, com esse mini-tutorial você vai aprender a como turbinar o seu projeto e mostra-lo ao MUNDO!</p><h3>Antes de começar…</h3><p>Para a internacionalização, nós iremos usar uma biblioteca chamada Intl e também uma extensão desenvolvida pela <a href="https://localizely.com/">localizely</a>. Vale lembrar que este tutorial também está mais voltado a quem desenvolve usando o editor VSCode, porém é possível seguir alguns passos usando o Android Studio.</p><h3>Vamos para a parte pratica!</h3><p>Ao iniciar, entre na aba de extensões e procure por “Flutter Intl” e depois instale, como está na imagem abaixo:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uI7eCpgyEFDPYoangK5Ydw.png" /></figure><p>Depois de instalar, crie um projeto em flutter novo ou vá até o diretório do seu projeto atual, e depois faça o comando <strong>CTRL + SHIFT + P, </strong>e aparecerá uma aba de pesquisar na parte superior do seu editor, depois disso escreva por <strong><em>&gt;Flutter Intl: Initialize </em></strong>e pressione <strong>ENTER</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/1*0kJWsaFKwkyocP2ICX4jaQ.png" /></figure><p>Se essas pastas apareceram em seu projeto, quer dizer que o processo deu certo! A extensão oferece, como padrão, um arquivo para o idioma inglês (EN), e para que você adicione novos idiomas, aperte <strong>CTRL + SHIFT + P </strong>novamente e procure por <strong><em>Flutter Intl: Add locale </em></strong><em>, por fim implemente a sigla da nova língua que queira introduzir, no meu caso, eu adicionei o português (PT)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/399/1*9En3zbLnGjSZJCg9BTCSfQ.png" /></figure><p>Opa! conseguimos adicionar nossas linguagens, mas antes de continuar com os procedimentos, precisamos adicionar uma <strong>dev_dependencie </strong>no <strong>pubspec.yaml</strong>, então vá até o arquivo e coloque a dependência como segue na foto abaixo:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/228/1*DB4kNH0RwoGCIwP2giLpcw.png" /></figure><p>Ao colocar, veremos que alguns erros nos arquivos gerados deixaram de existir. O próximo passo é configurar o nosso <strong>MaterialApp </strong>no arquivo <strong>main.dart.</strong></p><p>Ao entrar no arquivo, precisamos colocar a propriedade <strong><em>localizationDelegates </em></strong>com o<em> Delegate </em>da nossa classe gerada (S) e implementar <strong><em>supportedLocales</em></strong>, se preferir, você pode mudar o nome dessa classe depois. Segue a imagem com a configuração:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*zXZmy-Tkc4MktZib0mMRjg.png" /></figure><h3>Configurando o arquivo dos idiomas</h3><p>Antes de configurar, precisamos falar que o formato <strong>.arb</strong> foi desenvolvido pela Google, é muito usado para traduções, e também, muito robusto por conseguir aceitar parâmetros, e muitos tipos de configurações que outros formato não possuem.</p><p>No nosso exemplo, usei uma frase que não tem nenhum parâmetro e duas outras que tem um argumento, como vemos a seguir:</p><p><strong>“@@locale”: </strong>o valor dessa chave será o local em que esse arquivo designa</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2Qlsk-e2uCfLXgidGo7qaw.png" /></figure><p>Bom, implementamos nossas chaves (nomes em que serão chamadas) com seus devidos valores traduzidos para seu idioma.</p><p>E nesse projeto, eu preparei uma tela básica com algumas frases, junto com dois botões que podem trocar nossos idiomas (Português e inglês).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rK7324KrOzat23xPoT47LA.png" /></figure><h3>Usando as traduções criadas</h3><p>Para usarmos as frases que <strong>não possuem</strong> <strong>parâmetros</strong> precisamos apenas chamar sua classe com o método <strong>.of(context) </strong>e depois chamar por sua chave que foi criada no arquivo <strong>.arb, </strong>exemplo: “S.of(context).title<em>”.</em></p><p>E para usarmos as frases que <strong>contém argumentos</strong>, precisamos usar o nome da nossa chave como um método também, exemplo: “S.of(context).hello(“Lucas”)”.</p><p>E por último mas não menos importante, para recarregar em uma outra língua, usamos o método .<strong>load(Locale) </strong>com a localização como argumento, exemplo: “S.load(Locale(‘pt’))”. E lembre-se de sempre atualizar o estado da tela ao trocar de idioma.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/391/1*W8e_vlTYkIH0xizE13qQgg.png" /></figure><p>Além disso, é possível chamar suas sentenças de outra maneira que não utilize o contexto e sim, instanciando sua classe ao invés de usar um método estático, possibilitando outras maneiras de controlar as traduções, como mostra na imagem abaixo:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/248/1*hT64rUN2bMOQZTmRj8bKfg.png" /></figure><p>Então é isso galera, espero que esse guide possa ter te ajudado em seu projeto, e se quiser ver o repositório estou disponibilizando <a href="https://github.com/DevLucasYuji/flutter_internacionalizacao">aqui</a>.</p><p><strong>Repositório</strong>: <a href="https://github.com/DevLucasYuji/flutter_internacionalizacao">https://github.com/DevLucasYuji/flutter_internacionalizacao</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b3fb821ee09" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>