<?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 Yusuf Önder on Medium]]></title>
        <description><![CDATA[Stories by Yusuf Önder on Medium]]></description>
        <link>https://medium.com/@yusufonderd?source=rss-8767fd35625b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*UMY1Jw_l-YHgQoonlDEbyQ.jpeg</url>
            <title>Stories by Yusuf Önder on Medium</title>
            <link>https://medium.com/@yusufonderd?source=rss-8767fd35625b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 08:36:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yusufonderd/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[Migrating a Custom EditText to Jetpack Compose (Without Breaking Focus Navigation)]]></title>
            <link>https://blog.simprasuite.com/migrating-a-custom-edittext-to-jetpack-compose-without-breaking-focus-navigation-507e18db8c58?source=rss-8767fd35625b------2</link>
            <guid isPermaLink="false">https://medium.com/p/507e18db8c58</guid>
            <category><![CDATA[jetpack-compose]]></category>
            <category><![CDATA[android-development]]></category>
            <category><![CDATA[androiddev]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Yusuf Önder]]></dc:creator>
            <pubDate>Thu, 19 Jun 2025 13:05:07 GMT</pubDate>
            <atom:updated>2025-06-23T08:26:31.881Z</atom:updated>
            <content:encoded><![CDATA[<p>Migrating to Jetpack Compose is exciting — until you run into a legacy component you can’t easily replace. In my case, I had a custom EditText (CardEditTextView) with features like input masks, suffixes, password toggles, and state-based visuals. Rewriting all that behavior using Compose’s TextField wasn&#39;t practical—or even possible—without major compromises<em>.</em></p><p>The biggest challenge? <strong>Focus navigation</strong> across six input fields — something that worked perfectly in XML with nextFocusDownId. But since Compose’s FocusRequester doesn’t apply to AndroidView, I had to get creative.</p><p>This post walks you through the hybrid solution I built: combining Compose with legacy views and managing focus in a clean, state-driven way — all without losing the power of Jetpack Compose.</p><h3>Problem Overview</h3><ul><li>My app used a <strong>custom </strong><strong>EditText</strong> with advanced behavior (masking, suffix, helper text, icons, etc.)</li><li>I migrated the UI to <strong>Jetpack Compose</strong>, keeping the existing custom component.</li><li>I needed smooth <strong>“Next” button navigation</strong> across all six input fields, just like the good old XML days.</li></ul><h3>The Idea: Use State to Drive Focus</h3><p>Instead of using FocusRequester, I managed focus using a simple <strong>enum-based state</strong> in the ViewModel. Each input field compares itself to this enum value to decide whether it should request focus.</p><pre>enum class FocusTarget {<br>    PROPERTY_NAME,<br>    FIRST_NAME,<br>    LAST_NAME,<br>    EMAIL,<br>    PHONE,<br>    PASSWORD<br>}</pre><h3>Focus Flow: How It Works</h3><ol><li>Each input field receives:</li></ol><ul><li>shouldFocus: Boolean</li><li>onImeAction: () -&gt; Unit (triggered when user presses “Next”)</li></ul><p>2. When a field is submitted:</p><ul><li>It calls onImeAction() and updates focusTarget in the ViewModel</li></ul><p>3. Compose recomposes, and the next field gets shouldFocus = true</p><p>4. That field calls requestFocus() and shows the keyboard</p><h3>When You Press “Next”:</h3><pre>[ViewModel] sets focusTarget = FocusTarget.FIRST_NAME<br>     ↓<br>[Compose] re-renders<br>     ↓<br>[AndroidView] sees shouldFocus = true<br>     → Calls requestFocus() + shows keyboard</pre><h3>Sample Form ItemConfiguration</h3><p>Each input field in my form is represented by a SignUpFormItem data class. It contains everything needed to render the field and control its behavior.Here’s what the model looks like:</p><pre>data class SignUpFormItem(<br>    @StringRes val hintRes: Int,<br>    val text: String? = null,<br>    val inputType: Int = InputType.TYPE_CLASS_TEXT,<br>    val shouldFocus: Boolean = false,<br>    val imeOptions: Int = EditorInfo.IME_ACTION_NEXT,<br>    val onTextChanged: (String) -&gt; Unit,<br>    val onImeAction: (() -&gt; Unit)? = null<br>)</pre><p>And here’s how one field is configured using this logic:</p><pre>SignUpFormItem(<br>    hintRes = R.string.name,<br>    text = uiState.firstName,<br>    onTextChanged = onFirstNameChanged,<br>    imeOptions = EditorInfo.IME_ACTION_NEXT,<br>    onImeAction = { setFocusTarget(FocusTarget.LAST_NAME) },<br>    shouldFocus = uiState.focusTarget == FocusTarget.FIRST_NAME<br>)</pre><p>All form fields are collected into a list and rendered in a Column or Row layout based on screen size. For example:</p><pre>val formItems = listOf(<br>    SignUpFormItem(..., shouldFocus = uiState.focusTarget == FocusTarget.PROPERTY_NAME),<br>    SignUpFormItem(..., shouldFocus = uiState.focusTarget == FocusTarget.FIRST_NAME),<br>    ...<br>)</pre><p>This setup keeps the UI dynamic and driven by state — with focus logic embedded directly into the model.</p><h3>Rendering the Form in a LazyColumn</h3><pre>@Composable<br>fun SignUpForm(items: List&lt;SignUpFormItem&gt;) {<br>    LazyColumn {<br>        items(items) { item -&gt;<br>           FormItemEditTextView(<br>                text = item.text,<br>                hintRes = item.hintRes,<br>                shouldFocus = item.shouldFocus<br>              )<br>        }<br>    }<br>}</pre><blockquote>Each row is rendered using FormItemCardEditText, which wraps the legacy XML view and handles focus based on the shouldFocus flag.</blockquote><h3>Focusing the AndroidView</h3><p>Inside your custom FormItemCardEditText, you check shouldFocus and apply the request:</p><pre>@Composable<br>fun FormItemCardEditText(item: SignUpFormItem) {<br>    AndroidView(<br>        factory = { context -&gt;<br>            val cardEditText = CardEditTextView(context) // initialize your custom XML-based EditText view<br>            cardEditText.setText(item.text)<br>            cardEditText.setHint(context.getString(item.hintRes))<br>            cardEditText.setImeOptionValue(item.imeOptions)<br>            cardEditText.onTextChanged = item.onTextChanged<br>            cardEditText.onImeAction = item.onImeAction<br>            return cardEditText<br>        },<br>        update = { editTextView -&gt;<br>            if (item.shouldFocus) {<br>                editTextView.requestFocus()<br>            }<br>        }<br>    )<br>}</pre><p>This lets Compose determine <strong>which Android view should gain focus</strong>, based on current app state — exactly as we would with nextFocusDownId before.</p><h3>Screenshot: Real Form in Action</h3><blockquote><em>Here’s how the form looks on a real device. It renders multiple input fields using the custom </em><em>CardEditTextView, fully controlled by Compose state. Pressing &quot;Next&quot; jumps smoothly to the next field—just like native XML forms, now powered by Compose.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*edUwHlSgkIjsUgmtzPA8oA.png" /></figure><h3>Why This Works</h3><ul><li>You keep your <strong>existing custom views</strong> — no need to rewrite everything.</li><li>Focus behavior is driven <strong>declaratively</strong> through state.</li><li>Works well with <strong>recomposition</strong> and Compose’s lifecycle.</li><li>Easy to integrate with other AndroidViews, forms, and classic behaviors.</li></ul><h3>Final Thoughts</h3><p>Migrating to Compose doesn’t have to be all-or-nothing. Rewriting fully custom input components isn’t always worth it — especially when you already have robust, tested behavior.</p><p>In my case, wrapping CardEditTextView with AndroidView and driving focus behavior with a simple enum helped me:</p><ul><li>Maintain existing business logic</li><li>Provide a smooth user experience</li><li>Keep my codebase consistent and scalable</li></ul><p>This approach can be applied to <strong>any custom Android view</strong> — not just EditTexts — where fine-grained behavior and legacy functionality are already in place.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=507e18db8c58" width="1" height="1" alt=""><hr><p><a href="https://blog.simprasuite.com/migrating-a-custom-edittext-to-jetpack-compose-without-breaking-focus-navigation-507e18db8c58">Migrating a Custom EditText to Jetpack Compose (Without Breaking Focus Navigation)</a> was originally published in <a href="https://blog.simprasuite.com/">Simpra Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Android Github Actions ile Firebase Distributions Altyapısı Nasıl Kurulur ?]]></title>
            <link>https://medium.com/appcent/android-github-actions-ile-firebase-distributions-altyap%C4%B1s%C4%B1-nas%C4%B1l-kurulur-c5ac37507535?source=rss-8767fd35625b------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5ac37507535</guid>
            <category><![CDATA[distribution]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[yml]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[firebase]]></category>
            <dc:creator><![CDATA[Yusuf Önder]]></dc:creator>
            <pubDate>Thu, 10 Feb 2022 18:41:43 GMT</pubDate>
            <atom:updated>2022-02-11T07:29:38.186Z</atom:updated>
            <content:encoded><![CDATA[<h3>Android Github Actions ile Firebase Distribution Altyapısı Nasıl Kurulur ?</h3><p>Selamlar,</p><p>Github actions kullanarak release süreçlerini nasıl otomatize ettiğimizi aşama aşama anlatacağım.</p><h4>Ne işe yarıyor :</h4><ul><li>Developer master’a veya development’a push atar. Veya PR açar(Sizin yml dosyasında yaptığınız konfigrasyona göre davranır)</li><li>Github actions sizin için build komutunu çalıştırarak apk çıkartır.</li><li>Firebase distribution mekanizması maillerini firebase’e eklediğiniz kullanıcılara(Ekseriyetle QA’lere) apk’yı mail olarak paylaşır.</li><li>Süreçleri otomatize ediyor ve vakit kaybının önüne geçiyor .</li></ul><h3>- Kurulum</h3><p><strong>1) Github Actions</strong></p><p>Öncelikle github actions için .yml uzantılı dosyaya ihtiyacınız var. Reponuza girin -&gt; Üst sekmede actions’a dokunun -&gt; Android CI -&gt; Configure diyin -&gt; Sağ üstten Start Commit tuşuna dokunun.</p><p><strong>2) Firebase CLI Kurulumu</strong></p><p>Terminali açın ve aşağıdaki komutu yapıştırın. (Mac kullanıcıları için)</p><pre>curl -sL https://firebase.tools | bash</pre><p>Windows işletim sistemi için aşağıdaki linkte detaylı kurulum anlatılıyor: <a href="https://firebase.google.com/docs/cli#install-cli-windows">https://firebase.google.com/docs/cli#install-cli-windows</a></p><p><strong>3) Firebase Login</strong></p><p>CLI kurulumu bittikten sonra yine terminalden aşağıdaki komutu çalıştırın.</p><pre>firebase login:ci</pre><p>Karşınıza firebase account’unuzun bulunduğu mail ile giriş yapmanız için bir tarayıcı sekmesi gelecek. Firebase projenizin yetkili olduğu mail adresinizle giriş yapın ve tüm izinleri verin. Her şey başarılı olduktan sonra karşınıza aşağıdaki ekran gelecek. Bu ekranı gördüyseniz harika ilerliyorsunuz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*pmQLMbApW3pWxiMr7FACHw.png" /></figure><p>Login olduktan sonra terminalde aşağıdaki mesajla beraber yaklaşık 100 karakterli uzun bir token değeri göreceksiniz. Bu token’ı kopyalayıp yapıştırın ve iyi davranın ona :) İhtiyacımız olacak.</p><p><strong>✔ </strong>Success! Use this token to login on a CI server: [Token değeriniz]</p><p><strong>4- Firebase Github Secret Key’lerin Ayarlanması</strong></p><p><a href="https://console.firebase.google.com/u/0/">https://console.firebase.google.com</a> adresinden projenizi seçin. Sol üstteki Project Overview -&gt; Project Settings kısmından App Id’yi de bir yere kopyalayın.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*BDZpqK9btQCU2FrZLNSeCw.png" /></figure><p>Elimizde Firebase <em>app id</em> ve <em>token</em> bilgisi var. Şimdi bu bilgileri github’a eklememiz gerekiyor.</p><p>Github reponuza gidin. Settings-&gt; Secrets -&gt; Actions’a tıklayın -&gt; Sağ üstten “New repository Secret”’a dokunun. Name kısmına FIREBASE_APP_ID yazıp daha önce kopyaladığınız app id bilgisini value kısmına yapıştırın. Aynı işlemi FIREBASE_TOKEN için de yapın. Bunları yapıştırıp kaydettikten sonra şöyle bir görsel görüyor olmalısınız.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/893/1*nf4n7DKOZ2YHA6990NxNug.png" /></figure><p>Buraya kadar ilerlediyseniz son bir adım kaldı.</p><p><strong>5- Firebase’de tester grubunun oluşturulması</strong></p><p>Firebase console’dan sol sekmedeki App distribution’a dokunun. Get started diyin -&gt; <em>testers</em> adında yeni bir grup ekleyin. Bu grup ismiyle yml dosyanızdaki grup ismi eşleştiğine dikkat edin. İşlemler tamamlandıktan sonra karşınızda şöyle bir ekran olmalı.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FXG_NrhyOePSsmt__moI0A.png" /></figure><p><strong>6- YML Dosyasına komut girmek</strong></p><p>Hali hazırda bir yml dosyası oluşturmuştuk. Bu yml dosyasının son satırlarına aşağıdaki yml script’ini girmeniz gerekiyor.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2c950bc25744234d96711e617b36ed00/href">https://medium.com/media/2c950bc25744234d96711e617b36ed00/href</a></iframe><p>Hepsi bu kadar. Artık birisi development’a push attığında testers mail grubuna eklediğiniz ekip arkadaşlarınıza apk mail olarak gidecek 🎉.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5ac37507535" width="1" height="1" alt=""><hr><p><a href="https://medium.com/appcent/android-github-actions-ile-firebase-distributions-altyap%C4%B1s%C4%B1-nas%C4%B1l-kurulur-c5ac37507535">Android Github Actions ile Firebase Distributions Altyapısı Nasıl Kurulur ?</a> was originally published in <a href="https://medium.com/appcent">Appcent</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Android’de Custom View Component Oluşturmak]]></title>
            <link>https://medium.com/appcent/androidde-custom-view-component-olu%C5%9Fturmak-42c4b388ba71?source=rss-8767fd35625b------2</link>
            <guid isPermaLink="false">https://medium.com/p/42c4b388ba71</guid>
            <category><![CDATA[custom-view-android]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[constraintlayout]]></category>
            <category><![CDATA[cardview]]></category>
            <dc:creator><![CDATA[Yusuf Önder]]></dc:creator>
            <pubDate>Fri, 08 Oct 2021 10:31:14 GMT</pubDate>
            <atom:updated>2023-10-12T21:39:25.714Z</atom:updated>
            <content:encoded><![CDATA[<p>Merhaba,<br>Geliştirme yaparken proje gereksinimleri doğrultusunda custom layout’lar oluşturmamız gerekebiliyor. Özellikle aynı layout’u birden fazla yerde kullanmak gerektiğinde.</p><p>Örnegin bir e-ticaret projesinde birden fazla yerde sepete ekle işlemi yapılıyor diyelim. Örnegin ana sayfada, ürün detay ekranında, ürün arama ekranında sepete ekleme butonu olacak. Sepete ekleme işlemi için de aşağıdaki gibi bir tasarım istenmiş olsun.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/458/1*UpTwuuE1DzI2ASZT1aXBbQ.png" /><figcaption>Add to cart design</figcaption></figure><p>Sepete ekleme butonu: ürün arttırma, azaltma, silme ikonlarını içersin. Ek olarak ürün adedini de bu butonların ortasında göstersin. Sepete ürün eklenirken ortada bir progress bar dönsün vs.</p><p>Bu component’i farkı yerlerde kullandığımızda ayrı ayrı view’leri xml’de ekleyip yerleşimlerini düzenlememiz gerekiyor. Bunu da her defasında copy paste yapıp diğer yerlere taşımak hem geliştirme açısından zorluk yaratıyor, hem de ekstra test maliyeti çıkarabiliyor. Bunun yerine arttırma azaltma ve ürün adetlerini içeren tek bir view component yazıp gerekli olan yerlerde bunu kullanmak bize hız ve pratiklik kazandırıyor.</p><p>Bu işlem için iki farklı yol izleyebiliriz. Birincisi xml dosyası oluşturup yazdığımız view sınıfında bunu inflate ederek view’lere ulaşmak. Bu yöntem görece daha pratik fakat ben bu yazıda konuya biraz daha farklı yaklaşıp xml tarafına ihtiyaç duymadan kod tarafında neler yapabiliriz bunun üzerinde durmak istiyorum.</p><p>İlk olarak Addtocart view component’ine stroke ve corner radius yeteneklerini kazandırmak için MaterialCardView’den extend almaya karar verdim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*msFP3oN-EEl7U0srAm_B8w.png" /><figcaption>Addtocart view component’ine BasketLayoutView adını verdim.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*Td7-JplXggm7s34W2KRw2w.png" /><figcaption>Cardview’ın içine constraint layout ekliyorum. Diğer view’ları bunun içine ekleyeceğim. En tepede CardView -&gt; ConstraintLayout -&gt; (Button, TextView, ProgressBar) şeklinde ilerleyecek.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*NpRvlXre7wKrZFRO-pEKXA.png" /><figcaption>BasketLayoutView’ın constructor’ında ihtiyacım olan view’leri ekledim.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*0LXSQZODk1txm5z5N084zw.png" /><figcaption>Daha sonra bu view’ların yerleşimlerini kod tarafında ayarladım.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O3N--9uraKSf4wp_QqOy4g.png" /><figcaption>Ürün arttırma butonunu connect medotu yardımıyla constraint layout içinde konumlandırıyorum.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gnhmvd3_x_JnqUukgvzXaA.png" /><figcaption>Ürün arttırma butonu</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*x0RY-4ETwYvzERUL6LNOoA.png" /><figcaption>Son olarak BasketLayoutView’ı xml’de tanımlayarak kullanıma hazır hale getiriyorum.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LOqwy2b69-64F3fkSUgtug.png" /><figcaption>BasketLayoutListener üstünden alınan aksiyonları dinliyorum.</figcaption></figure><p>Kullanıcı ürün arttırma butonuna bastığında ürün miktarını dışarıdan verdiğimiz parametreye göre arttırır ve interface ile bizi bilgilendirir. Kaynak kodlara aşağıdaki linkten ulaşabilirsiniz.</p><p><a href="https://github.com/yusufonderd/BasketLayout">https://github.com/yusufonderd/BasketLayout</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42c4b388ba71" width="1" height="1" alt=""><hr><p><a href="https://medium.com/appcent/androidde-custom-view-component-olu%C5%9Fturmak-42c4b388ba71">Android’de Custom View Component Oluşturmak</a> was originally published in <a href="https://medium.com/appcent">Appcent</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[addtolist Alışveriş listesi App Store’da yayında]]></title>
            <link>https://medium.com/@yusufonderd/addtolist-al%C4%B1%C5%9Fveri%C5%9F-listesi-app-storeda-yay%C4%B1nda-eb04ae2fb277?source=rss-8767fd35625b------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb04ae2fb277</guid>
            <category><![CDATA[alışveriş-liste]]></category>
            <category><![CDATA[shopping-list]]></category>
            <category><![CDATA[grocery-shopping]]></category>
            <category><![CDATA[market-listesi]]></category>
            <category><![CDATA[grocery-lists]]></category>
            <dc:creator><![CDATA[Yusuf Önder]]></dc:creator>
            <pubDate>Thu, 27 Aug 2020 19:05:02 GMT</pubDate>
            <atom:updated>2020-08-27T19:05:02.949Z</atom:updated>
            <content:encoded><![CDATA[<p>Alışveriş listesi uygulaması addtolist App Store’da yayında.</p><p>‘addtolist’ market alışverişini daha pratik hale getirerek hayatınızı kolaylaştırmayı hedefleyen mobil uygulama.</p><p>Farklı renklerde alışveriş listeleri oluşturabilir. Oluşturduğunuz alışveriş listesine uygulamanın içerisinde bulunan akıllı içeriklerle kolayca ürünler ekleyebilirsiniz. Ürünlere adet, fiyat ve not gibi bilgiler girerek size daha iyi bir market alışverişi deneyimi yaşatır.</p><p>Alışveriş listesi uygulaması addtolist App Store’da yayında.</p><p>Aşağıdaki linkten indirebilirsiniz.</p><p><a href="https://apps.apple.com/tr/app/id1525847581">‎Grocery List - AddToList</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J7k5XNradcAHukUclvOiGg.jpeg" /><figcaption>addtolist shopping list</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb04ae2fb277" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Android MVP Kullanımı]]></title>
            <link>https://medium.com/@yusufonderd/android-mvp-kullan%C4%B1m%C4%B1-d074010ee72?source=rss-8767fd35625b------2</link>
            <guid isPermaLink="false">https://medium.com/p/d074010ee72</guid>
            <category><![CDATA[androiddev]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[türkçe]]></category>
            <dc:creator><![CDATA[Yusuf Önder]]></dc:creator>
            <pubDate>Sun, 02 Jun 2019 23:23:04 GMT</pubDate>
            <atom:updated>2019-06-11T12:44:43.283Z</atom:updated>
            <content:encoded><![CDATA[<p>Android uygulamalarında kullandığım MVP mimarisini en basit haliyle anlatmaya çalışacağım.</p><p>Daha önce projelerinde herhangi bir mimari kullanmayanların aklına takılan ilk soruyla başlayalım: “<em>Uygulamada neden bir mimariye ihtiyaç duyuyoruz ?</em>”. Bunun birkaç sebebi var :</p><ol><li>Seperation of concerns prensibi yani uygulamadaki UI, Database ve Logic katmanlarının ayrılması.</li><li>Uygulamanın esnekliğini ve kod okunabilirliğini arttırıyor. Değişiklikleri kolay yönetebiliyorsunuz.</li><li>Unit test’e olanak sağlıyor.</li><li>Temiz kod ve düzgün paket yapısı(İşin keyifli kısmı)</li><li>Birden fazla kişinin çalıştığı bir projede ortak bir dilin olması ( Her developer’ın kendi kafasına göre kodlaması tercih edilen bir durum değil)</li><li>Code review için avantajlı</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4LJmr5ic3u6o9QlD5m1zfA.png" /><figcaption><a href="https://android.jlelse.eu/architectural-guidelines-to-follow-for-mvp-pattern-in-android-2374848a0157">https://android.jlelse.eu/architectural-guidelines-to-follow-for-mvp-pattern-in-android-2374848a0157</a></figcaption></figure><p><strong>MVP (Model View Presenter) ne anlama geliyor ?</strong></p><p><strong>Model</strong>: Olusturduğumuz veri sınıflarını temsil ediyor. <br><strong>View</strong>: Activity veya Fragment’e karşılık geliyor.<br><strong>Presenter</strong>: Model ve View arasında iletişimi sağlıyor. Aynı zamanda logic kısmını da buradan yönetebiliyorsunuz. Aracı gibi de düşünebilirsiniz.</p><p>Daha anlaşılır olması için bir senaryo oluşturalım. Kullanıcı bir ürünü sepete eklesin ve bu işlemin sonucunu kullanıcıya bildirelim.</p><ol><li>Kullanıcı sepete ekle butonuna basar.</li><li>Presenter yapılan işlemden haberdar edilir ve database’e istek gönderir</li><li>Database’den dönen sonuç kullanıcıya gösterilir.</li></ol><p>Hadi kodlamaya geçelim 💻</p><p>View ve Presenter interface’lerimi oluşturdum.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9dbec2ce6598a0f58bcc05fceb77c4ff/href">https://medium.com/media/9dbec2ce6598a0f58bcc05fceb77c4ff/href</a></iframe><p>Ürünler için basit bir model oluşturdum.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bdb4153a9deabccea159d65740676bca/href">https://medium.com/media/bdb4153a9deabccea159d65740676bca/href</a></iframe><p>Presenter sınıfımızı oluşturalım :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8e0a51c82074703ae457d787e0992a1c/href">https://medium.com/media/8e0a51c82074703ae457d787e0992a1c/href</a></iframe><p>Son olarak CartActivity sınıfının içini dolduralım.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e3964bc66a16d3d2724deeee33a7126d/href">https://medium.com/media/e3964bc66a16d3d2724deeee33a7126d/href</a></iframe><p>Kullanıcı sepete ekle butonuna bastığında presenter sınıfının içerisindeki <em>addCart</em> metodu çalışacak. Ürün fiyatı kullanıcının bakiyesinden yüksek olduğu için <em>“Yetersiz limit”</em> uyarısı gözükecek.</p><p>Çok sade bir örnekle anlatmaya çalıştım. Daha önce hiç mimari kullanmamış biri için karmaşık gelebilir ama mantığı oturtup kullanmaya başladıktan sonra kod yazmaktan daha fazla keyif alacağınızı düşünüyorum :) Github’da MVP ile ilgili birçok örnek proje var. Sizin için birkaç tanesini seçtim.</p><p><a href="https://github.com/MindorksOpenSource/android-mvp-architecture">https://github.com/MindorksOpenSource/android-mvp-architecture</a><br><a href="https://github.com/antoniolg/androidmvp">https://github.com/antoniolg/androidmvp</a><br><a href="https://github.com/quangctkm9207/hello-mvp">https://github.com/quangctkm9207/hello-mvp</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d074010ee72" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bir kurtarıcı olarak DiffUtil sınıfı]]></title>
            <link>https://medium.com/@yusufonderd/bir-kurtar%C4%B1c%C4%B1-olarak-diffutil-s%C4%B1n%C4%B1f%C4%B1-ca29055f28fc?source=rss-8767fd35625b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca29055f28fc</guid>
            <category><![CDATA[diffutil]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Yusuf Önder]]></dc:creator>
            <pubDate>Wed, 26 Apr 2017 10:35:16 GMT</pubDate>
            <atom:updated>2017-05-19T07:54:58.895Z</atom:updated>
            <content:encoded><![CDATA[<p>Daha önce Recylerview’i güncellemek için notifyDataSetChanged metodunu kullanıyordum. Recyclerview içinde az öğe olunca problem yok ama sayı artıp 200 300&#39;e çıkınca güncelleme anında ui thread’de 4 5 saniyelik donmalar meydana gelmeye başladı.</p><p>Bu problemle cebelleşirken DiffUtil sınıfı imdadıma yetişti. DiffUtil sınıfı eski listeyle yeni güncel listeyi karşılaştırıp aradaki farkları hesaplıyor. Ve sadece değişen öğeleri güncelliyor.</p><p>AssetDiffUtil sınıfı :</p><pre>public class AssetDiffUtil extends DiffUtil.Callback {<br><br>    private final List&lt;Asset&gt; oldList;<br>    private final List&lt;Asset&gt; newList;<br><br>    public AssetDiffUtil(List&lt;Asset&gt; oldList, List&lt;Asset&gt; newList) {<br>        this.oldList = oldList;<br>        this.newList = newList;<br>    }<br><br>    @Override<br>    public int getOldListSize() {<br>        return oldList.size();<br>    }<br><br>    @Override<br>    public int getNewListSize() {<br>        return newList.size();<br>    }<br><br>    @Override<br>    public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) {<br>        return oldList.get(oldItemPosition).getId() == newList.get(newItemPosition).getId();<br>    }<br><br>    @Override<br>    public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) {<br>        final Last oldItem = oldList.get(oldItemPosition).getLast();<br>        final Last newItem = newList.get(newItemPosition).getLast();<br>        return oldItem.getDate().equals(newItem.getDate());<br>    }<br><br>    @Nullable<br>    @Override<br>    public Object getChangePayload(int oldItemPosition, int newItemPosition) {<br>        // Implement method if you&#39;re going to use ItemAnimator<br>        return super.getChangePayload(oldItemPosition, newItemPosition);<br>    }<br>}</pre><p>Geriye sadece RecyclerViewAdapter’ in içine bu metodu eklemek kalıyor :</p><pre>public void swapItems(List&lt;Asset&gt; newAssetList) {<br>        final DiffUtil.DiffResult diffResult = DiffUtil.calculateDiff(new AssetDiffUtil(this.assetList, newAssetList));<br>        this.assetList.clear();<br>        this.assetList.addAll(newAssetList);<br>        diffResult.dispatchUpdatesTo(this);<br>    }</pre><p>Referans proje : <a href="https://github.com/mrmike/DiffUtil-sample">https://github.com/mrmike/DiffUtil-sample</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/1*YGe6lbu71D8lZZJSSXVyEw.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca29055f28fc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>