// Path: Calender Read Demo/app/src/main/java/example/calandersync/pojo/EventPojo.java
// public class EventPojo {
// 
//     private String title;
//     private String description;
// 
//     public String getDescription() {
//         return description;
//     }
// 
//     public void setDescription(String description) {
//         this.description = description;
//     }
// 
//     public String getTitle() {
//         return title;
//     }
// 
//     public void setTitle(String title) {
//         this.title = title;
//     }
// }
// 
// Path: Calender Read Demo/app/src/main/java/example/calandersync/utils/DividerItemDecorator.java
// public class DividerItemDecorator extends RecyclerView.ItemDecoration {
//     private Drawable mDivider;
// 
//     public DividerItemDecorator(Drawable divider){
//         mDivider = divider;
//     }
//     @Override
//     public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
//         super.getItemOffsets(outRect, view, parent, state);
// 
//         if (parent.getChildAdapterPosition(view) == 0) {
//             return;
//         }
// 
//         outRect.top = mDivider.getIntrinsicHeight();
//     }
// 
//     @Override
//     public void onDraw(Canvas canvas, RecyclerView parent, RecyclerView.State state) {
//         int dividerLeft = parent.getPaddingLeft();
//         int dividerRight = parent.getWidth() - parent.getPaddingRight();
// 
//         int childCount = parent.getChildCount();
//         for (int i = 0; i < childCount - 1; i++) {
//             View child = parent.getChildAt(i);
// 
//             RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
// 
//             int dividerTop = child.getBottom() + params.bottomMargin;
//             int dividerBottom = dividerTop + mDivider.getIntrinsicHeight();
// 
//             mDivider.setBounds(dividerLeft, dividerTop, dividerRight, dividerBottom);
//             mDivider.draw(canvas);
//         }
//     }
// }


import android.content.ContentUris;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.CalendarContract;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
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.TextView;
import java.util.ArrayList;
import java.util.Calendar;
import example.calandersync.R;
import example.calandersync.pojo.EventPojo;
import example.calandersync.utils.DividerItemDecorator;
package example.calandersync.activity;




/**
 * This activity will display how to load and display events for the given calender.
 */
public class EventListActivity extends AppCompatActivity {

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

        setRecyclerView();
    }

    private void setRecyclerView() {
        RecyclerView eventList = (RecyclerView) findViewById(R.id.event_list);
        eventList.setItemAnimator(new DefaultItemAnimator());
        eventList.setLayoutManager(new LinearLayoutManager(this));

        RecyclerView.ItemDecoration dividerItemDecoration = new DividerItemDecorator(ContextCompat.getDrawable(this, R.drawable.line_divider));
        eventList.addItemDecoration(dividerItemDecoration);

        eventList.setAdapter(new RecyclerViewAdapter(getCalenderEvents()));
    }

    private class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.MyViewHolder> {
// Path: Calender Read Demo/app/src/main/java/example/calandersync/pojo/EventPojo.java
// public class EventPojo {
// 
//     private String title;
//     private String description;
// 
//     public String getDescription() {
//         return description;
//     }
// 
//     public void setDescription(String description) {
//         this.description = description;
//     }
// 
//     public String getTitle() {
//         return title;
//     }
// 
//     public void setTitle(String title) {
//         this.title = title;
//     }
// }
// 
// Path: Calender Read Demo/app/src/main/java/example/calandersync/utils/DividerItemDecorator.java
// public class DividerItemDecorator extends RecyclerView.ItemDecoration {
//     private Drawable mDivider;
// 
//     public DividerItemDecorator(Drawable divider){
//         mDivider = divider;
//     }
//     @Override
//     public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
//         super.getItemOffsets(outRect, view, parent, state);
// 
//         if (parent.getChildAdapterPosition(view) == 0) {
//             return;
//         }
// 
//         outRect.top = mDivider.getIntrinsicHeight();
//     }
// 
//     @Override
//     public void onDraw(Canvas canvas, RecyclerView parent, RecyclerView.State state) {
//         int dividerLeft = parent.getPaddingLeft();
//         int dividerRight = parent.getWidth() - parent.getPaddingRight();
// 
//         int childCount = parent.getChildCount();
//         for (int i = 0; i < childCount - 1; i++) {
//             View child = parent.getChildAt(i);
// 
//             RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
// 
//             int dividerTop = child.getBottom() + params.bottomMargin;
//             int dividerBottom = dividerTop + mDivider.getIntrinsicHeight();
// 
//             mDivider.setBounds(dividerLeft, dividerTop, dividerRight, dividerBottom);
//             mDivider.draw(canvas);
//         }
//     }
// }


// Path: Calender Read Demo/app/src/main/java/example/calandersync/activity/EventListActivity.java
import android.content.ContentUris;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.CalendarContract;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
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.TextView;
import java.util.ArrayList;
import java.util.Calendar;
import example.calandersync.R;
import example.calandersync.pojo.EventPojo;
import example.calandersync.utils.DividerItemDecorator;

package example.calandersync.activity;




/**
 * This activity will display how to load and display events for the given calender.
 */
public class EventListActivity extends AppCompatActivity {

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

        setRecyclerView();
    }

    private void setRecyclerView() {
        RecyclerView eventList = (RecyclerView) findViewById(R.id.event_list);
        eventList.setItemAnimator(new DefaultItemAnimator());
        eventList.setLayoutManager(new LinearLayoutManager(this));

        RecyclerView.ItemDecoration dividerItemDecoration = new DividerItemDecorator(ContextCompat.getDrawable(this, R.drawable.line_divider));
        eventList.addItemDecoration(dividerItemDecoration);

        eventList.setAdapter(new RecyclerViewAdapter(getCalenderEvents()));
    }

    private class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.MyViewHolder> {
        private ArrayList<EventPojo> mData;