From ec8ef3a6467f49d40d05f641820dd6ad91ffd98e Mon Sep 17 00:00:00 2001 From: Thibault Guegan Date: Thu, 26 Nov 2015 18:55:11 +0000 Subject: [PATCH] Code style and comments --- .../render/DefaultEventRenderer.java | 8 +++++++ .../render/EventRenderer.java | 3 +++ .../tibolte/sample/DrawableCalendarEvent.java | 24 ++++++++++++++----- .../tibolte/sample/DrawableEventRenderer.java | 5 ++++ 4 files changed, 34 insertions(+), 6 deletions(-) diff --git a/agendacalendarview/src/main/java/com/github/tibolte/agendacalendarview/render/DefaultEventRenderer.java b/agendacalendarview/src/main/java/com/github/tibolte/agendacalendarview/render/DefaultEventRenderer.java index 75a667b..4e73459 100644 --- a/agendacalendarview/src/main/java/com/github/tibolte/agendacalendarview/render/DefaultEventRenderer.java +++ b/agendacalendarview/src/main/java/com/github/tibolte/agendacalendarview/render/DefaultEventRenderer.java @@ -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 { + + // region class - EventRenderer + @Override public void render(@NonNull View view, @NonNull BaseCalendarEvent event) { TextView txtTitle = (TextView) view.findViewById(R.id.view_agenda_event_title); @@ -41,4 +47,6 @@ public void render(@NonNull View view, @NonNull BaseCalendarEvent event) { public int getEventLayout() { return R.layout.view_agenda_event; } + + // endregion } diff --git a/agendacalendarview/src/main/java/com/github/tibolte/agendacalendarview/render/EventRenderer.java b/agendacalendarview/src/main/java/com/github/tibolte/agendacalendarview/render/EventRenderer.java index ff4a151..a696ae9 100644 --- a/agendacalendarview/src/main/java/com/github/tibolte/agendacalendarview/render/EventRenderer.java +++ b/agendacalendarview/src/main/java/com/github/tibolte/agendacalendarview/render/EventRenderer.java @@ -7,6 +7,9 @@ import java.lang.reflect.ParameterizedType; +/** + * Base class for helping layout rendering + */ public abstract class EventRenderer { public abstract void render(final View view, final T event); diff --git a/app/src/main/java/com/github/tibolte/sample/DrawableCalendarEvent.java b/app/src/main/java/com/github/tibolte/sample/DrawableCalendarEvent.java index e3a8803..8ef775a 100644 --- a/app/src/main/java/com/github/tibolte/sample/DrawableCalendarEvent.java +++ b/app/src/main/java/com/github/tibolte/sample/DrawableCalendarEvent.java @@ -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 } diff --git a/app/src/main/java/com/github/tibolte/sample/DrawableEventRenderer.java b/app/src/main/java/com/github/tibolte/sample/DrawableEventRenderer.java index 4628190..cc77eba 100644 --- a/app/src/main/java/com/github/tibolte/sample/DrawableEventRenderer.java +++ b/app/src/main/java/com/github/tibolte/sample/DrawableEventRenderer.java @@ -8,6 +8,9 @@ import com.github.tibolte.agendacalendarview.render.EventRenderer; public class DrawableEventRenderer extends EventRenderer { + + // region Class - EventRenderer + @Override public void render(View view, DrawableCalendarEvent event) { ImageView imageView = (ImageView) view.findViewById(R.id.view_agenda_event_image); @@ -49,4 +52,6 @@ public int getEventLayout() { public Class getRenderType() { return DrawableCalendarEvent.class; } + + // endregion }