Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Baseadapter | 4,646 | 2 years ago | 112 | apache-2.0 | Java | |||||
Android 万能的Adapter for ListView,RecyclerView,GridView等,支持多种Item类型的情况。 | ||||||||||
Flipviewpager.draco | 1,845 | 4 years ago | 6 | Java | ||||||
This project aims to provide a working page flip implementation for usage in ListView. | ||||||||||
Asymmetricgridview | 1,724 | 36 | 5 years ago | 3 | July 01, 2015 | 33 | mit | Java | ||
Android ListView that mimics a GridView with asymmetric items. Supports items with row span and column span | ||||||||||
Renderers | 1,212 | 88 | 7 | 2 years ago | 22 | May 20, 2020 | 2 | apache-2.0 | Java | |
Renderers is an Android library created to avoid all the boilerplate needed to use a RecyclerView/ListView with adapters. | ||||||||||
Multichoiceadapter | 865 | 5 | 2 | 9 years ago | 11 | February 25, 2014 | 11 | apache-2.0 | Java | |
Android - A ListView adapter with support for multiple choice modal selection | ||||||||||
Pinnedheaderlistview | 676 | 8 years ago | 25 | Java | ||||||
A ListView with pinned section headers for Android | ||||||||||
Superadapter | 636 | 6 years ago | Java | |||||||
[Deprecated]. 🚀 Adapter(BaseAdapter, RecyclerView.Adapter) wrapper for Android. 一个Adapter同时适用RecyclerView、ListView、GridView等。 | ||||||||||
Android Arsenal.com | 532 | 3 years ago | 2 | HTML | ||||||
Source to android-arsenal.herokuapp.com | ||||||||||
Android_5.0_viewdemo | 481 | 4 years ago | 5 | Java | ||||||
一些基于 Android 5.0/6.0/N 新特性的小案例 | ||||||||||
Verticalbannerview | 436 | 7 years ago | Java | |||||||
a vertical banner view in android.you can find it in 淘宝app、京东app... |
allprojects {
repositories {
// ...
maven { url "https://jitpack.io" }
}
}
implementation "com.github.twiceyuan.CommonAdapter:library:$latest_version"
implementation "com.github.twiceyuan.CommonAdapter:kotlin-extension:$latest_version"
// bind layout id
@LayoutId(R.layout.item_person)
public class PersonHolder extends CommonHolder<Person> {
// bind View id
@ViewId(R.id.name) TextView name;
@ViewId(R.id.email) TextView email;
// bind data
@Override public void bindData(Person person) {
name.setText(person.name);
email.setText(person.email);
}
}
Create a common adapter and call setAdapter method of list view or recycler view.
RecyclerView Adapter
// build adapter
CommonAdapter<Person, PersonHolder> recyclerAdapter = new CommonAdapter<>(this, PersonHolder.class);
// set adapter
mRecyclerView.setAdapter(recyclerAdapter);
ListView Adapter
// build adapter
CommonListAdapter<Person, PersonHolder> listAdapter = new CommonListAdapter<>(this, PersonHolder.class);
mListView.setAdapter(listAdapter);
Setup listener (by holder)
recyclerAdapter.setOnBindListener((position, person, holder) -> {
// holder is used to bind event listener
holder.name.setOnClickListener((v) -> toast(person.name));
holder.email.setOnClickListener((v) -> toast(person.email));
});
-keepattributes *Annotation*
-keepclassmembers class * extends com.twiceyuan.commonadapter.library.holder.CommonHolder {
public <init>(...);
}
Copyright 2016 twiceYuan.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.