Back to project page Joetz-Android-V2.
The source code is released under:
GNU General Public License
If you think the Android project Joetz-Android-V2 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.example.jens.myapplication.activities; /* w ww . j a v a2 s .co m*/ import android.app.Activity; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import com.example.jens.myapplication.R; import com.example.jens.myapplication.util.DateTimeStringConverter; import java.util.List; /** * Created by Sam on 4/12/2014. */ public class JoetzActivitiesAdapter extends RecyclerView.Adapter<JoetzActivitiesAdapter.ViewHolder> { private List<JoetzActivity> activities; public JoetzActivitiesAdapter(List<JoetzActivity> activities){ this.activities = activities; } @Override public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { return new ViewHolder(LayoutInflater.from(viewGroup.getContext()).inflate( R.layout.item_joetzactivity, viewGroup, false)); } @Override public void onBindViewHolder(ViewHolder viewHolder, int i) { final JoetzActivity activity = activities.get(i); viewHolder.txtTitle.setText(activity.getTitle()); viewHolder.txtDob.setText(DateTimeStringConverter.getSimpleDate(activity.getStartDate()) + " - " + DateTimeStringConverter.getSimpleDate(activity.getEndDate())); viewHolder.txtLocation.setText(activity.getLocation()); viewHolder.txtSummary.setText(activity.getSummary()); } @Override public int getItemCount() { return activities == null ? 0 : activities.size(); } public static class ViewHolder extends RecyclerView.ViewHolder{ private TextView txtTitle; private TextView txtDob; private TextView txtLocation; private TextView txtSummary; public ViewHolder(View v) { super(v); txtTitle = (TextView) v.findViewById(R.id.txtTitle); txtDob = (TextView) v.findViewById(R.id.txtDateOfBirth); txtLocation = (TextView) v.findViewById(R.id.txtLocation); txtSummary = (TextView) v.findViewById(R.id.txtSummary); } } }