Description
This is a generic adapter developed for all the recycler views in Android. Using this library eliminates the need of creating a separate adapter for every recycler view. Please checkout the usage of the library and its benefits on the GitHub page.
KRecyclerViewAdapter alternatives and similar libraries
Based on the "SDK" category.
Alternatively, view KRecyclerViewAdapter alternatives based on common mentions on social networks and blogs.
-
Porcupine
On-device wake word detection powered by deep learning -
twitter-kit-ios
Twitter Kit is a native SDK to include Twitter content inside mobile apps. -
waterwheel.swift
The Waterwheel Swift SDK provides classes to natively connect iOS, macOS, tvOS, and watchOS applications to Drupal 7 and 8. -
algoliasearch-client-swift
⚡️ A fully-featured and blazing-fast Swift API client to interact with Algolia. -
SpotifyLogin
Swift framework for authenticating with the Spotify API -
SwiftyVK
Easy and powerful way to interact with VK API for iOS and macOS -
Swiftly Salesforce
The Swift-est way to build native mobile apps that connect to Salesforce. -
ForecastIO
A Swift library for the Forecast.io Dark Sky API -
SmartlookConsentSDK for iOS
Configurable consent SDK for iOS -
Spartan
An Elegant Spotify Web API Library Written in Swift for iOS and macOS -
RandomUserSwift
👤 Framework to Generate Random Users - An Unofficial Swift SDK for randomuser.me -
BigBoard
An Elegant Financial Markets Library Written in Swift -
JamfKit
A Jamf Classic communication framework written in Swift -
ARKKit
ARK Ecosystem Cryptocurrency API Framework for iOS & macOS, written purely in Swift 4.0. -
PPEventRegistryAPI
Swift 3 framework for accessing data in Event Registry (http://eventregistry.org/) -
PerfectSlackAPIClient
A Slack API Client for the Perfect Server-Side Swift Framework
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of KRecyclerViewAdapter or a related project?
README
KRecyclerViewAdapter
A generic recyclerview adapter for all your recycler views.
No need to create a custom adapter for every recyclerview.
Dependency:
Add the following in your root build.gradle at the end of repositories:
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
Add the dependency in your app level gradle:
implementation 'com.github.KalpeshTalkar:KRecyclerViewAdapter:1.0.0'
Usage:
Extend your holder from KRecyclerViewHolder
Refer the sample code below:
public class MyHolder extends KRecyclerViewHolder {
private TextView titleLabel, descLabel;
public MyHolder(View itemView) {
super(itemView);
titleLabel = (TextView) itemView.findViewById(R.id.titleLabel);
descLabel = (TextView) itemView.findViewById(R.id.descLabel);
}
@Override
protected void setSelected(@NonNull Context context, boolean selected) {
super.setSelected(context, selected);
// This method is called whenever the holder is selected/unselected.
if (selected) {
// Selected
} else {
// Unselected
}
}
@Override
protected void setData(@NonNull Context context, @NonNull Object itemObject) {
super.setData(context, itemObject);
// This method is called automatically by the adapter.
// override this method and set your data here...
// Check the type of itemObject
if (itemObject instanceof MyObject) {
MyObject myObject = (MyObject)itemObject;
titleLabel.setText(myObject.title);
descLabel.setText(myObject.description);
}
}
}
Set your adapter (Single View Type)
KRecyclerViewAdapter adapter = new KRecyclerViewAdapter(this, YOUR_ARRAY, new KRecyclerViewHolderCallBack() {
@Override
public KRecyclerViewHolder onCreateViewHolder(@NonNull ViewGroup parent) {
View layoutView = LayoutInflater.from(parent.getContext()).inflate(R.layout.simple_item, parent, false);
return new MyHolder(layoutView);
}
@Override
public void onHolderDisplayed(@NonNull KRecyclerViewHolder holder, int position) {
Log.i("onHolderDisplayed", "Holder Displayed At: " + position);
}
}, new KRecyclerViewItemClickListener() {
@Override
public void onRecyclerItemClicked(@NonNull KRecyclerViewHolder holder, @NonNull Object itemObject, int itemPosition) {
Toast.makeText(MainActivity.this, "Clicked position " + itemPosition, Toast.LENGTH_SHORT).show();
}
});
YOUR_RECYCLER_VIEW.setAdapter(adapter);
Other properties
adapter.allowsSingleSelection = true; // Enables single selection
adapter.allowsMultipleSelection = true; // Enables multiple selection
adapter.deselectItemOnClickIfSelected = true; // Deselects the item if already selected.
adapter.getSelectedIndexes(); // Get list of selected item positions
Set your adapter (Multiple View Type)
KRecyclerViewAdapter adapter = new KRecyclerViewAdapter(this, YOUR_ARRAY, new KRecyclerViewHolderViewTypeCallBack() {
@Override
public int recyclerItemViewType(int position, @NonNull Object itemObject) {
if (position % 2 == 0) {
return 1;
} else {
return 2;
}
}
@Override
public KRecyclerViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
if (viewType == 1) {
View layoutView = LayoutInflater.from(parent.getContext()).inflate(R.layout.simple_item, null);
return new SimpleHolder(layoutView);
} else {
View layoutView = LayoutInflater.from(parent.getContext()).inflate(R.layout.another_item, null);
return new AnotherHolder(layoutView);
}
}
@Override
public void onHolderDisplayed(@NonNull KRecyclerViewHolder holder, int position) {
Log.i("onHolderDisplayed", "Holder Displayed At: " + position);
}
}, new KRecyclerViewItemClickListener() {
@Override
public void onRecyclerItemClicked(@NonNull KRecyclerViewHolder holder, @NonNull Object itemObject, int itemPosition) {
Toast.makeText(MainActivity.this, "Clicked position " + itemPosition, Toast.LENGTH_SHORT).show();
}
});
YOUR_RECYCLER_VIEW.setAdapter(adapter);
*Note that all licence references and agreements mentioned in the KRecyclerViewAdapter README section above
are relevant to that project's source code only.