Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into progressbar_configurator
Browse files Browse the repository at this point in the history
# Conflicts:
#	catalog/src/main/kotlin/com/adevinta/spark/catalog/model/Components.kt
  • Loading branch information
Ahmed Elshahawy committed Jan 11, 2024
2 parents 9ac607e + 7f4bb86 commit d0d4ff9
Show file tree
Hide file tree
Showing 24 changed files with 425 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dokka.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ jobs:
with:
path: 'build/dokka'
- id: deployment
uses: actions/deploy-pages@v4.0.0
uses: actions/deploy-pages@v4.0.2
11 changes: 10 additions & 1 deletion .github/workflows/firebase-app-distribution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ on:
required: true
default: 'main'
type: string
group:
description: 'Group'
required: true
type: choice
options:
- all
- qa
schedule:
- cron: 0 0 * * *

Expand Down Expand Up @@ -89,8 +96,10 @@ jobs:
firebase appdistribution:distribute
catalog/build/outputs/apk/release/catalog-release.apk
--app "1:559109812471:android:7aaf1a8ba28904f5f923f2"
--groups "all"
--groups "$GROUPS"
--release-notes-file "release-notes.txt"
env:
GROUPS: ${{ inputs.group || 'all' }}

- name: '♻️ Cleanup'
if: ${{ success() || failure() }}
Expand Down
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@

## [Unreleased]

## [0.6.1]

_2023-12-21_

### Fix Modal reported issues
* Fix the content padding not being passed to it's children.
* Invert the position of buttons.
* Inset for non edge to edge app was broken and displaying the content bellow the system bars.
* Add the support for WindowHeightSizeClass.Expanded to show the fullscreen modal in portrait

## [0.6.0]

_2023-12-19_
Expand Down Expand Up @@ -162,7 +172,9 @@ _2023-03-29_

<!-- Links -->

[Unreleased]: https://github.com/adevinta/spark-android/compare/0.6.0...HEAD
[Unreleased]: https://github.com/adevinta/spark-android/compare/0.6.1...HEAD

[0.6.1]: https://github.com/adevinta/spark-android/releases/tag/0.6.1

