<?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 Oguzhan Karakaya on Medium]]></title>
        <description><![CDATA[Stories by Oguzhan Karakaya on Medium]]></description>
        <link>https://medium.com/@7oguzhankarakaya?source=rss-f9c6ca907e40------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*5RN6t8PImGw97bnAOSTplQ@2x.jpeg</url>
            <title>Stories by Oguzhan Karakaya on Medium</title>
            <link>https://medium.com/@7oguzhankarakaya?source=rss-f9c6ca907e40------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 14:39:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@7oguzhankarakaya/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[Click Items By using Channel With AnnotationClass At Kotlin]]></title>
            <link>https://medium.com/ibtech/click-items-by-using-channel-with-annotationclass-at-kotlin-955042057072?source=rss-f9c6ca907e40------2</link>
            <guid isPermaLink="false">https://medium.com/p/955042057072</guid>
            <dc:creator><![CDATA[Oguzhan Karakaya]]></dc:creator>
            <pubDate>Fri, 24 Feb 2023 23:25:28 GMT</pubDate>
            <atom:updated>2024-07-02T10:39:59.086Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/672/1*auzb-XocwGTQIUM0i_68EA.png" /></figure><p>Hi Everyone , In this article, I’m gonna mention about the click structure that I often use at my personal project . When clicking in many places in Android like text, button ,images etc. may be want to call different functions and take different actions. Gathering these click operations will reduce the complexity of new click operations that can be add in the future and provide ease of management in clicks.</p><p>Let’s observe this with a simple instance :</p><p>→ At First, create Annotation Class . I will use two variable to click at this project . One of them for text click , the other one is for button click.</p><pre>import androidx.annotation.IntDef<br><br>@Retention(AnnotationRetention.SOURCE)<br>@IntDef(ClickAnnotationClass.TEXT_CLICK, ClickAnnotationClass.BUTTON_CLICK)<br>annotation class ClickAnnotationClass {<br><br>    companion object {<br>        const val TEXT_CLICK = 0<br>        const val BUTTON_CLICK = 1<br>    }<br>}</pre><p>→ After that , Channel created as flow . itemClicked function created for take id and update the clickedItem .</p><pre>class ViewModel: ViewModel() {<br><br>    private var _clickedItem = Channel&lt;Int&gt;()<br>    val clickedItem = _clickedItem.receiveAsFlow()<br><br>    fun itemClicked(id: Int) {<br>        viewModelScope.launch {<br>            _clickedItem.send(id)<br>        }<br>    }<br>}</pre><p>→ Create a simple xml which include clickable text and button. itemClicked function is called from onClick .</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;layout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>    xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;<br>    xmlns:tools=&quot;http://schemas.android.com/tools&quot;&gt;<br><br>    &lt;data&gt;<br><br>        &lt;import type=&quot;com.example.clickitemsbychannelwithannotationclass.ClickAnnotationClass&quot; /&gt;<br><br>        &lt;variable<br>            name=&quot;viewModel&quot;<br>            type=&quot;com.example.clickitemsbychannelwithannotationclass.viewModel.ViewModel&quot; /&gt;<br>    &lt;/data&gt;<br><br>    &lt;androidx.constraintlayout.widget.ConstraintLayout<br>        android:id=&quot;@+id/mainConstraintLayout&quot;<br>        android:layout_width=&quot;match_parent&quot;<br>        android:layout_height=&quot;match_parent&quot;<br>        tools:context=&quot;.view.MainActivity&quot;&gt;<br><br>        &lt;TextView<br>            android:id=&quot;@+id/textView&quot;<br>            android:layout_width=&quot;match_parent&quot;<br>            android:layout_height=&quot;wrap_content&quot;<br>            android:onClick=&quot;@{() -&gt; viewModel.itemClicked(ClickAnnotationClass.TEXT_CLICK)}&quot;<br>            android:text=&quot;@string/click_test&quot;<br>            android:textSize=&quot;30dp&quot;<br>            app:layout_constraintEnd_toEndOf=&quot;parent&quot;<br>            app:layout_constraintStart_toStartOf=&quot;parent&quot;<br>            app:layout_constraintTop_toTopOf=&quot;parent&quot; /&gt;<br><br>        &lt;Button<br>            android:id=&quot;@+id/firstButton&quot;<br>            android:layout_width=&quot;match_parent&quot;<br>            android:layout_height=&quot;wrap_content&quot;<br>            android:onClick=&quot;@{() -&gt; viewModel.itemClicked(ClickAnnotationClass.BUTTON_CLICK)}&quot;<br>            android:text=&quot;@string/click&quot;<br>            app:layout_constraintEnd_toEndOf=&quot;parent&quot;<br>            app:layout_constraintStart_toStartOf=&quot;parent&quot;<br>            app:layout_constraintTop_toBottomOf=&quot;@+id/textView&quot; /&gt;<br><br>    &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;<br><br>&lt;/layout&gt;</pre><p>→ clickedItem is collected at mainActivity.( clickedButton() function can call from OnCreate() ). In this way, when the button is clicked, buttonClick() function is called. textClick() function is also called when clicking on the text.</p><pre> private fun clickedButton() {<br>        lifecycleScope.launchWhenStarted {<br>            viewModel.clickedItem.collect { id -&gt;<br>                when(id) {<br>                    ClickAnnotationClass.BUTTON_CLICK -&gt; buttonClick()<br>                    ClickAnnotationClass.TEXT_CLICK -&gt; textClick()<br>                }<br><br>            }<br>        }<br>    }<br><br>    private fun buttonClick() {<br>        Toast.makeText(this, &quot;Button Clicked &quot;,Toast.LENGTH_SHORT).show()<br>    }<br><br>    private fun textClick() {<br>        Toast.makeText(this, &quot;Text Clicked &quot;,Toast.LENGTH_SHORT).show()<br>    }</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/358/1*zqwSBzBsKah1UTDM8v9fhQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/344/1*9VnpHjFzer7JjPQPkUcTJg.png" /><figcaption>Text Click and Button Click</figcaption></figure><p>Hope to see you next post .</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=955042057072" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ibtech/click-items-by-using-channel-with-annotationclass-at-kotlin-955042057072">Click Items By using Channel With AnnotationClass At Kotlin</a> was originally published in <a href="https://medium.com/ibtech">IBTech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ConcatAdapter Nedir ?]]></title>
            <link>https://medium.com/ibtech/concatadapter-nedir-e3247a53c0bc?source=rss-f9c6ca907e40------2</link>
            <guid isPermaLink="false">https://medium.com/p/e3247a53c0bc</guid>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[concat-adapter]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Oguzhan Karakaya]]></dc:creator>
            <pubDate>Fri, 29 Apr 2022 06:28:53 GMT</pubDate>
            <atom:updated>2022-04-29T10:19:58.303Z</atom:updated>
            <content:encoded><![CDATA[<h3>ConcatAdapter Nedir ?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x8DePwKLil73I-OhssgeHA.jpeg" /></figure><p>Herkese merhaba , bu yazımda sizlere son zamanlarda sıkça karşılaştığım bir recyclerview de birden fazla adapter kullanımına olanak tanıyan Concat Adapter yapısından bahsedeceğim . ☕️</p><p>Kimi zaman Recyclerview içerisinde birden fazla adapter kullanmamız gerekebilir ve bunu Concat Adapter yapısı ile sağlıyoruz. Birden çok adaptör aynı recylerview e tanımlanabildiği için birbirinden farklı yapılar da aynı recyclerviewde gösterebilir. Bu özellik Concat Adapter in bize sağladığı en önemli özelliklerden biridir.</p><p>Bir örnek üzerinden giderek sizlere Concat Adapter’ın neden gerekli olduğunu anlatayım.</p><p>Mesela örnek senaryomuzda header yapısı ve altında da elementlerin olmasını istiyoruz. Burada hepimizin aklına ilk gelen fikir muhtemelen recyclerview in üstünde boşluk bırakıp header yazmaktır. Fakat bu sefer de birden fazla header kullamamız gerekirse sayfanın tamamı kaymaz , üstteki header kaybolmaz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/435/1*kTfHin86KW-Tk6KSdnfJzg.gif" /></figure><p>Buna çözüm olarak header içinde adapter yazıp bunu tek bir recyclerview de diğer adaptörlerle kullanabiliriz.</p><p>Şimdi ise Concat Adapter yapısı kullanılarak birçok adapter i bir recyclerview içinde kullanalım.</p><ul><li>Öncelikle recyclerview de tutulacak elementin data type ını belirlediğimiz data class.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2dae56714c7b534fd7f2506a5d5f91b2/href">https://medium.com/media/2dae56714c7b534fd7f2506a5d5f91b2/href</a></iframe><ul><li>Header adaptörümüz.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/60d383b8529d2552ac78b2bece6229b9/href">https://medium.com/media/60d383b8529d2552ac78b2bece6229b9/href</a></iframe><ul><li>İsimleri yazdığımız row adaptörümüz .</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5ca20ff065a7a6886de7ca4d5a83e5ee/href">https://medium.com/media/5ca20ff065a7a6886de7ca4d5a83e5ee/href</a></iframe><ul><li>İkinci Header adaptörümüz.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8113cbabab0af7d3b28edacf0a5f68b7/href">https://medium.com/media/8113cbabab0af7d3b28edacf0a5f68b7/href</a></iframe><ul><li>İkinci isimleri yazdığımız row adaptörümüz .</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4e0754dc6d52e207cae0ff965dc5df4b/href">https://medium.com/media/4e0754dc6d52e207cae0ff965dc5df4b/href</a></iframe><ul><li>Main class.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fd5a2f0d4d9bca281afba728485aa567/href">https://medium.com/media/fd5a2f0d4d9bca281afba728485aa567/href</a></iframe><p><strong>Sonuç :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/429/1*zGl5enoPLRDjjeJ2qy_p9w.gif" /></figure><p>Bir yazımın daha sonuna geldik bir sonraki yazımda görüşmek üzere sağlıkla kalın 👋🏻</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e3247a53c0bc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ibtech/concatadapter-nedir-e3247a53c0bc">ConcatAdapter Nedir ?</a> was originally published in <a href="https://medium.com/ibtech">IBTech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>