Giter Club home page Giter Club logo

excelpanel's Introduction

excelPanel

A two-dimensional RecyclerView. Not only can load historical data, but also can load future data.

demo_gif demo_gif_adjust_height

Including in your project

compile 'cn.zhouchaoyuan:excelpanel:1.0.5'

Usage

1、Write in xml

<cn.zhouchaoyuan.excelpanel.ExcelPanel
        android:id="@+id/content_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:left_cell_width="@dimen/room_status_cell_length"
        app:normal_cell_width="@dimen/room_status_cell_length"
        app:top_cell_height="@dimen/room_status_cell_length" />

Configure using xml attributes

app:left_cell_width     //left header cell's width, not support wrap_content
app:normal_cell_width   //container cell's width, not support wrap_content
app:top_cell_height     //top header cell's height, not support wrap_content

2、Define your Custom Adapter

Your adapter must extends BaseExcelPanelAdapter and override seven methods show as follow:

public class Adapter extends BaseExcelPanelAdapter<RowTitle, ColTitle, Cell>{

    public Adapter(Context context) {
        super(context);
    }

    //=========================================normal cell=========================================
    @Override
    public RecyclerView.ViewHolder onCreateCellViewHolder(ViewGroup parent, int viewType) {
        return null;
    }

    @Override
    public void onBindCellViewHolder(RecyclerView.ViewHolder holder, int verticalPosition, int horizontalPosition) {

    }

    //=========================================top cell===========================================
    @Override
    public RecyclerView.ViewHolder onCreateTopViewHolder(ViewGroup parent, int viewType) {
        return null;
    }

    @Override
    public void onBindTopViewHolder(RecyclerView.ViewHolder holder, int position) {

    }

    //=========================================left cell===========================================
    @Override
    public RecyclerView.ViewHolder onCreateLeftViewHolder(ViewGroup parent, int viewType) {
        return null;
    }

    @Override
    public void onBindLeftViewHolder(RecyclerView.ViewHolder holder, int position) {

    }

    //=========================================top left cell=======================================
    @Override
    public View onCreateTopLeftView() {
        return null;
    }
}

3、Use your Adapter

//==============================
private List<RowTitle> rowTitles;
private List<ColTitle> colTitles;
private List<List<Cell>> cells;
private ExcelPanel excelPanel;
private CustomAdapter adapter;
private View.OnClickListener blockListener
//..........................................
excelPanel = (ExcelPanel) findViewById(R.id.content_container);
adapter = new CustomAdapter(this, blockListener);
excelPanel.setAdapter(adapter);
excelPanel.setOnLoadMoreListener(this);//your Activity or Fragment implement ExcelPanel.OnLoadMoreListener
adapter.setAllData(colTitles, rowTitles, cells);
adapter.enableFooter();//load more, you can also call disableFooter()----default
adapter.enableHeader();//load history, you can also call disableHeader()----default

If using setOnLoadMoreListener(...) and enableHeader() you must call addHistorySize(int) to tell ExcelPanel how many data have been added.

ChangeLog

  • V1.0.1--------------Line i can be different to line i+1, but the same line's height must be equals
  • V1.0.2--------------Support different viewType which using to config different row with different height
  • V1.0.3--------------Remove adjust height, fix bug when excelPanel in ViewPager
  • V1.0.4--------------Optimizing rolling
  • V1.0.5--------------addOnScrollListener

License

   Copyright 2017 zhouchaoyuan

   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.

excelpanel's People

Contributors

zhouchaoyuan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

excelpanel's Issues

How to solve this problem?

Error:A problem occurred configuring project ':app'.

Could not resolve all dependencies for configuration ':app:_debugApk'.
Exception thrown while executing model rule: PublishingPlugin.Rules#publishing(ExtensionContainer)
> org/gradle/api/internal/component/Usage

Performance Issues

Hello,
first, thank you very much for sharing your work here!

I have some serious performance problems on tablets where there are e.g. 20 columns and 10 rows.

Is this normal? Do other users also have this issue?
Is there something I can do about, or is it a principal problem with the large number of RecyclerViews?

