-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(All) Add popup view type for each use-case
- Loading branch information
1 parent
d8e374a
commit a404ed2
Showing
18 changed files
with
1,012 additions
and
45 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
66 changes: 66 additions & 0 deletions
66
calendar/src/main/java/com/maxkeppeler/sheets/calendar/CalendarPopup.kt
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,66 @@ | ||
/* | ||
* Copyright (C) 2022-2023. Maximilian Keppeler (https://www.maxkeppeler.com) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http:https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
@file:OptIn(ExperimentalMaterial3Api::class) | ||
|
||
package com.maxkeppeler.sheets.calendar | ||
|
||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.unit.IntOffset | ||
import androidx.compose.ui.window.PopupProperties | ||
import com.maxkeppeker.sheets.core.models.base.Header | ||
import com.maxkeppeker.sheets.core.models.base.UseCaseState | ||
import com.maxkeppeker.sheets.core.views.base.PopupBase | ||
import com.maxkeppeler.sheets.calendar.models.CalendarConfig | ||
import com.maxkeppeler.sheets.calendar.models.CalendarSelection | ||
|
||
/** | ||
* Calendar popup for the use-case to select a date or period in a typical calendar-view. | ||
* @param state The state of the sheet. | ||
* @param selection The selection configuration for the popup. | ||
* @param config The general configuration for the popup. | ||
* @param header The header to be displayed at the top of the popup. | ||
* @param alignment The alignment of the popup. | ||
* @param offset The offset of the popup. | ||
* @param properties PopupProperties for further customization of this popup's behavior. | ||
*/ | ||
@ExperimentalMaterial3Api | ||
@Composable | ||
fun CalendarPopup( | ||
state: UseCaseState, | ||
selection: CalendarSelection, | ||
config: CalendarConfig = CalendarConfig(), | ||
header: Header? = null, | ||
alignment: Alignment = Alignment.TopStart, | ||
offset: IntOffset = IntOffset(0, 0), | ||
properties: PopupProperties = PopupProperties(), | ||
) { | ||
|
||
PopupBase( | ||
state = state, | ||
properties = properties, | ||
alignment = alignment, | ||
offset = offset | ||
) { | ||
CalendarView( | ||
useCaseState = state, | ||
selection = selection, | ||
config = config, | ||
header = header, | ||
) | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
clock/src/main/java/com/maxkeppeler/sheets/clock/ClockPopup.kt
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,66 @@ | ||
/* | ||
* Copyright (C) 2022-2023. Maximilian Keppeler (https://www.maxkeppeler.com) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http:https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
@file:OptIn(ExperimentalMaterial3Api::class) | ||
|
||
package com.maxkeppeler.sheets.clock | ||
|
||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.unit.IntOffset | ||
import androidx.compose.ui.window.PopupProperties | ||
import com.maxkeppeker.sheets.core.models.base.Header | ||
import com.maxkeppeker.sheets.core.models.base.UseCaseState | ||
import com.maxkeppeker.sheets.core.views.base.PopupBase | ||
import com.maxkeppeler.sheets.clock.models.ClockConfig | ||
import com.maxkeppeler.sheets.clock.models.ClockSelection | ||
|
||
/** | ||
* Clock popup for the use-case to to select a clock time. | ||
* @param state The state of the sheet. | ||
* @param selection The selection configuration for the popup. | ||
* @param config The general configuration for the popup. | ||
* @param header The header to be displayed at the top of the popup. | ||
* @param alignment The alignment of the popup. | ||
* @param offset The offset of the popup. | ||
* @param properties PopupProperties for further customization of this popup's behavior. | ||
*/ | ||
@ExperimentalMaterial3Api | ||
@Composable | ||
fun ClockPopup( | ||
state: UseCaseState, | ||
selection: ClockSelection, | ||
config: ClockConfig = ClockConfig(), | ||
header: Header? = null, | ||
alignment: Alignment = Alignment.TopStart, | ||
offset: IntOffset = IntOffset(0, 0), | ||
properties: PopupProperties = PopupProperties(), | ||
) { | ||
|
||
PopupBase( | ||
state = state, | ||
properties = properties, | ||
alignment = alignment, | ||
offset = offset | ||
) { | ||
ClockView( | ||
useCaseState = state, | ||
selection = selection, | ||
config = config, | ||
header = header, | ||
) | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
color/src/main/java/com/maxkeppeler/sheets/color/ColorPopup.kt
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,64 @@ | ||
/* | ||
* Copyright (C) 2022-2023. Maximilian Keppeler (https://www.maxkeppeler.com) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http:https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
@file:OptIn(ExperimentalMaterial3Api::class) | ||
|
||
package com.maxkeppeler.sheets.color | ||
|
||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.unit.IntOffset | ||
import androidx.compose.ui.window.PopupProperties | ||
import com.maxkeppeker.sheets.core.models.base.Header | ||
import com.maxkeppeker.sheets.core.models.base.UseCaseState | ||
import com.maxkeppeker.sheets.core.views.base.PopupBase | ||
import com.maxkeppeler.sheets.color.models.ColorConfig | ||
import com.maxkeppeler.sheets.color.models.ColorSelection | ||
|
||
/** | ||
* Core popup that functions as the base of a custom use-case. | ||
* @param state The state of the sheet. | ||
* @param selection The selection configuration for the dialog. | ||
* @param config The configuration of the color use-case. | ||
* @param header The header to be displayed at the top of the dialog. | ||
* @param properties The properties of the popup. | ||
*/ | ||
@ExperimentalMaterial3Api | ||
@Composable | ||
fun ColorPopup( | ||
state: UseCaseState, | ||
selection: ColorSelection, | ||
config: ColorConfig, | ||
header: Header? = null, | ||
alignment: Alignment = Alignment.TopStart, | ||
offset: IntOffset = IntOffset(0, 0), | ||
properties: PopupProperties = PopupProperties(), | ||
) { | ||
|
||
PopupBase( | ||
state = state, | ||
properties = properties, | ||
alignment = alignment, | ||
offset = offset | ||
) { | ||
ColorView( | ||
useCaseState = state, | ||
selection = selection, | ||
config = config, | ||
header = header, | ||
) | ||
} | ||
} |
Oops, something went wrong.