forked from alamkanak/Android-Week-View
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Instead of having to convert one's own data classes to WeekViewEvent, the WeekViewDisplayable interface includes a toWeekViewEvent() method. The conversion can be handled in the data class and does not add boilerplate in your controlling classes. As a result, onMonthChanged() can return a list of objects that implement WeekViewDisplayable and does not require a list of WeekViewEvents.
- Loading branch information
Showing
10 changed files
with
73 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
library/src/main/java/com/alamkanak/weekview/WeekViewDisplayable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.alamkanak.weekview; | ||
|
||
/** | ||
* This interface can be implemented by classes that should be displayed in {@link WeekView}. | ||
* Instead of having to provide a list of {@link WeekViewEvent}s, you can provide a list of elements | ||
* of your class. The conversion to {@link WeekViewEvent} will happen in the background. | ||
*/ | ||
public interface WeekViewDisplayable { | ||
|
||
/** | ||
* Returns a {@link WeekViewEvent} for use in {@link WeekView}. | ||
* @return A {@link WeekViewEvent} | ||
*/ | ||
public WeekViewEvent toWeekViewEvent(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,29 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.alamkanak.weekview.sample" > | ||
package="com.alamkanak.weekview.sample"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@drawable/ic_launcher" | ||
android:label="@string/app_name" | ||
android:theme="@style/AppTheme" > | ||
android:theme="@style/AppTheme"> | ||
<activity | ||
android:name=".MainActivity" | ||
android:label="@string/app_name" > | ||
android:label="@string/app_name"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity | ||
android:name=".BasicActivity" | ||
android:label="@string/title_activity_basic" > | ||
</activity> | ||
android:label="@string/title_activity_basic" /> | ||
<activity | ||
android:name=".AsynchronousActivity" | ||
android:label="@string/title_activity_asynchronous" > | ||
</activity> | ||
android:label="@string/title_activity_asynchronous" /> | ||
</application> | ||
|
||
</manifest> | ||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters