A flexible view for providing a limited rect window into a large data set,just like a two-dimensional RecyclerView. It different from RecyclerView is that it's two-dimensional(just like a Panel) and it pin the itemView of first row and first column in their original location.

Overview

ScrollablePanel


A flexible view for providing a limited rect window into a large data set,just like a two-dimensional RecyclerView.

It different from RecyclerView is that it's two-dimensional(just like a Panel) and it pin the itemView of first row and first column in their original location.

ScrollablePanel Demo

Demo

Apk Download:ScrollablePanelDemo.apk

Download

  compile 'com.kelin.scrollablepanel:library:1.2.0' 

Usage

ScrollablePanel is very similar to the RecyclerView and we can use them in the same way.

####1、Initialize ScrollablePanel

<com.kelin.scrollablepanel.library.ScrollablePanel
        android:id="@+id/scrollable_panel"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

####2、Adapter

This adapter must extend a class called PanelAdapter,We now have to override following methods so that we can implement our logic.

public class TestPanelAdapter extends PanelAdapter {
    private List<List<String>> data;

    @Override
    public int getRowCount() {
        return data.size();
    }

    @Override
    public int getColumnCount() {
        return data.get(0).size();
    }

    @Override
    public int getItemViewType(int row, int column) {
        return super.getItemViewType(row, column);
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int row, int column) {
        String title = data.get(row).get(column);
        TitleViewHolder titleViewHolder = (TitleViewHolder) holder;
        titleViewHolder.titleTextView.setText(title);
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new TestPanelAdapter.TitleViewHolder(LayoutInflater.from(parent.getContext())
                .inflate(R.layout.listitem_title, parent, false));
    }

    private static class TitleViewHolder extends RecyclerView.ViewHolder {
        public TextView titleTextView;

        public TitleViewHolder(View view) {
            super(view);
            this.titleTextView = (TextView) view.findViewById(R.id.title);
        }
    }
}

####3、Set Adapter

@Override
protected void onCreate(Bundle savedInstanceState) {
   ...
   ...
   TestPanelAdapter testPanelAdapter = new TestPanelAdapter();
   ScrollablePanel scrollablePanel = (ScrollablePanel) findViewById(R.id.scrollable_panel);
   scrollablePanel.setPanelAdapter(testPanelAdapter);
   ...
   ...
}

ChangeLog

  • V1.0.1 (2016-12-01) fix header scroll bug
  • V1.1.0 (2016-12-21) fix desynchronisation between RV’s & fix dislocation of first column in every row!
  • V1.2.0 (2016-12-26) Add notifyDataSetChanged & Fix auto reset to original position when first time scroll down!

License

 Copyright 2016 Kelin Hong
 
 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.
 
