Skip to content

Commit

Permalink
Code style and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Tibolte committed Nov 26, 2015
1 parent 8a59410 commit ec8ef3a
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@
import com.github.tibolte.agendacalendarview.R;
import com.github.tibolte.agendacalendarview.models.BaseCalendarEvent;

/**
* Class helping to inflate our default layout in the AgendaAdapter
*/
public class DefaultEventRenderer extends EventRenderer<BaseCalendarEvent> {

// region class - EventRenderer

@Override
public void render(@NonNull View view, @NonNull BaseCalendarEvent event) {
TextView txtTitle = (TextView) view.findViewById(R.id.view_agenda_event_title);
Expand Down Expand Up @@ -41,4 +47,6 @@ public void render(@NonNull View view, @NonNull BaseCalendarEvent event) {
public int getEventLayout() {
return R.layout.view_agenda_event;
}

// endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

import java.lang.reflect.ParameterizedType;

/**
* Base class for helping layout rendering
*/
public abstract class EventRenderer<T extends CalendarEvent> {
public abstract void render(final View view, final T event);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,45 @@
import java.util.Calendar;

public class DrawableCalendarEvent extends BaseCalendarEvent {
private int drawableId;
private int mDrawableId;

// region Constructors

public DrawableCalendarEvent(long id, int color, String title, String description, String location, long dateStart, long dateEnd, int allDay, String duration, int drawableId) {
super(id, color, title, description, location, dateStart, dateEnd, allDay, duration);
this.drawableId = drawableId;
this.mDrawableId = drawableId;
}

public DrawableCalendarEvent(String title, String description, String location, int color, Calendar startTime, Calendar endTime, boolean allDay, int drawableId) {
super(title, description, location, color, startTime, endTime, allDay);
this.drawableId = drawableId;
this.mDrawableId = drawableId;
}

public DrawableCalendarEvent(DrawableCalendarEvent calendarEvent) {
super(calendarEvent);
this.drawableId = calendarEvent.getDrawableId();
this.mDrawableId = calendarEvent.getDrawableId();
}

// endregion

// region Public methods

public int getDrawableId() {
return drawableId;
return mDrawableId;
}

public void setDrawableId(int drawableId) {
this.drawableId = drawableId;
this.mDrawableId = drawableId;
}

// endregion

// region Class - BaseCalendarEvent

@Override
public CalendarEvent copy() {
return new DrawableCalendarEvent(this);
}

// endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import com.github.tibolte.agendacalendarview.render.EventRenderer;

public class DrawableEventRenderer extends EventRenderer<DrawableCalendarEvent> {

// region Class - EventRenderer

@Override
public void render(View view, DrawableCalendarEvent event) {
ImageView imageView = (ImageView) view.findViewById(R.id.view_agenda_event_image);
Expand Down Expand Up @@ -49,4 +52,6 @@ public int getEventLayout() {
public Class<DrawableCalendarEvent> getRenderType() {
return DrawableCalendarEvent.class;
}

// endregion
}

0 comments on commit ec8ef3a

Please sign in to comment.