Thanks!

Whole Panel not scrolling

Hello,
Vertical scroll not working for whole panel(refer below GIF) as you describe in description GIF.
can you please tell me ASAP how can I do that ?
Thanks
ezgif com-video-to-gif

can't scroll dynamically

I have an excel panel, top side of it has employees and left side of it has hours, before opening excel panel customer will be able to give a range of hours and when opening excel panel the panel must be able to scroll to that position where the given hour range is starting.
excel panel has a method call scrollTo(int x, int y) . but its not working. I also tried scrollBy() and setVerticalScrollbarPosition() methods and they are not working as well.

Is it possible to merge cells?

excel merge

Is it possible to have merged cells like in Excel (see AB & CD cells in screenshot)?
I do not see this feature but it would help me a lot.

Have a nice day !

Need tutorial

Could you please write tutorial about this in english ? I wish to learn and code like this.

removeLastCell

首先我发现notifyDataSetChanged这个方法好像不好用,增删改的时候调用刷新没反应。于是我就每次有修改或者删除的时候就setAddData这个方法,增加和修改都没问题,但是删除最后一行cell的时候就不能用这个方法了,因为cell长度为0,会抛出索引越界,这个删除最后一行cell有什么好方法吗?

滑动卡顿

demo 里面运行起来,有卡顿掉帧的感觉

数据量大的时候卡顿问题

有一个奇怪的现象,当数据量比较大的时候, 前面的数据滑动起来不算太卡,但是如果一直往下滑动到接近底部的地方,就会出现卡顿现象, 看了Monitors,发现内存并无太大起伏,但是CPU曲线当滑动到底部的时候就很次CPU,导致滑动卡顿, 请问这现象有没有办法解决.

直接引用jcenter会编译会有问题

由于你的compileSDK是24,我的工程是21,直接引用jcenter,编译的时候values的一些文件会资源找不到,
如果引入moudle将compile降到跟我工程都是21,那recycleview有一个bug,normalCell不会显示,不知道有没有人跟我一样遇到这个问题,目前我的做法是引入moudle,compile降到21,把recycleView保持是24,这样虽然会报版本冲突,但是勉强还能接受。

建议给一些功能做个开关

比如是否显示左侧表头 是否允许上下滚动 是否允许左右滚动
这些功能你都实现了为什么不提供关闭它们的开关呢

pull load

请问 上拉加载 如何实现? 目前好像只有左右加载 而且我关闭监听是 左右拉动时 还会有progre 显示?
点击事件能不能监听一整行?
@zhouchaoyuan

使用了NestedScrollview嵌套了Viewpager,里面的excelPanel 就不能用了

使用了NestedScrollview嵌套了Viewpager,里面的excelPanel 就不能用了

<android.support.v4.widget.NestedScrollView 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"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
tools:context="cn.zhouchaoyuan.excelpaneldemo.MainActivity">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <android.support.design.widget.TabLayout
        android:id="@+id/tab_layout"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:background="@color/bg_color"
        app:tabIndicatorColor="@color/tab_indicator_color"
        app:tabMode="scrollable"
        app:tabTextColor="@color/white"></android.support.design.widget.TabLayout>

    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_weight="1"
        android:layout_width="match_parent"
        android:layout_height="0dp"></android.support.v4.view.ViewPager>
</LinearLayout>

</android.support.v4.widget.NestedScrollView>

demo有问题

在cells区域的左右两侧各有一个progressBar,不知道哪来的 我都照着demo写完代码了 才发现这个问题
怎么解决
另外 左右拖动标题行 上下拖动左侧标题列时 内容应该同步拖动啊 是不是因为这个progressBar造成的

很明显的bug

当数据多到可以上下、左右可以滑动时表格会不对齐。
操作:
1、先上下滑动;
2、这时候左右滑动,右边内容区的某列表格不对其,在触摸滑动下,又对其了。

SQLite and history question

Hi,Can you please tell me how to stick to the future data only and not load any history data.My requirement is to get data from sqlite and show employee one month data here.Thank you in advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.