package com.mikepenz.fastadapter.app;

import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;

import com.mikepenz.fastadapter.FastAdapter;
import com.mikepenz.fastadapter.adapters.GenericItemAdapter;
import com.mikepenz.fastadapter.app.adapter.FastScrollIndicatorAdapter;
import com.mikepenz.fastadapter.app.generic.GenericIconItem;
import com.mikepenz.fastadapter.app.generic.IconModel;
import com.mikepenz.iconics.Iconics;
import com.mikepenz.iconics.typeface.ITypeface;
import com.mikepenz.itemanimators.SlideDownAlphaAnimator;
import com.mikepenz.materialize.MaterializeBuilder;
import com.turingtechnologies.materialscrollbar.CustomIndicator;
import com.turingtechnologies.materialscrollbar.DragScrollBar;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class GenericItemActivity extends AppCompatActivity {
    //save our FastAdapter
    private FastAdapter fastAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sample);

        //improve ui
        findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content).getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);

        // Handle Toolbar
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setTitle(R.string.sample_generic_item);

        //style our ui
        new MaterializeBuilder().withActivity(this).build();


        //create our FastAdapter which will manage everything
        fastAdapter = new FastAdapter();

        //get our recyclerView and do basic setup
        RecyclerView rv = (RecyclerView) findViewById(R.id.rv);

        //init our gridLayoutManager and configure RV
        GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 3);

        GenericItemAdapter<IconModel, GenericIconItem> itemAdapter = new GenericItemAdapter<>(GenericIconItem.class, IconModel.class);

        final FastScrollIndicatorAdapter<GenericIconItem> fastScrollIndicatorAdapter = new FastScrollIndicatorAdapter<>();
        rv.setAdapter(fastScrollIndicatorAdapter.wrap(itemAdapter.wrap(fastAdapter)));

        DragScrollBar materialScrollBar = new DragScrollBar(this, rv, true);
        materialScrollBar.setHandleColour(ContextCompat.getColor(this, R.color.colorAccent));
        materialScrollBar.setHandleOffColour(ContextCompat.getColor(this, R.color.colorAccent));
        materialScrollBar.addIndicator(new CustomIndicator(this), true);

        rv.setLayoutManager(gridLayoutManager);
        rv.setItemAnimator(new SlideDownAlphaAnimator());

@@ -2990,12 +2990,1711 @@
 nimator());%0A
+%0A        //order fonts by their name%0A        List%3CITypeface%3E mFonts = new ArrayList%3C%3E(Iconics.getRegisteredFonts(this));%0A        Collections.sort(mFonts, new Comparator%3CITypeface%3E() %7B%0A            @Override%0A            public int compare(final ITypeface object1, final ITypeface object2) %7B%0A                return object1.getFontName().compareTo(object2.getFontName());%0A            %7D%0A        %7D);%0A%0A        //add all icons of all registered Fonts to the list%0A        ArrayList%3CIconModel%3E models = new ArrayList%3C%3E();%0A        for (ITypeface font : mFonts) %7B%0A            for (String icon : font.getIcons()) %7B%0A                models.add(new IconModel(font.getIcon(icon)));%0A            %7D%0A        %7D%0A%0A        //fill with some sample data%0A        itemAdapter.addModel(models);%0A%0A        //restore selections (this has to be done after the items were added%0A        fastAdapter.withSavedInstanceState(savedInstanceState);%0A%0A        //set the back arrow in the toolbar%0A        getSupportActionBar().setDisplayHomeAsUpEnabled(true);%0A        getSupportActionBar().setHomeButtonEnabled(false);%0A    %7D%0A%0A    @Override%0A    protected void onSaveInstanceState(Bundle outState) %7B%0A        //add the values which need to be saved from the adapter to the bundel%0A        outState = fastAdapter.saveInstanceState(outState);%0A        super.onSaveInstanceState(outState);%0A    %7D%0A%0A    @Override%0A    public boolean onOptionsItemSelected(MenuItem item) %7B%0A        //handle the click on the back arrow click%0A        switch (item.getItemId()) %7B%0A            case android.R.id.home:%0A                onBackPressed();%0A                return true;%0A%0A            default:%0A                return super.onOptionsItemSelected(item);%0A        %7D%0A    %7D%0A%7D%0A

Update GenericItemActivity.java