All Projects → ciandt-mobile → android-recyclerview-binding

ciandt-mobile / android-recyclerview-binding

Licence: MIT license
RecyclerView + Data Binding + LiveData Sample

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to android-recyclerview-binding

Simple-Notes-Kotlin-App
✍️ Simple Note Making App use mvvm architecture , dagger , coroutines and navigation component. Features includes 🗒️ create , edit and ❌ delete notes
Stars: ✭ 40 (-11.11%)
Mutual labels:  recyclerview, jetpack, livedata
Pursuit-Core-Android
Pursuit Core Android
Stars: ✭ 45 (+0%)
Mutual labels:  recyclerview, jetpack, livedata
Base Mvvm
App built to showcase basic Android View components like ViewPager, RecyclerView(homogeneous and heterogeneous items), NavigationDrawer, Animated Vector Drawables, Collapsing Toolbar Layout etc. housed in a MVVM architecture
Stars: ✭ 18 (-60%)
Mutual labels:  recyclerview, livedata
Elements
⚒ Modular components for RecyclerView development enforcing clean, reusable and testable code, with built-in support for paging and complex hierarchies of data.
Stars: ✭ 75 (+66.67%)
Mutual labels:  recyclerview, livedata
LiveData-DataBinding-Kotlin
Sample to practice LiveData + DataBinding
Stars: ✭ 89 (+97.78%)
Mutual labels:  jetpack, livedata
LifecycleCells
An Android library that provides a Lifecycle to any ViewHolder through the implementation of the LifecycleOwner interface, allowing it to interact with a Lifecycle-Aware Component.
Stars: ✭ 19 (-57.78%)
Mutual labels:  recyclerview, livedata
Jetpack-compose-sample
Forget about bunch of XML files for maintaining UIs. Jetpack Compose is Android’s modern toolkit for building native UI. Here is a small example to get started.
Stars: ✭ 29 (-35.56%)
Mutual labels:  recyclerview, jetpack
swipeablerecyclerview
SwipeableRecyclerView provides a wrapper class SwipeItemTouchHelperCallback which can be used to add Dragging capability to your RecyclerView items. You can make use of DataBinding to bind it via XML.
Stars: ✭ 16 (-64.44%)
Mutual labels:  recyclerview, data-binding
JetpackDemo
Jetpack demo that used to show how to use Jetpack libraries.
Stars: ✭ 77 (+71.11%)
Mutual labels:  jetpack, livedata
KotlinEverywhere
This application created for Kotlin Everywhere series as a codelab. It will show step by step Kotlin and Android Jetpack Components fundamentals. 🚀🚀
Stars: ✭ 52 (+15.56%)
Mutual labels:  jetpack, livedata
Compose-ShoppingList
Jetpack compose shopping list app
Stars: ✭ 52 (+15.56%)
Mutual labels:  jetpack, livedata
movie-booking
An example for booking movie seat, combined of Android Data Binding, State Design Pattern and Multibinding + Autofactory. iOS version is: https://github.com/lizhiquan/MovieBooking
Stars: ✭ 80 (+77.78%)
Mutual labels:  recyclerview, data-binding
Mvvmarchitecture
An example Android app using Retrofit, Room, LiveData, RxJava2, Paging, Koin and the MVVM pattern with the databinding
Stars: ✭ 160 (+255.56%)
Mutual labels:  data-binding, livedata
Flexibleadapter
Fast and versatile Adapter for RecyclerView which regroups several features into one library to considerably improve the user experience :-)
Stars: ✭ 3,482 (+7637.78%)
Mutual labels:  recyclerview, livedata
Jetpack Mvvm Best Practice
是 难得一见 的 Jetpack MVVM 最佳实践!在 以简驭繁 的代码中,对 视图控制器 乃至 标准化开发模式 形成正确、深入的理解!
Stars: ✭ 6,950 (+15344.44%)
Mutual labels:  jetpack, livedata
Nytimes App
🗽 A Simple Demonstration of the New York Times App 📱 using Jsoup web crawler with MVVM Architecture 🔥
Stars: ✭ 246 (+446.67%)
Mutual labels:  recyclerview, livedata
DeezerClone
This Application using Dagger Hilt, Coroutines, Flow, Jetpack (Room, ViewModel, LiveData),Navigation based on MVVM architecture.
Stars: ✭ 81 (+80%)
Mutual labels:  jetpack, livedata
AndroidGo
Android、Flutter 开发者帮助 APP。包含事件分发、性能分析、Google Jetpack组件、OkHttp、RxJava、Retrofit、Volley、Canvas绘制以及优秀博文代码案例等内容,帮助开发者快速上手!
Stars: ✭ 30 (-33.33%)
Mutual labels:  jetpack, livedata
ChatApp
Chat app based on Firebase tools.
Stars: ✭ 88 (+95.56%)
Mutual labels:  jetpack, livedata
Kriptofolio
Free open source minimalistic cryptocurrencies portfolio app for Android.
Stars: ✭ 79 (+75.56%)
Mutual labels:  data-binding, livedata

RecyclerView + Data Binding Sample

Simple sample

Use LiveData directly with data binding

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <data>

        <variable
            name="viewModel"
            type="com.ciandt.recyclerviewbinding.presentation.simple.SimpleViewModel" />
    </data>

    <android.support.constraint.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.v7.widget.RecyclerView
            android:id="@+id/recyclerView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:items="@{viewModel.items}" /> <!-- Use android data binding to update adapter -->
    </android.support.constraint.ConstraintLayout>
</layout>
class SimpleViewModel : ViewModel() {

    val items: LiveData<List<String>> =
        MutableLiveData<List<String>>().apply { value = ItemsRepository().getItemsPage() }
}

Simple RecyclerView Setup

class SimpleFragment : Fragment() {

    ...
    
    override fun onActivityCreated(savedInstanceState: Bundle?) {
        super.onActivityCreated(savedInstanceState)

        viewModel = ViewModelProviders.of(this)[SimpleViewModel::class.java]

        val layoutManager = LinearLayoutManager(context)

        recyclerView.layoutManager = layoutManager
        recyclerView.hasFixedSize()
        recyclerView.adapter = ItemsAdapter()
        recyclerView.addItemDecoration(DividerItemDecoration(context, layoutManager.orientation))

        binding.viewModel = viewModel
    }

}

Endless Scroll sample (accessibility support)

class EndlessFragment : Fragment() {

    ...
    
    override fun onActivityCreated(savedInstanceState: Bundle?) {
        super.onActivityCreated(savedInstanceState)

        viewModel = ViewModelProviders.of(this)[EndlessViewModel::class.java]

        val layoutManager = LinearLayoutManager(context)

        recyclerView.layoutManager = layoutManager
        recyclerView.hasFixedSize()
        recyclerView.adapter = ItemsAdapter()
        recyclerView.addItemDecoration(DividerItemDecoration(context, layoutManager.orientation))

        // USE EXTENSION TO SIMPLIFY ENDLESS SETUP
        recyclerView.endless { viewModel.fetchItems() }

        // USE EVENT WRAPPER TO NOTIFY CHANGES TO ADAPTER
        //https://bit.ly/2NeeTMP [LiveData with SnackBar, Navigation and other events (the SingleLiveEvent case)]
        viewModel.updateList.subscribe(this) { 
            recyclerView.adapter.notifyDataSetChanged()
        }

        binding.viewModel = viewModel
    }
}
MIT License

Copyright (c) 2018 CI&T Mobile Team

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].