EasyRecycler


Source link: https://github.com/leomindez/EasyRecycler

EasyRecycler

Library to use Recycler View easily.

Usage

maven {
 url 'https://jitpack.io' 
}
 compile 'com.github.leomindez:easyrecycler:1.0.1'

SimpleAdapter

Create ViewHolder

 class SampleViewHolder extends EasyItemViewHolder {

 TextView sampleItem;

 public SampleViewHolder(@NotNull View view) {

 super(view);

 sampleItem = (TextView)view.findViewById(R.id.sample_item);

}

 public void bindItem(String s){

 sampleItem.setText(s);

}

  
}

Create Adapter

class SampleAdapter extends EasyAdapter<SampleAdapter.SampleViewHolder, String> {

@NotNull
  @Override
  public SampleViewHolder createHolder(@Nullable ViewGroup parent, int viewType) {

return new SampleViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.sample_item_layout,parent,false));

  
}

@Override
  public void onBindItemViewHolder(@NotNull SampleViewHolder holder, String s, int position) {

holder.bindItem(s);

  
}
  
}

Recycler Item Click

 RecyclerViewExtensionsKt.OnItemClickListener(recyclerView, new RecyclerViewItemClickListener.OnItemClickListener() {

 @Override

 public void onClick(@Nullable View view, @Nullable Integer position) {

  Log.d("item", sampleAdapter.getItems().get(position));

 
}

}
);

Header Adapter

Create Holders

private static class HeaderAdapter extends EasyHeaderViewHolder {

 public HeaderAdapter(@NotNull View view) {

 super(view);

}

public void bindHeader(){

 
}

  
}

private static class ItemAdapter extends EasyItemViewHolder{

TextView textView;

 public ItemAdapter(@NotNull View view) {

 super(view);

 textView = (TextView) view.findViewById(R.id.sample_item);

}

 public void bindItem(String s) {

 textView.setText(s);

}

  
}

Create Header Adapter

public class SampleHeaderAdapter extends EasyHeaderAdapter<String> {

@NotNull
  @Override
  public HeaderAdapter createHeaderViewHolder(@Nullable ViewGroup parent) {

return new HeaderAdapter(LayoutInflater.from(parent.getContext()).inflate(R.layout.header_layout,parent,false));

  
}

@NotNull
  @Override
  public ItemAdapter createItemViewHolder(@Nullable ViewGroup parent) {

return new ItemAdapter(LayoutInflater.from(parent.getContext()).inflate(R.layout.sample_item_layout,parent,false));

  
}

@Override
  public void onBindHeaderViewHolder(@NotNull EasyViewHolder headerHolder) {

((HeaderAdapter)headerHolder).bindHeader();

  
}

@Override
  public void onBindItemViewHolder(@NotNull EasyViewHolder holder, String s, int position) {

((ItemAdapter) holder).bindItem(s);

  
}
 
}

Recycler Header and Item Click

  RecyclerViewExtensionsKt.OnHeaderAndItemClickListener(recyclerView, new RecyclerViewHeaderClickListener.OnHeaderClickListener() {

 @Override

 public void onHeaderClick() {

  Log.d("Header", "header click");

 
}

}
, new RecyclerViewItemClickListener.OnItemClickListener() {

 @Override

 public void onItemClick(@Nullable View view, @Nullable Integer position) {

  Log.d("Item", sampleAdapter.getItems().get(position));

 
}

}
);

Add Elements


SampleHeaderAdapter sampleAdapter = new SampleHeaderAdapter();
   
   sampleAdapter.addItem("hola");
         sampleAdapter.addItem("mundo");

ArrayList<String> items = new ArrayList<String>();

items.add("hola");

items.add("mundo");

sampleAdapter.addItems(items);

Example

Resources

This is a Gradle plugin, for Android developers, that automates app versioning.

A simple countdown View for the Android framework.

This project is aimed at providing a simple API to build SQLite query statements. This library does nothing but build statements; it's not an ORM. The API syntax is inspired from the jOOQ library.

An android TextView that supports highlighting parts or all of the text contained in it.

It is a custom implementation of nested timeline view using RecyclerView.

A drop-in custom layout manager for Android RecyclerViews to layout a grid of photos while respecting their aspect ratios.

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