Skip to content

Commit 679deb0

Browse files
committed
(Calendar) Support calendar week start & calendar weeks #79 #49
1 parent 9ea7c26 commit 679deb0

File tree

215 files changed

+891
-110
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

215 files changed

+891
-110
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,26 @@ Module <code>calendar</code> ‎‎ | ‎‎ <a href="https://maxkeppeler.github
125125
<td width="25%"> </td>
126126
<td width="25%"> </td>
127127
</tr>
128+
<tr>
129+
<td width="25%"> <a style="text-align: center" href="https://github.com/maxkeppeler/sheets-compose-dialogs/blob/main/app/src/main/java/com/mk/sheets/compose/samples/CalendarSample4.kt" title="Code">CalendarSample4</a>
130+
</br>
131+
<img src="docs/res/sheets/calendar/light/calendar_sample_4.png" /></td>
132+
<td width="25%"> <a href="https://github.com/maxkeppeler/sheets-compose-dialogs/blob/main/app/src/main/java/com/mk/sheets/compose/samples/CalendarSample4.kt" title="Code">CalendarSample4</a>
133+
</br>
134+
<img src="docs/res/sheets/calendar/dark/calendar_sample_4.png" /></td>
135+
<td width="25%"> </td>
136+
<td width="25%"> </td>
137+
</tr>
138+
<tr>
139+
<td width="25%"> <a style="text-align: center" href="https://github.com/maxkeppeler/sheets-compose-dialogs/blob/main/app/src/main/java/com/mk/sheets/compose/samples/CalendarSample5.kt" title="Code">CalendarSample5</a>
140+
</br>
141+
<img src="docs/res/sheets/calendar/light/calendar_sample_5.png" /></td>
142+
<td width="25%"> <a href="https://github.com/maxkeppeler/sheets-compose-dialogs/blob/main/app/src/main/java/com/mk/sheets/compose/samples/CalendarSample5.kt" title="Code">CalendarSample5</a>
143+
</br>
144+
<img src="docs/res/sheets/calendar/dark/calendar_sample_5.png" /></td>
145+
<td width="25%"> </td>
146+
<td width="25%"> </td>
147+
</tr>
128148
</table>
129149
</br>
130150

app/src/main/java/com/mk/sheets/compose/ShowcaseDialogSamplesScreen.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ import com.mk.sheets.compose.models.UseCaseType
5050
import com.mk.sheets.compose.samples.CalendarSample1
5151
import com.mk.sheets.compose.samples.CalendarSample2
5252
import com.mk.sheets.compose.samples.CalendarSample3
53+
import com.mk.sheets.compose.samples.CalendarSample4
54+
import com.mk.sheets.compose.samples.CalendarSample5
5355
import com.mk.sheets.compose.samples.ClockSample1
5456
import com.mk.sheets.compose.samples.ClockSample2
5557
import com.mk.sheets.compose.samples.ColorSample1
@@ -129,6 +131,8 @@ fun ShowcaseDialogSamples(
129131
Sample.CALENDAR_SAMPLE_1 -> CalendarSample1(onResetSheet)
130132
Sample.CALENDAR_SAMPLE_2 -> CalendarSample2(onResetSheet)
131133
Sample.CALENDAR_SAMPLE_3 -> CalendarSample3(onResetSheet)
134+
Sample.CALENDAR_SAMPLE_4 -> CalendarSample4(onResetSheet)
135+
Sample.CALENDAR_SAMPLE_5 -> CalendarSample5(onResetSheet)
132136

133137
Sample.CLOCK_SAMPLE_1 -> ClockSample1(onReset)
134138
Sample.CLOCK_SAMPLE_2 -> ClockSample2(onReset)

app/src/main/java/com/mk/sheets/compose/models/Sample.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,21 @@ enum class Sample(
106106
"Disabled future with boundary"
107107
),
108108

109+
CALENDAR_SAMPLE_4(
110+
UseCaseType.CALENDAR,
111+
"Select date",
112+
"Month-style",
113+
"Display Calendar Weeks"
114+
),
115+
116+
CALENDAR_SAMPLE_5(
117+
UseCaseType.CALENDAR,
118+
"Select date",
119+
"Week-style",
120+
"Display Calendar Weeks"
121+
),
122+
123+
109124
CLOCK_SAMPLE_1(
110125
UseCaseType.CLOCK,
111126
"Hours and minutes selection",
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright (C) 2022-2023. Maximilian Keppeler (https://www.maxkeppeler.com)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
@file:OptIn(ExperimentalMaterial3Api::class)
17+
18+
package com.mk.sheets.compose.samples
19+
20+
import androidx.compose.material3.ExperimentalMaterial3Api
21+
import androidx.compose.runtime.Composable
22+
import androidx.compose.runtime.mutableStateOf
23+
import androidx.compose.runtime.remember
24+
import com.maxkeppeker.sheets.core.models.base.UseCaseState
25+
import com.maxkeppeker.sheets.core.models.base.rememberUseCaseState
26+
import com.maxkeppeler.sheets.calendar.CalendarDialog
27+
import com.maxkeppeler.sheets.calendar.models.CalendarConfig
28+
import com.maxkeppeler.sheets.calendar.models.CalendarSelection
29+
import com.maxkeppeler.sheets.calendar.models.CalendarStyle
30+
import java.time.LocalDate
31+
32+
@Composable
33+
internal fun CalendarSample4(closeSelection: UseCaseState.() -> Unit) {
34+
35+
val selectedDates = remember { mutableStateOf<List<LocalDate>>(listOf()) }
36+
CalendarDialog(
37+
state = rememberUseCaseState(visible = true, onCloseRequest = { closeSelection() }),
38+
config = CalendarConfig(
39+
yearSelection = true,
40+
monthSelection = true,
41+
displayCalendarWeeks = true,
42+
style = CalendarStyle.MONTH,
43+
),
44+
selection = CalendarSelection.Dates { newDates ->
45+
selectedDates.value = newDates
46+
},
47+
)
48+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright (C) 2022-2023. Maximilian Keppeler (https://www.maxkeppeler.com)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
@file:OptIn(ExperimentalMaterial3Api::class)
17+
18+
package com.mk.sheets.compose.samples
19+
20+
import androidx.compose.material3.ExperimentalMaterial3Api
21+
import androidx.compose.runtime.Composable
22+
import androidx.compose.runtime.mutableStateOf
23+
import androidx.compose.runtime.remember
24+
import com.maxkeppeker.sheets.core.models.base.UseCaseState
25+
import com.maxkeppeker.sheets.core.models.base.rememberUseCaseState
26+
import com.maxkeppeler.sheets.calendar.CalendarDialog
27+
import com.maxkeppeler.sheets.calendar.models.CalendarConfig
28+
import com.maxkeppeler.sheets.calendar.models.CalendarSelection
29+
import com.maxkeppeler.sheets.calendar.models.CalendarStyle
30+
import java.time.LocalDate
31+
32+
@Composable
33+
internal fun CalendarSample5(closeSelection: UseCaseState.() -> Unit) {
34+
35+
val selectedDates = remember { mutableStateOf<List<LocalDate>>(listOf()) }
36+
CalendarDialog(
37+
state = rememberUseCaseState(visible = true, onCloseRequest = { closeSelection() }),
38+
config = CalendarConfig(
39+
yearSelection = true,
40+
monthSelection = true,
41+
displayCalendarWeeks = true,
42+
style = CalendarStyle.WEEK,
43+
),
44+
selection = CalendarSelection.Dates { newDates ->
45+
selectedDates.value = newDates
46+
},
47+
)
48+
}

0 commit comments

Comments
 (0)