Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature event type #32

Merged
merged 13 commits into from
Mar 20, 2022
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ data class KalendarEvent(
val date: LocalDate,
val eventName: String,
val eventDescription: String? = null,
val eventType: EventType = EventType.EVENT,
)
```

Expand All @@ -155,6 +156,7 @@ Here,
- date: The Localdate on which the event is recorded
- eventName: Pass a name for the event.
- eventDescription: Pass a description for the event.
- eventType : Pass the type of event, possible values under enum `EventType` { GOAL, REMINDER, TASK, EVENT }

If the event is marked it looks like,

Expand Down
6 changes: 2 additions & 4 deletions app/src/main/java/com/himanshoe/sample/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import com.himanshoe.kalendar.endlos.common.KalendarKonfig
import com.himanshoe.kalendar.endlos.common.data.EventType
import com.himanshoe.kalendar.endlos.common.data.KalendarEvent
import com.himanshoe.kalendar.endlos.ui.Kalendar
import java.time.LocalDate
Expand All @@ -13,10 +14,7 @@ class MainActivity : ComponentActivity() {
super.onCreate(savedInstanceState)
setContent {
Kalendar(
kalendarEvents = listOf(
KalendarEvent(LocalDate.now().plusDays(3), "Test event one", "Test one description"),
KalendarEvent(LocalDate.now().plusDays(3), "Test event two", "Test two description")
),
kalendarEvents = listOf(KalendarEvent(LocalDate.now().plusDays(3), "", "", EventType.Goal)),
kalendarKonfig = KalendarKonfig(weekCharacters = 2),
onCurrentDayClick = { date, events ->
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import java.util.Locale

/**
* [KalendarKonfig] represents the config needed for rendering calendar
* @param[yearRange] gives the min/max year range
* @param[maxYear] gives the min/max year range
* @param[weekCharacters] helps you set the number of character in Week name, default is 3
* @param[locale] helps you set the locale where default is [Locale.ENGLISH]
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,19 @@ import java.time.LocalDate
* [KalendarEvent] handles the event marked on any
* @param[date] with specific
* @param[eventName] and its
* @param[eventDescription]
* @param[eventDescription] along with it's
* @param[eventType] type
*/
data class KalendarEvent(
val date: LocalDate,
val eventName: String,
val eventDescription: String? = null,
val eventType: EventType = EventType.Event,
)

sealed class EventType {
object Goal : EventType()
object Reminder : EventType()
object Task : EventType()
object Event : EventType()
}