Android Open Source - AndroidStudioSandbox Recycler Adapter






From Project

Back to project page AndroidStudioSandbox.

License

The source code is released under:

Apache License

If you think the Android project AndroidStudioSandbox listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package at.mg.androidstudiosandbox.adapters;
//  w  w  w . j  a va2  s.  co  m
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

import at.mg.androidstudiosandbox.R;
import at.mg.androidstudiosandbox.things.RecyclerDataObject;
import at.mg.androidstudiosandbox.things.RecyclerListViewHolder;

/**
 * Adapter for the RecyclerView
 * <p/>
 * Created by Markus on 12.12.2014.
 */
public class RecyclerAdapter extends RecyclerView.Adapter<RecyclerListViewHolder> {

    private List<RecyclerDataObject> list;

    public RecyclerAdapter(List<RecyclerDataObject> list) {
        this.list = list;
    }

    @Override
    public RecyclerListViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
        View entry = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.recycler_entry, viewGroup, false);
        return new RecyclerListViewHolder(entry);
    }

    @Override
    public void onBindViewHolder(RecyclerListViewHolder recyclerListViewHolder, int position) {
        RecyclerDataObject object = list.get(position);
        recyclerListViewHolder.title.setText(object.title);
        recyclerListViewHolder.desc.setText(object.description);
        recyclerListViewHolder.date.setText(object.date);

    }

    @Override
    public int getItemCount() {
        return list != null ? list.size() : 0;
    }
}




Java Source Code List

at.mg.androidstudiosandbox.AndroidStudioShortcuts.java
at.mg.androidstudiosandbox.ApplicationTest.java
at.mg.androidstudiosandbox.WearHomeActivity.java
at.mg.androidstudiosandbox.activities.HomeActivity.java
at.mg.androidstudiosandbox.activities.ToolbarActivity.java
at.mg.androidstudiosandbox.activities.VoiceSearchableActivity.java
at.mg.androidstudiosandbox.adapters.RecyclerAdapter.java
at.mg.androidstudiosandbox.fragments.NavigationDrawerFragment.java
at.mg.androidstudiosandbox.fragments.PlaceholderFragment.java
at.mg.androidstudiosandbox.fragments.RecyclerFragment.java
at.mg.androidstudiosandbox.things.RecyclerDataObject.java
at.mg.androidstudiosandbox.things.RecyclerListViewHolder.java