Comments
  • 单元格错位

    单元格错位

    image

    向右滑半个单元格 然后慢慢向上滑几个单元格 可以复现该bug

     public void initRecyclerView(RecyclerView recyclerView) {
                observerList.add(recyclerView);
                recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
                    int state;
    
                    @Override
                    public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
                        super.onScrolled(recyclerView, dx, dy);
                        if (state == RecyclerView.SCROLL_STATE_IDLE) {
                            return;
                        }
                        LinearLayoutManager linearLayoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
                        int firstPos = linearLayoutManager.findFirstVisibleItemPosition();
                        View firstVisibleItem = linearLayoutManager.getChildAt(0);
                        if (firstVisibleItem != null) {
                            int firstRight = linearLayoutManager.getDecoratedRight(firstVisibleItem);
                            for (RecyclerView rv : observerList) {
                                if (recyclerView != rv) {
                                    LinearLayoutManager layoutManager = (LinearLayoutManager) rv.getLayoutManager();
                                    if (layoutManager != null) {
                                        layoutManager.scrollToPositionWithOffset(firstPos + 1, firstRight);
                                    }
                                }
    
                            }
                        }
                    }
    
                    @Override
                    public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
                        super.onScrollStateChanged(recyclerView, newState);
                        state = newState;
                    }
                });
            }
    

    应该是这里的问题

    if (state == RecyclerView.SCROLL_STATE_IDLE) {
                            return;
                        }
    

    新加进来的item没有滑动到其他item所在的位置

    opened by feng0403 5
  • Jitter left/right fling

    Jitter left/right fling

    Bug Reproduce by flinging left on a row, then fling right on another row

    This causes two flings to work against eachother and causes stutter / jittery behaviour

    opened by GreaseMonk 1
  • 顶栏可以单独滑动,这样会导致日期和下面的item不对齐

    顶栏可以单独滑动,这样会导致日期和下面的item不对齐

    ScrollablePanel类中其他的RecyclerView都有initRecyclerView(RecyclerView),只有headerRecyclerView没有init,问题应该出在这里。

    PinFirstItemRecyclerView这个类是精华,一开始我想不通你的第一项时怎么处理的,看了源码才知道原来可以这样,学习了,赞!

    opened by DearZack 1
  • 帮忙改个闪烁的bug

    帮忙改个闪烁的bug

    往左侧滑半个item再上下滑动闪烁: public void initRecyclerView(RecyclerView recyclerView) { recyclerView.setHasFixedSize(true); LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager(); if (layoutManager != null && (firstPos > 0 || firstOffset > 0)) {//改的这里 layoutManager.scrollToPositionWithOffset(PanelLineAdapter.this.firstPos + 1, PanelLineAdapter.this.firstOffset); } 。。。 }

    opened by EnvyChen 0
  • Fix infinite creation of firstHeaderViewHolder

    Fix infinite creation of firstHeaderViewHolder

    Fixed Problem: after every notifyDataSetChanged ScrollablePanel creates and adds new view to top-left cell (first header) that lead to large memory leak and lags. Closes https://github.com/Kelin-Hong/ScrollablePanel/issues/20

    opened by rt1shnik 0
  • How can I get the Recycler View to load new data!?

    How can I get the Recycler View to load new data!?

    It loads the data from a database correctly but in the instance I want the data to load real time and without me having to navigate out of the view and back into the view to see the data refreshed?

    Would like it to refresh as the DB is updated, btw I am using firebase.

    opened by famictech2000 0
Owner
KelinHong
KelinHong
A RecyclerView(advanced and flexible version of ListView in Android) with refreshing,loading more,animation and many other features.

UltimateRecyclerView Master branch: Dev branch: Project website:https://github.com/cymcsg/UltimateRecyclerView Description UltimateRecyclerView is a R

MarshalChen 7.2k Jan 2, 2023
ScrollableList - learn how to efficiently display a list of text in a RecyclerView and understand its architecture.

ScrollableList Learn how to efficiently display a list of text in a RecyclerView and understand its architecture. activity_main RecyclerView widget he

null 0 Jan 3, 2022
Set of plugable extenstions for Android RecyclerView

DynamicRecyclerView Set of light and non-invasive extensions for Android RecyclerView widget. Does not use custom RecyclerView or LayoutManager. With

Ilja S. 342 Nov 11, 2022
ItemDecorator - Custom item decorator for adding divider for only the first item of a RecyclerView

ItemDecorator Custom item decorator for adding divider for only the first item o

null 1 Apr 1, 2022
An adapter to create Android RecyclerViews with sections, providing headers and footers.

⚠ This library is no longer maintained ⚠️ SectionedRecyclerView An adapter to create Android RecyclerViews with sections, providing headers and footer

Tomás Ruiz-López 809 Dec 21, 2022
Handy library to integrate pagination, which allow no data layout, refresh layout, recycler view in one view and easy way to bind pagination in app.

Pagination View Handy library to integrate pagination, which allow no data layout, refresh layout, recycler view in one view and easy way to bind pagi

DhiWise 4 Dec 18, 2021
A RecyclerView that implements pullrefresh and loadingmore featrues.you can use it like a standard RecyclerView

XRecyclerView a RecyclerView that implements pullrefresh , loadingmore and header featrues.you can use it like a standard RecyclerView. you don't need

XRecyclerView 5.3k Dec 26, 2022
A RecyclerView that implements pullrefresh and loadingmore featrues.you can use it like a standard RecyclerView

XRecyclerView a RecyclerView that implements pullrefresh , loadingmore and header featrues.you can use it like a standard RecyclerView. you don't need

XRecyclerView 5.3k Dec 26, 2022
Just another one easy-to-use adapter for RecyclerView :rocket:

Elementary RecyclerView Adapter Another one easy-to-use adapter for RecyclerView ?? Features: DSL-like methods for building adapters similar to Jetpac

Roman Andrushchenko 29 Jan 6, 2023
RecyclerView extension library which provides advanced features. (ex. Google's Inbox app like swiping, Play Music app like drag and drop sorting)

Advanced RecyclerView This RecyclerView extension library provides Google's Inbox app like swiping, Play Music app like drag-and-drop sorting and expa

Haruki Hasegawa 5.2k Dec 23, 2022
A Common RecyclerView.Adapter implementation which supports all kind of items and has useful data operating APIs such as remove,add,etc.

##PowerfulRecyclerViewAdapter A Common RecyclerView.Adapter implementation which supports any kind of items and has useful data operating APIs such as

null 313 Nov 12, 2022
Add RecyclerView, use Adapter class and ViewHolder to display data.

فكرة المشروع في هذا المشروع سنقوم بعرض قائمة من البيانات للطلاب على واجهة تطبيق Android بإستخدام: مفهوم RecyclerView مفهوم Adapter مفهوم ViewModel محت

Shaima Alghamdi 3 Nov 18, 2021
Using RecyclerView to display data instead of ScrollView or lInearLayout for a strong app. It replaces the ScrollView used in trackMySleep app.

RecyclerView - SleepQualityTracker with RecyclerView app This is the toy app for Lesson 7 of the Android App Development in Kotlin course on Udacity.

Espérant GADA 0 Oct 18, 2021
Sort & Filter Data RecyclerView

Sort-Filter-RecyclerView Sort & Filter Data RecyclerView Tutorial Build with Android Studio

Azhar Rivaldi 12 Dec 9, 2022
TikTok-RecyclerView - This is a demo app built using 'Koin' a new dependency injection framework for Android along with RecyclerView and ExoPlayer2.

TikTok-RecyclerView Demo About This is a demo app built using 'Koin' a new dependency injection framework for Android along with RecyclerView and ExoP

Baljeet Singh 19 Dec 28, 2022
Pagination-RecyclerView - Simple and easy way to Paginating a RecyclerView

Pagination-RecyclerView Simple and easy way to Paginating a RecyclerView Android

Rakshit Nawani 0 Jan 3, 2022
ANDROID. ChipsLayoutManager (SpanLayoutManager, FlowLayoutManager). A custom layout manager for RecyclerView which mimicric TextView span behaviour, flow layouts behaviour with support of amazing recyclerView features

ChipsLayoutManager This is ChipsLayoutManager - custom Recycler View's LayoutManager which moves item to the next line when no space left on the curre

Oleg Beloy 3.2k Dec 25, 2022
Carousel Recyclerview let's you create carousel layout with the power of recyclerview by creating custom layout manager.

Carousel Recyclerview let's you create carousel layout with the power of recyclerview by creating custom layout manager.

Jack and phantom 504 Dec 25, 2022
RecyclerView : SleepQualityTracker with RecyclerView app

RecyclerView - SleepQualityTracker with RecyclerView app SleepQualityTracker with RecyclerView This app builds on the SleepQualityTracker developed pr

Kevin 2 May 14, 2022