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

KISS Tools for Android.

Basic utils classes for android development: BitmapUtil, BundleUtil, ClipboardUtil, DeviceUtil, DrawableUtil, FileUtil, JSONUtil, KeyboardUtil, LogUtil, MediaUtil, NetworkUtil, ResourceUtil, ZipUtil, etc.

Bounce Scroller is a library for Android platform that provides iOS-like bounce scroller effect and can also be used as pull-to-refresh.

Features:

  • Support all ViewGroups and almost all Views (except self-scrollable TextView).
  • Bounce-effect can be added to header and footer.
  • No need to specify custom wrappers.

Couchbase-Lite-Android is a lightweight embedded NoSQL database engine for Android with the built-in ability to sync to Couchbase Server on the backend.

It is the Android port of Couchbase Lite iOS.

Android Widget to show circular counters.

Grocery Sync for Couchbase Lite Android.

An example app that uses the Couchbase Lite Android mobile database framework.

Easy Rating Dialog provides a simple way to display an alert dialog for rating app.

Default conditions to show:

  • User opened the app more than 5 times
  • User opened the app after 7 days of first opening.

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