Skip to content

Commit dbe7525

Browse files
committed
Add comments
1 parent b68c56a commit dbe7525

File tree

5 files changed

+17
-0
lines changed

5 files changed

+17
-0
lines changed

sample/src/main/java/com/alamkanak/weekview/sample/AsynchronousActivity.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import retrofit.client.Response;
1717

1818
/**
19+
* An example of how events can be fetched from network and be displayed on the week view.
1920
* Created by Raquib-ul-Alam Kanak on 1/3/2014.
2021
* Website: http://alamkanak.github.io
2122
*/
@@ -26,6 +27,9 @@ public class AsynchronousActivity extends BaseActivity implements Callback<List<
2627

2728
@Override
2829
public List<? extends WeekViewEvent> onMonthChange(int newYear, int newMonth) {
30+
31+
// Download events from network if it hasn't been done already. To understand how events are
32+
// downloaded using retrofit, visit http://square.github.io/retrofit
2933
if (!calledNetwork) {
3034
RestAdapter retrofit = new RestAdapter.Builder()
3135
.setEndpoint("https://api.myjson.com/bins")
@@ -35,6 +39,7 @@ public List<? extends WeekViewEvent> onMonthChange(int newYear, int newMonth) {
3539
calledNetwork = true;
3640
}
3741

42+
// Return only the events that matches newYear and newMonth.
3843
List<WeekViewEvent> matchedEvents = new ArrayList<WeekViewEvent>();
3944
for (WeekViewEvent event : events) {
4045
if (eventMatches(event, newYear, newMonth)) {
@@ -44,6 +49,13 @@ public List<? extends WeekViewEvent> onMonthChange(int newYear, int newMonth) {
4449
return matchedEvents;
4550
}
4651

52+
/**
53+
* Checks if an event falls into a specific year and month.
54+
* @param event The event to check for.
55+
* @param year The year.
56+
* @param month The month.
57+
* @return True if the event matches the year and month.
58+
*/
4759
private boolean eventMatches(WeekViewEvent event, int year, int month) {
4860
return (event.getStartTime().get(Calendar.YEAR) == year && event.getStartTime().get(Calendar.MONTH) == month - 1) || (event.getEndTime().get(Calendar.YEAR) == year && event.getEndTime().get(Calendar.MONTH) == month - 1);
4961
}

sample/src/main/java/com/alamkanak/weekview/sample/BaseActivity.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
import java.util.Locale;
1919

2020
/**
21+
* This is a base activity which contains week view and all the codes necessary to initialize the
22+
* week view.
2123
* Created by Raquib-ul-Alam Kanak on 1/3/2014.
2224
* Website: http://alamkanak.github.io
2325
*/

sample/src/main/java/com/alamkanak/weekview/sample/BasicActivity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import java.util.List;
88

99
/**
10+
* A basic example of how to use week view library.
1011
* Created by Raquib-ul-Alam Kanak on 1/3/2014.
1112
* Website: http://alamkanak.github.io
1213
*/

sample/src/main/java/com/alamkanak/weekview/sample/MainActivity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88

99
/**
10+
* The launcher activity of the sample app. It contains the links to visit all the example screens.
1011
* Created by Raquib-ul-Alam Kanak on 7/21/2014.
1112
* Website: http://alamkanak.github.io
1213
*/

sample/src/main/java/com/alamkanak/weekview/sample/apiclient/Event.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import java.util.Date;
1414

1515
/**
16+
* An event model that was built for automatic serialization from json to object.
1617
* Created by Raquib-ul-Alam Kanak on 1/3/16.
1718
* Website: http://alamkanak.github.io
1819
*/

0 commit comments

Comments
 (0)