RecyclerAdapter-Java


Source link: https://github.com/MaximeJallu/RecyclerAdapter-Java

Status

Generic-Adapter:

This tool allows you to no longer worry about adapters. Now you will only create your ViewHolder. Communication management between your Views and your ViewHolders is possible. Creating sections is now very easily. Enjoy.

Download

buildtool used is 27 use { exclude group: 'com.android.support' } only if you have problems

dependencies {

  ...
  implementation ('com.github.maximejallu:adapters:{
version
}
')
  ... 
}

Decorators for : ButterKnife - Picasso - Glide ...

public class SampleApplication extends Application {

@Override
  public void onCreate() {

super.onCreate();

 RecyclerAdapter.Helper()

  .append(new InitViewHolderDecorator() {

@Override

public void initBinding(Object target, View view) {

 ButterKnife.bind(target, view);

}

  
}
)

  .append(new ShowPictureDecorator() {

@Override

public void showPicture(ImageView picture, String url) {

 //use Picasso, Glide... Other

}

  
}
)

  .init();

  
}
 
}

RecyclerAdapter (Easy sample method)

CustomerViewHolder.class :

@BindLayoutRes(R.layout.{
name_of_your_layout
}
) public class CustomerViewHolder extends RecyclerViewHolder<Customer> {

  TextView mText;
  CustomerViewHolder(View view){

super(view);

mText = view.findViewById(R.id.text1);

  
}

 void onBind(Customer item){

//todo implements
  
}
 
}

MainFragment.class

public class MainFragment extends Fragment {
 ... private RecyclerAdapter<Customer> mAdapter;  void onCreate(...){

  mAdapter = new RecyclerAdapter(customerList, CustomerViewHolder.class);
 
}
 ... 
}

RecyclerAdapter (Multi cell method)

  • create your necessary ViewHolder (here only one example)
@BindLayoutRes(R.layout.{
name_of_your_layout1
}
) public class CustomerViewHolder1 extends RecyclerViewHolder<Customer> {

  CustomerViewHolder1(View view){

super(view);

  
}

 void onBind(Customer item){

//todo implements
  
}
 
}
  //# Solution 1 : the object determines are own item view type  public class Customer implements IViewType {

 public static final int TYPE_ON_LINE = 0; /*default*/
 public static final int TYPE_STORE = 1;
 public static final int TYPE_OTHER = 2;
 private int mType;

  @Override
  public int getItemViewType() {

return mType;
  
}
 
}
  public class MyFragment extends Fragment {

 public void onCreateView(){

private RecyclerAdapter<Customer> mAdapter;

mAdapter = new RecyclerAdapter(customerList, CustomerViewHolder1.class/*type par default*/);

mAdapter.putViewType(Customer.TYPE_STORE, CustomerViewHolder2.class, null /*callback*/);

mAdapter.putViewType(Customer.TYPE_OTHER, CustomerViewHolder3.class, true /*add default callback*/);

//# Solution 2 : We give the strategy of the IViewType to our adapt it

mAdapter.setItemViewType(item -> {

 //todo stategy type of item

 return 0;

}
);

mRecyclerView.setAdapter(adapter);

  
}
  
}

SectionDecorator (Recycler with LinearLayout or GridLayout)

precondition : create your RecyclerViewHolder Sample :

mRecylerView.setLayoutManager(...);
 /*create Adapter*/ RecyclerAdapter<Customer> baseAdapter = new RecyclerAdapter<>(...);
 /*create sectioned adapter. the Adapter type can be RecyclerView.Adapter*/ SectionedAdapter<String, RecyclerAdapter> adapter = new SectionedAdapter<>(SectionViewHolder.class, baseAdapter);
 /*add your sections*/ sectionAdapter.addSection(0/*position*/, "Title Section 1");
 /*attach Adapter to RecyclerView*/ mRecylerView.setAdapter(sectionAdapter);

ItemDecoration

mRecyclerView.addItemDecoration(new FooterDecoration(getContext(), this, R.layout.item_space_80));

Resources

The simplest navigation library for Android.

Main Features:

  • Navigation is as simple as calling goTo(screen)
  • You get full control of the backstack
  • Transitions are automatically handled for you

Simple utility for handling Marker, Polyline and Polygon in Google Maps with multiple map style.

A slim & clean & typeable Adapter without VIEWHOLDER.

Features:

  • No ViewHolder any more
  • No Reflection
  • Fluent & simple API
  • Multi-typeable adapter
  • Support Kotlin
  • Support Simple DiffUtils

A camera view to capture long image merged from small captured images as it is in Shoparoo app!

This library uses CameraView from Google as the backbone of camera functionality and adds auto-support of creating long or wide images from multiple images.

Features:

  • Built-in Camera UI and activity
  • Built-in Image Viewer with pinch-fling gestures for zoom/move/rotate etc.
  • TouchImageView with gestures support for zoom/move/rotate etc.
  • Built-in permission handling for Camera and Storage
  • Horizontal or Vertical image merging

Android Runtime Permission is an easy way to handle single or multiple permission very easily.

In-App Android Debugging Tool With Enhanced Logging, Networking Info, Crash reporting And More.

The debugger tool for Android developer. Display logs, network request, while using the app. Easy accessible with its bubble head button :radio_button:. Easy to integrate in any apps, to handle development or testing apps easier. First version, there is plenty of room for improvement.

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