All Projects → naverz → Antonio

naverz / Antonio

Licence: Apache-2.0 License
Android library for the adapter view (RecyclerView, ViewPager, ViewPager2)

Programming Languages

kotlin
9241 projects
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Antonio

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 (-79.78%)
Mutual labels:  recyclerview, viewpager
Banner
Android Viewpager rotation control, application guide page controls, support vertical, horizontal cycle scrolling, extended from view support animation, indicator extension and so on;Android viewpager轮播图控件、app引导页控件,支持垂直、水平循环滚动,扩展自viewpager 支持动画,指示器扩展等。
Stars: ✭ 96 (+7.87%)
Mutual labels:  recyclerview, viewpager
Verticalviewpager
A vertical scroll ViewPager implementation. Use with scrollable views(ListView, ScrollView, RecyclerView).
Stars: ✭ 64 (-28.09%)
Mutual labels:  recyclerview, viewpager
Scrollingpagerindicator
Pager indicator inspired by Instagram. Lightweight and easy to set up.
Stars: ✭ 419 (+370.79%)
Mutual labels:  recyclerview, viewpager
MetalRecyclerPagerView
RecyclerView implementation for Android which makes it look and feel like ViewPager with item margins support (mutliple views effect).
Stars: ✭ 26 (-70.79%)
Mutual labels:  recyclerview, viewpager
Discretescrollview
A scrollable list of items that centers the current element and provides easy-to-use APIs for cool item animations.
Stars: ✭ 5,533 (+6116.85%)
Mutual labels:  recyclerview, viewpager
Recyclerpager
Using RecyclerView and SnapHelper replace ViewPager
Stars: ✭ 73 (-17.98%)
Mutual labels:  recyclerview, viewpager
Transformerslayout
🔥 App金刚区导航菜单,类似淘宝、QQ音乐等APP导航,方格布局横向多行滑动翻页带滚动条
Stars: ✭ 258 (+189.89%)
Mutual labels:  recyclerview, viewpager
Pageindicator
An Instagram like page indicator compatible with RecyclerView and ViewPager.
Stars: ✭ 236 (+165.17%)
Mutual labels:  recyclerview, viewpager
Overscroll Decor
Android: iOS-like over-scrolling effect applicable over almost all scrollable Android views.
Stars: ✭ 2,671 (+2901.12%)
Mutual labels:  recyclerview, viewpager
Adapter
A quick adapter library for RecyclerView, GridView, ListView, ViewPager, Spinner
Stars: ✭ 376 (+322.47%)
Mutual labels:  recyclerview, viewpager
Viewpager2-Transformation
No description or website provided.
Stars: ✭ 20 (-77.53%)
Mutual labels:  viewpager, viewpager2
Corbind
Kotlin Coroutines binding APIs for Android UI widgets from the platform and support libraries
Stars: ✭ 357 (+301.12%)
Mutual labels:  recyclerview, viewpager
Gallerylayoutmanager
New way to implements ViewPager/Gallery in Android with RecycleView
Stars: ✭ 684 (+668.54%)
Mutual labels:  recyclerview, viewpager
Cardslideview
一行代码实现ViewPager卡片效果,比ViewPager2更强大,底层同样是RecyclerView
Stars: ✭ 301 (+238.2%)
Mutual labels:  recyclerview, viewpager
Collapsingrefresh
AppBarLayout+ViewPager+RecyclerView的刷新功能
Stars: ✭ 69 (-22.47%)
Mutual labels:  recyclerview, viewpager
Bannerviewpager
🚀 An awesome banner view for Android,Based on ViewPager2. 这可能是全网最好用的ViewPager轮播图。简单、高效,一行代码实现循环轮播,一屏三页任意变,指示器样式任你挑。
Stars: ✭ 2,603 (+2824.72%)
Mutual labels:  viewpager, viewpager2
devbricksx-android
DevBricksX provides plenty of useful classes that will be used in daily Android development.
Stars: ✭ 22 (-75.28%)
Mutual labels:  recyclerview, viewpager2
Gridpagersnaphelper
A powerful tools to impl grid paging layout by RecyclerView
Stars: ✭ 228 (+156.18%)
Mutual labels:  recyclerview, viewpager
Adsorbent
Adsorbent of RecyclerView , RecyclerView吸顶
Stars: ✭ 25 (-71.91%)
Mutual labels:  recyclerview, viewpager

