Git Product home page Git Product logo

titanrecyclerview's Introduction

TitanRecyclerView

Build Status

A handy RecyclerView can deal with all headers, footers, and loading shit.

Demo

header view & footer view

load more

Dependencies

compile 'com.youzan:titan:0.4.3'

Features

  • Header View
  • Footer View
  • Load More
  • Customizable Loading Style
  • Empty View
  • More comming soon!

Usage

Use TitanRecyclerView in xml.

<com.youzan.titan.TitanRecyclerView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/titan_recycler_view"
    android:layout_centerVertical="true"
    android:layout_centerHorizontal="true"/>

Use QuickAdapter.

mAdapter = new QuickAdapter<String>(R.layout.text_item, mData) {
  @Override
  public void bindView(AutoViewHolder holder, int position, String model) {
    holder.getTextView(R.id.text_item_textview).setText( 
      "0".equals(model) ? attachActivity.getString(R.string.close) : model + attachActivity.getString(R.string.people));
  }
};

Use TitanAdapter.

public class ItemsAdapter extends TitanAdapter<DemoItem> {
  
  @Override
  protected RecyclerView.ViewHolder createVHolder(ViewGroup parent, int viewType) {
      return new NormalTextViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_text, parent, false), this);
  }
  
  @Override
  protected void showItemView(RecyclerView.ViewHolder holder, int position) {
      ((NormalTextViewHolder) holder).mTextView.setText(mData.get(position).title);
  }
  
  @Override
  public long getAdapterItemId(int position) {
      return 0;
  }
  
  public static class NormalTextViewHolder extends RecyclerView.ViewHolder {
      TextView mTextView;
      ItemsAdapter mAdapter;
  
      NormalTextViewHolder(View view, ItemsAdapter adapter) {
          super(view);
          mTextView = (TextView) view.findViewById(R.id.text_view);
          mAdapter = adapter;
      }
  }
}

Use setEmptyView.

//inflate ViewGroup use TitanRecyclerView
mTitanAdapter.setEmptyView(LayoutInflater.from(getContext()).inflate(R.layout.empty_view, mTitanRecyclerView, false));
  • add setDefaultView, setBadNetView. use them for net status and others

Use setOnScrolledListener.

  • can listener Titan scroll

Acknowledgement

License

MIT

titanrecyclerview's People

Contributors

danke77 avatar faceace avatar liangfeidotme avatar mosnter avatar radishwu 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

titanrecyclerview's Issues

andrroidX适配问题

首先感谢分享,作者辛苦了!这边可以适配一下androidX么?androidX报错

headview显示问题

当headview时LinearLayout时,宽度设置是match_parent,实际显示并不是match_parent,而是wrap_content,改成RelativeLayout就没问题。

给力!

看了一下代码,真心赞 ~ 大部分的功能都涵盖了, 目前用过最方便的RecyclerView 。 如果在加个侧滑 删除 就完美了.

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.