RecyclerViewManager


Source link: https://github.com/Syehunter/RecyclerViewManager

RecyclerViewManager

RecyclerViewManager supports PullToRefresh and LoadMore, U can also add headers or footers for RecyclerView. Also supports onItemClickEvent.

Use setMode() if you want it PullDown or LoadMore only. With RecyclerMode.PullDown replace setOnRefreshListener() to setOnPullDownListener(), and use setOnLoadMoreListener() in the same way.

allprojects {

  repositories {

jcenter()

maven {
 url "https://jitpack.io" 
}

  
}
 
}

dependencies {

  compile 'com.github.Syehunter:RecyclerViewManager:0.1.7' 
}

Layout:

<space.sye.z.library.widget.RefreshRecyclerView  android:id="@+id/recyclerView"  android:layout_width="match_parent"  android:layout_height="match_parent"/>

Usage in Activity or some others:

recyclerView = (RefreshRecyclerView) findViewById(R.id.recyclerView);
 MyAdapter myAdapter = new MyAdapter();
 //a RecyclerView.Adapter  RecyclerViewManager.with(myAdapter, new LinearLayoutManager(this))

.setMode(RecyclerMode.BOTH)

.addHeaderView(header)

.addHeaderView(header2)

.addFooterView(footer)

.setOnBothRefreshListener(new OnBothRefreshListener() {

 @Override

 public void onPullDown() {

  //??????

  Message msg = new Message();

  msg.what = PULL_DOWN;

  mHandler.sendMessageDelayed(msg, 2000);

 
}

  @Override

 public void onLoadMore() {

  //??????

  Message msg = new Message();

  msg.what = LOAD_MORE;

  mHandler.sendMessageDelayed(msg, 2000);

 
}

}
)

.setOnItemClickListener(new RefreshRecyclerViewAdapter.OnItemClickListener() {

 @Override

 public void onItemClick(RecyclerView.ViewHolder holder, int position) {

  Toast.makeText(MainActivity.this, "item" + position, Toast.LENGTH_SHORT).show();

 
}

}
)

.into(recyclerView, this);
  private Handler mHandler = new Handler(){
  @Override

public void handleMessage(Message msg) {

 switch (msg.what){

  case PULL_DOWN:

mDatas.add(0, "new Item");

break;

  case LOAD_MORE:

for (int i = 0; i < 10; i++){

 mDatas.add("item" + (counts + i));

}

counts = counts + 10;

break;

 
}

 recyclerView.onRefreshCompleted();

 mAdapter.notifyDataSetChanged();

}

  
}
;

Use recyclerView.real() to get the real RecyclerView if you want to use methods of it.

Simple Introduction for RecyclerViewManager(Chinese): http://z.sye.space/2015/11/23/RecyclerViewManager/

Resources

Simple ToggleButton Widget for Android developers.

SunDate_Picker is a library for Persian developers to let users choose date.

Library that implements Snackbars from Google's Material Design documentation.

MaterialList is an Android library created to help all Android developers get the beautiful CardViews that Google shows at its official design specifications.

Provided as a ListView extension, it can receive a list of Cards (stored in a CardList, provided by the library) and show them accordingly to the android style and design patterns.

It also has been developed while keeping extensibility in mind, which means that you are able to create your own card layouts and add them to the CardList without any pain (see examples below).

material-drawer is a custom drawer implementation for Material design apps.

A single EditText instead of a classical form. This Library is a library implementation of flavienlaurent's "Single input form". Very inspired by the Minimal Format Interface.

Implement any form with only one EditText. The idea here is to pack a multiple input form in one field. As a result, the user input is easier and a more fluent process.

Also, TextSwitcher got completely rediscovered to animate the form: title, error message. It's very basic but simple to use.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes