AgendaCalendarView icon indicating copy to clipboard operation
AgendaCalendarView copied to clipboard

How do I import? Please HELP!

Open utsahk opened this issue 6 years ago • 1 comments

Hi,

Im new to coding, and I wanted to import this into my project and use that as my base. But when I do all the stuff on the main page nothing works. Here is my code if it matters.

`import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.os.Bundle;

import com.rilixtech.agendacalendarview.AgendaCalendarView; import com.rilixtech.agendacalendarview.agenda.AgendaAdapter; import com.rilixtech.agendacalendarview.agenda.AgendaView; import com.rilixtech.agendacalendarview.calendar.CalendarView; import com.rilixtech.agendacalendarview.models.BaseCalendarEvent; import com.rilixtech.agendacalendarview.models.CalendarEvent; import com.rilixtech.agendacalendarview.models.DayItem; import com.rilixtech.agendacalendarview.models.IDayItem; import com.rilixtech.agendacalendarview.models.IWeekItem; import com.rilixtech.agendacalendarview.models.WeekItem; import com.rilixtech.agendacalendarview.render.DefaultEventRenderer; import com.rilixtech.agendacalendarview.render.EventRenderer; import com.rilixtech.agendacalendarview.event.DayClickedEvent; import com.rilixtech.agendacalendarview.event.FetchedEvent; import com.rilixtech.agendacalendarview.utils.ListViewScrollTracker; import com.rilixtech.agendacalendarview.widgets.FloatingActionButton;

import java.util.ArrayList; import java.util.Calendar; import java.util.List; import java.util.Locale;

public class MainActivity extends AppCompatActivity {

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

// minimum and maximum date of our calendar
// 2 month behind, one year ahead, example: March 2015 <-> May 2015 <-> May 2016
Calendar minDate = Calendar.getInstance();
Calendar maxDate = Calendar.getInstance();

minDate.add(Calendar.MONTH, -2);
minDate.set(Calendar.DAY_OF_MONTH, 1);
maxDate.add(Calendar.YEAR, 1);

List<CalendarEvent> eventList = new ArrayList<>();
mockList(eventList);

mAgendaCalendarView.init(eventList, minDate, maxDate, Locale.getDefault(), this);

} private void mockList(List<CalendarEvent> eventList) { Calendar startTime1 = Calendar.getInstance(); Calendar endTime1 = Calendar.getInstance(); endTime1.add(Calendar.MONTH, 1); BaseCalendarEvent event1 = new BaseCalendarEvent("Thibault travels in Iceland", "A wonderful journey!", "Iceland", ContextCompat.getColor(this, R.color.colorAccent), startTime1, endTime1, true); eventList.add(event1);

Calendar startTime2 = Calendar.getInstance();
startTime2.add(Calendar.DAY_OF_YEAR, 1);
Calendar endTime2 = Calendar.getInstance();
endTime2.add(Calendar.DAY_OF_YEAR, 3);
BaseCalendarEvent event2 = new BaseCalendarEvent("Visit to Dalvík", "A beautiful small town", "Dalvík",
        ContextCompat.getColor(this, R.color.colorAccent), startTime2, endTime2, true);
eventList.add(event2);

} } '

utsahk avatar May 20 '18 04:05 utsahk

You should call enableCalenderView after init. mAgendaCalendarView.enableCalenderView(true);

farhanmunir50 avatar May 20 '18 05:05 farhanmunir50