Antonio

Android library for the adapter view (RecyclerView, ViewPager, ViewPager2)

  • Free from implementation of the adapter's boilerplate code!
  • Free from implementation of the view holder with data-binding (Two-way binding OK)!
  • ViewPager, ViewPager2, Paging2, Paging3 supported!
  • Manage the recycler view state on your view model!
  • There is no things to learn, if you already know about adapter views (RecyclerView, ViewPager, ViewPager2)!

Install

Without data binding

dependencies {
    def antonioVersion = '1.0.5-alpha'
    def antonioAnnotationVersion = '0.0.1-alpha'
  
    implementation "io.github.naverz:antonio:$antonioVersion"

    implementation "io.github.naverz:antonio-annotation:$antonioAnnotationVersion"

    //For java
    annotationProcessor "io.github.naverz:antonio-compiler:$antonioAnnotationVersion"

    //For kotlin
    kapt "io.github.naverz:antonio-compiler:$antonioAnnotationVersion"

    //For paging2
    implementation "io.github.naverz:antonio-paging2:$antonioVersion"

    //For paging3
    implementation "io.github.naverz:antonio-paging3:$antonioVersion"
}

With data binding

dependencies {
    def antonioVersion = '1.0.5-alpha'
    def antonioAnnotationVersion = '0.0.1-alpha'
  
    implementation "io.github.naverz:antonio-databinding:$antonioVersion"

    implementation "io.github.naverz:antonio-annotation:$antonioAnnotationVersion"

    //For java
    annotationProcessor "io.github.naverz:antonio-compiler:$antonioAnnotationVersion"

    //For kotlin
    kapt "io.github.naverz:antonio-compiler:$antonioAnnotationVersion"

    //For paging2
    implementation "io.github.naverz:antonio-databinding-paging2:$antonioVersion"

    //For paging3
    implementation "io.github.naverz:antonio-databinding-paging3:$antonioVersion'
}

Basic Usage

  • Implement AntonioBindingModel to bind model on your view holder layout xml.

data class ContentSmallModel(
    val id: String,
    @DrawableRes val iconRes: Int,
    val price: Int,
    val onClick: (id: String) -> Unit,
    val onLongClick: (id: String) -> Boolean,
    val selectedIds: LiveData<Set<String>>
) : AntonioBindingModel {
    // Layout id to be inflated
    override fun layoutId(): Int = R.layout.view_holder_content_small
    // Variable id in XML to be bind on bind view holder
    // (e.g., onBindViewHolder in ViewHolder, onViewCreated in Fragment).
    override fun bindingVariableId(): Int = BR.model
}
  • Create your view holder layout xml with the AntonioBindingModel you implemented. view_holder_content_small.xml
<?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"
    xmlns:tools="http://schemas.android.com/tools"
    >
    <data>
        <variable
            name="model"
            type="io.github.naverz.antonio.sample.ContentSmallModel"
        />
    </data>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center_horizontal"
        android:onClick="@{()->model.onClick.invoke(model.id)}"
        android:onLongClick="@{(view)->model.onLongClick.invoke(model.id)}"
        android:orientation="vertical"
        android:padding="5dp"
        >
        <!-- ... -->
    </LinearLayout>
</layout>
  • Declare AntonioAdapter (or AntonioListAdapter) and Set adapter with your data to RecyclerView.
   private fun initAdapter(){
       // You also can specify the type of Antonio model for the adapter, if you don't need various view types.
       // e.g., AntonioAdapter<ContentSmallModel>()
        binding.recyclerView.adapter =
            AntonioAdapter<AntonioModel>().apply { currentList = viewModel.antonioModels }
        // Don't forget to set the layout manager to your recycler view :)
        binding.recyclerView.layoutManager = GridLayoutManager(context,4)    
        viewModel.onDataSetChanged.observe(this) {
            binding.recyclerView.adapter?.notifyDataSetChanged()
        }
   }
  

LifecycleOwner will be injected automatically!

LifecycleOwner, which is nearest from the view, will be automatically injected on All of XML inflated from AutoBindingModel in order to use LiveData for two-way binding.

Awesome wiki!

Sample

The sample module is available!

License

Antonio
Copyright (c) 2021-present NAVER Z Corp.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
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].