[0.6.0]: https://github.com/adevinta/spark-android/releases/tag/0.6.0

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
/*
* Copyright (c) 2023 Adevinta
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.adevinta.spark.catalog.configurator.samples.popover

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextDecoration
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.adevinta.spark.SparkTheme
import com.adevinta.spark.catalog.model.Configurator
import com.adevinta.spark.catalog.themes.SegmentedButton
import com.adevinta.spark.catalog.util.SampleSourceUrl
import com.adevinta.spark.components.buttons.ButtonOutlined
import com.adevinta.spark.components.iconbuttons.IconButtonFilled
import com.adevinta.spark.components.image.Illustration
import com.adevinta.spark.components.image.Image
import com.adevinta.spark.components.menu.DropdownMenuItem
import com.adevinta.spark.components.popover.Popover
import com.adevinta.spark.components.popover.newapi.TooltipState
import com.adevinta.spark.components.popover.newapi.rememberTooltipState
import com.adevinta.spark.components.spacer.VerticalSpacer
import com.adevinta.spark.components.text.Text
import com.adevinta.spark.components.textfields.SelectTextField
import com.adevinta.spark.components.toggles.SwitchLabelled
import com.adevinta.spark.icons.BurgerMenu
import com.adevinta.spark.icons.SparkIcons
import com.adevinta.spark.icons.Store
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch

public val PopoverConfigurator: Configurator = Configurator(
name = "Popover",
description = "Popover configuration",
sourceUrl = "$SampleSourceUrl/PopoverSamples.kt",
) {
PopoverSample()
}

@OptIn(ExperimentalMaterial3Api::class)
@Preview(
showBackground = true,
)
@Composable
private fun PopoverSample() {
val scrollState = rememberScrollState()
Column(
verticalArrangement = Arrangement.spacedBy(16.dp),
modifier = Modifier.verticalScroll(scrollState),
) {
var isDismissButtonEnabled by remember { mutableStateOf(true) }
var popoverContentExample by remember { mutableStateOf(PopoverContentExamples.TextList) }
var popoverTriggerExample by remember { mutableStateOf(PopoverTriggerExamples.Button) }
val popoverState = rememberTooltipState(isPersistent = true)
val scope = rememberCoroutineScope()

SwitchLabelled(
checked = isDismissButtonEnabled,
onCheckedChange = {
isDismissButtonEnabled = it
},
) {
Text(
text = "Show dismiss icon",
modifier = Modifier.fillMaxWidth(),
)
}

val contentExamples = PopoverContentExamples.entries.toTypedArray()
var expanded by remember { mutableStateOf(false) }
SelectTextField(
modifier = Modifier.fillMaxWidth(),
value = popoverContentExample.name,
onValueChange = {},
readOnly = true,
label = "Popover Content Example",
expanded = expanded,
onExpandedChange = { expanded = !expanded },
onDismissRequest = { expanded = false },
dropdownContent = {
contentExamples.forEach {
DropdownMenuItem(
text = { Text(it.name) },
onClick = {
popoverContentExample = it
expanded = false
},
)
}
},
)
Column {
Text(
text = "Popover Anchor",
modifier = Modifier.padding(bottom = 8.dp),
style = SparkTheme.typography.body2.copy(fontWeight = FontWeight.Bold),
)
val triggerExamples = PopoverTriggerExamples.entries.toTypedArray()
val contentSidesLabel = triggerExamples.map { it.name }
SegmentedButton(
options = contentSidesLabel,
selectedOption = popoverTriggerExample.name,
onOptionSelect = {
popoverTriggerExample = PopoverTriggerExamples.valueOf(it)
},
modifier = Modifier
.fillMaxWidth()
.height(48.dp),
)
}

VerticalSpacer(40.dp)

ConfiguredPopover(scope, popoverState, isDismissButtonEnabled, popoverContentExample, popoverTriggerExample)
}
}

@Composable
private fun ConfiguredPopover(
scope: CoroutineScope,
popoverState: TooltipState,
isDismissButtonEnabled: Boolean,
popoverContentExample: PopoverContentExamples,
popoverTriggerExample: PopoverTriggerExamples,
) {
Popover(
popoverState = popoverState,
popoverContent = {
when (popoverContentExample) {
PopoverContentExamples.TextList -> LazyColumn {
items(5) { index ->
Box(modifier = Modifier.padding(all = 4.dp)) {
Text(text = "Text: $index")
}
}
}

PopoverContentExamples.Text -> Column {
Text(
text = "Title",
modifier = Modifier.padding(bottom = 16.dp),
style = SparkTheme.typography.headline1.copy(fontWeight = FontWeight.Bold),
)
Text(
text = "Do you want to have this cookie now?",
modifier = Modifier.padding(bottom = 16.dp),
style = SparkTheme.typography.body2.copy(fontWeight = FontWeight.Bold),
)
Text(
text = "Text Link",
textDecoration = TextDecoration.Underline,
style = SparkTheme.typography.body1.copy(fontWeight = FontWeight.Bold)
.copy(color = SparkTheme.colors.accent),
)
}

PopoverContentExamples.Image -> Image(
contentScale = ContentScale.Crop,
modifier = Modifier.height(500.dp),
model = "https://t.ly/gio0G",
contentDescription = null,
)

PopoverContentExamples.Illustration -> Illustration(
sparkIcon = SparkIcons.Store,
contentDescription = null,

modifier = Modifier.size(100.dp),
)
}
},
isDismissButtonEnabled = isDismissButtonEnabled,
) {
Box(
modifier = Modifier
.fillMaxWidth(),
contentAlignment = Alignment.Center,
) {
when (popoverTriggerExample) {
PopoverTriggerExamples.Button -> {
ButtonOutlined(
text = "Display Popover",
onClick = { scope.launch { popoverState.show() } },
)
}

PopoverTriggerExamples.Icon -> {
IconButtonFilled(
onClick = { scope.launch { popoverState.show() } },
icon = SparkIcons.BurgerMenu,
contentDescription = "Burger Menu",
)
}
}
}
}
}

private enum class PopoverContentExamples {
TextList,
Image,
Illustration,
Text,
}

private enum class PopoverTriggerExamples {
Button,
Icon,
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import com.adevinta.spark.catalog.R
import com.adevinta.spark.catalog.configurator.samples.buttons.ButtonsConfigurator
import com.adevinta.spark.catalog.configurator.samples.buttons.IconButtonsConfigurator
import com.adevinta.spark.catalog.configurator.samples.buttons.IconToggleButtonsConfigurator
import com.adevinta.spark.catalog.configurator.samples.popover.PopoverConfigurator
import com.adevinta.spark.catalog.configurator.samples.progressbar.ProgressbarConfigurator
import com.adevinta.spark.catalog.configurator.samples.rating.RatingsConfigurator
import com.adevinta.spark.catalog.configurator.samples.tabs.TabsConfigurator
Expand Down Expand Up @@ -134,14 +135,14 @@ private val IconToggleButtons = Component(
private val Popovers = Component(
id = nextId(),
name = "Popovers",
illustration = R.drawable.illu_component_tokens,
illustration = R.drawable.illustration_popover,
tintIcon = false,
description = R.string.component_popovers_description,
guidelinesUrl = "$ComponentGuidelinesUrl/p/88a08c-popover/b/904ceb",
docsUrl = "$PackageSummaryUrl/com.adevinta.spark.popover/index.html",
sourceUrl = "$SparkSourceUrl/kotlin/com/adevinta/popover/Color.kt",
examples = PopoverExamples,
configurator = null,
configurator = PopoverConfigurator,
)

private val RadioButtons = Component(
Expand Down
49 changes: 49 additions & 0 deletions catalog/src/main/res/drawable/illustration_popover.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!--
Copyright (c) 2024 Adevinta
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="143dp"
android:height="143dp"
android:viewportWidth="143"
android:viewportHeight="143">
<path
android:fillColor="#000000"
android:pathData="M108.95,115.5L83.16,90.88L103.67,77.4L108.95,115.5Z"
android:strokeWidth="1"
android:strokeColor="#000000" />
<path
android:fillColor="#B5CFFF"
android:pathData="M34,29.5L108.87,29.5A17.5,17.5 0,0 1,126.37 47L126.37,82.02A17.5,17.5 0,0 1,108.87 99.52L34,99.52A17.5,17.5 0,0 1,16.5 82.02L16.5,47A17.5,17.5 0,0 1,34 29.5z"
android:strokeWidth="5"
android:strokeColor="#000000" />
<path
android:fillColor="#000000"
android:pathData="M44.48,60.99L70.26,60.99A4.69,4.69 0,0 1,74.95 65.68L74.95,65.68A4.69,4.69 0,0 1,70.26 70.37L44.48,70.37A4.69,4.69 0,0 1,39.79 65.68L39.79,65.68A4.69,4.69 0,0 1,44.48 60.99z" />
<path
android:fillColor="#000000"
android:pathData="M44.48,46.93L70.26,46.93A4.69,4.69 0,0 1,74.95 51.62L74.95,51.62A4.69,4.69 0,0 1,70.26 56.3L44.48,56.3A4.69,4.69 0,0 1,39.79 51.62L39.79,51.62A4.69,4.69 0,0 1,44.48 46.93z" />
<path
android:fillColor="#000000"
android:pathData="M44.48,75.06L70.26,75.06A4.69,4.69 0,0 1,74.95 79.75L74.95,79.75A4.69,4.69 0,0 1,70.26 84.44L44.48,84.44A4.69,4.69 0,0 1,39.79 79.75L39.79,79.75A4.69,4.69 0,0 1,44.48 75.06z" />
<path
android:fillColor="#000000"
android:pathData="M97.81,48.1L97.81,48.1A6.45,6.45 0,0 1,104.26 54.55L104.26,54.55A6.45,6.45 0,0 1,97.81 60.99L97.81,60.99A6.45,6.45 0,0 1,91.36 54.55L91.36,54.55A6.45,6.45 0,0 1,97.81 48.1z" />
</vector>
2 changes: 1 addition & 1 deletion catalog/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@

<style name="ThemeOverlay.Catalog.Dialog" parent="@android:style/ThemeOverlay.Material.Dialog">
<item name="android:windowIsFloating">false</item>

</style>

</resources>
Loading

0 comments on commit d0d4ff9

Please sign in to comment.