All Projects → andronicus-kim → SimplifiedRecyclerview

andronicus-kim / SimplifiedRecyclerview

Licence: MIT License
An android library to help you get rid of boiler plate code when setting up Recyclerview

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to SimplifiedRecyclerview

AccordionRecycler
Android RecyclerView Adapter with nested items & expand/contract functionality
Stars: ✭ 17 (-10.53%)
Mutual labels:  recyclerview, recyclerview-adapter
LxAdapter
RecyclerView Adapter Library
Stars: ✭ 50 (+163.16%)
Mutual labels:  recyclerview, recyclerview-adapter
App-Manager-Android
An app manager for Android written in Kotlin. View app related info, launch or uninstall apps.
Stars: ✭ 31 (+63.16%)
Mutual labels:  recyclerview, recyclerview-adapter
recyclerview-kotlin
10+ Tutorials on RecyclerView in Kotlin
Stars: ✭ 41 (+115.79%)
Mutual labels:  recyclerview, recyclerview-adapter
DiverseRecyclerAdapter
A small and yet powerful library, which greatly simplifies building lists of different items
Stars: ✭ 16 (-15.79%)
Mutual labels:  recyclerview, recyclerview-adapter
SortedListAdapter
The RecyclerView.Adapter that makes your life easy!
Stars: ✭ 48 (+152.63%)
Mutual labels:  recyclerview, recyclerview-adapter
RvClickListenerExample
Example showing the implementation of onItemClickListener & getAdapterPosition() in RecyclerView.
Stars: ✭ 22 (+15.79%)
Mutual labels:  recyclerview, recyclerview-adapter
AdapterCommands
Drop in solution to animate RecyclerView's dataset changes by using command pattern
Stars: ✭ 74 (+289.47%)
Mutual labels:  recyclerview, recyclerview-adapter
GenericRecyclerAdapter
Easiest way to use RecyclerView. Reduce boilerplate code! You don't need to write adapters for listing pages anymore!
Stars: ✭ 53 (+178.95%)
Mutual labels:  recyclerview, android-listview
ModularAdapter
The RecyclerView.Adapter that makes your life simple!
Stars: ✭ 14 (-26.32%)
Mutual labels:  recyclerview, recyclerview-adapter
slush
This library will no longer be updated 😭
Stars: ✭ 26 (+36.84%)
Mutual labels:  recyclerview, recyclerview-adapter
kandy
Sweet Android libraries written in Kotlin
Stars: ✭ 19 (+0%)
Mutual labels:  recyclerview, recyclerview-adapter
PrimeAdapter
PrimeAdapter makes working with RecyclerView easier.
Stars: ✭ 54 (+184.21%)
Mutual labels:  recyclerview, recyclerview-adapter
Statik
A simple static list information backed by RecyclerView for Android in Kotlin
Stars: ✭ 22 (+15.79%)
Mutual labels:  recyclerview, recyclerview-adapter
Recycling
A Library for make an easy and faster RecyclerView without adapter
Stars: ✭ 57 (+200%)
Mutual labels:  recyclerview, recyclerview-adapter
InfiniteScrollRecyclerView
Enables the RecyclerView to Auto scroll for indefinite time.
Stars: ✭ 49 (+157.89%)
Mutual labels:  recyclerview, recyclerview-adapter
Modular2Recycler
Modular²Recycler is a RecyclerView.Adapter that is modular squared.
Stars: ✭ 72 (+278.95%)
Mutual labels:  recyclerview, recyclerview-adapter
recyclerview-expandable
RecyclerView implementation of traex's ExpandableLayout
Stars: ✭ 70 (+268.42%)
Mutual labels:  recyclerview, recyclerview-adapter
jubako
A small API to help display rich content in a RecyclerView such as a wall of carousels
Stars: ✭ 28 (+47.37%)
Mutual labels:  recyclerview, recyclerview-adapter
SuperAdapter
A Super simple library can be used for inserting elements in between RecyclerView's elements.
Stars: ✭ 18 (-5.26%)
Mutual labels:  recyclerview, recyclerview-adapter

SimplifiedRecyclerview

Download

An android library to help you get rid of boiler plate code when setting up Recyclerview

Download

You can grab SimplifiedRecyclerview via Maven:

<dependency>
  <groupId>io.andronicus.simplifiedrecyclerview</groupId>
  <artifactId>simplifiedrecyclerview</artifactId>
  <version>1.0.4</version>
  <type>pom</type>
</dependency>

or Gradle:

dependencies {
  implementation 'io.andronicus.simplifiedrecyclerview:simplifiedrecyclerview:1.0.4'
}

Usage

To be able to initialize MyAdapter, you will need 3 arguments, the layout id of Recyclerview viewholder list item, list of items you are interested in displaying and lastly implementation of ViewHolderCallbacks to handle binding data and view holder click events.

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        RecyclerView recyclerView = findViewById(R.id.recyclerview);
        recyclerView.setLayoutManager(new LinearLayoutManager(this)); 
        List<String> strings = new ArrayList<>();
        strings.add("1");
        strings.add("2");
        strings.add("3");

        MyAdapter adapter = new MyAdapter<>(R.layout.list_item,strings,this);
        recyclerView.setAdapter(adapter);

    }

I passed *this for the 3rd argument above because MainActivity implements ViewHolderCallbacks as shown below. The first method bindDataToViews allows you to bind data to views inside ViewHolder e.g Textviews... and the last method handles click events on the View holder.

 public class MainActivity extends AppCompatActivity implements MyAdapter.ViewHolderCallbacks<String> {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        RecyclerView recyclerView = findViewById(R.id.recyclerview);
        recyclerView.setLayoutManager(new LinearLayoutManager(this)); 
        List<String> strings = new ArrayList<>();
        strings.add("1");
        strings.add("2");
        strings.add("3");
        
        MyAdapter adapter = new MyAdapter<>(R.layout.list_item,strings,this);
        recyclerView.setAdapter(adapter);
    }
    
    /*
    * Bind data to your views as you would normally do
    * in the view holder
    * */
    @Override
    public void bindDataToViews(String item, View view) {
        TextView textView = view.findViewById(R.id.tv_test);
        textView.setText(item);
    }

    /*
    * Handle click events from the view holder here
    * */
    @Override
    public void onViewHolderClick(String item,int position) {
        Toast.makeText(this, "Clicked at position" +  position, Toast.LENGTH_SHORT).show();
    }
    
    /*
    * Optionally you can turn your adapter to a field in
    * this case mAdapter and use it to get all or get one item
    * as illustrated below
    * */
    /*
    * Get all items from the Adapter
    * */
    private List<String> getAllItems(){
        return mAdapter.getAllItems();
    }

    /*
     * Get one item from the Adapter
     * */
    private String getOneItem(int position){
        return mAdapter.getItemAtPosition(position);
    }
    
    /*
     * Refresh or Update data
     * */
    private void setData(List<String> data){
        this.mAdapter.setData(data);
    }
}

With that, your recyclerview is good to go.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-feature-branch
  3. Commit your changes: git commit -am 'new awesome feature'
  4. Push to the branch: git push origin my-feature-branch
  5. Submit a pull request :D

Credits

Lead Android Engineer - Andronicus Kim(@andronicus_kim7)

License

MIT License

Copyright (c) 2018 Andronicus

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].