-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2671b66
commit b8179a8
Showing
5 changed files
with
235 additions
and
12 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
89 changes: 89 additions & 0 deletions
89
demo/src/main/java/com/orange/ods/demo/ui/components/buttons/ButtonsIcon.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,89 @@ | ||
/* | ||
* | ||
* Copyright 2021 Orange | ||
* | ||
* Use of this source code is governed by an MIT-style | ||
* license that can be found in the LICENSE file or at | ||
* https://opensource.org/licenses/MIT. | ||
* / | ||
*/ | ||
|
||
package com.orange.ods.demo.ui.components.buttons | ||
|
||
import androidx.compose.foundation.isSystemInDarkTheme | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.rememberScrollState | ||
import androidx.compose.foundation.verticalScroll | ||
import androidx.compose.material.ExperimentalMaterialApi | ||
import androidx.compose.material.rememberBottomSheetScaffoldState | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.dimensionResource | ||
import androidx.compose.ui.res.painterResource | ||
import com.orange.ods.compose.component.button.OdsIconButton | ||
import com.orange.ods.compose.theme.OdsDisplaySurface | ||
import com.orange.ods.demo.R | ||
import com.orange.ods.demo.ui.components.utilities.ComponentCustomizationBottomSheetScaffold | ||
import com.orange.ods.demo.ui.utilities.composable.SwitchListItem | ||
|
||
@OptIn(ExperimentalMaterialApi::class) | ||
@Composable | ||
fun ButtonsIcon() { | ||
val buttonCustomizationState = rememberButtonCustomizationState() | ||
|
||
with(buttonCustomizationState) { | ||
ComponentCustomizationBottomSheetScaffold( | ||
bottomSheetScaffoldState = rememberBottomSheetScaffoldState(), | ||
bottomSheetContent = { | ||
SwitchListItem(labelRes = R.string.component_state_disabled, checked = disabled) | ||
}) { | ||
Column( | ||
modifier = Modifier | ||
.verticalScroll(rememberScrollState()) | ||
.padding(vertical = dimensionResource(id = R.dimen.screen_vertical_margin)) | ||
) { | ||
Row( | ||
modifier = Modifier.fillMaxWidth(), | ||
horizontalArrangement = Arrangement.Center | ||
) { | ||
OdsIconButton( | ||
onClick = {}, | ||
painter = painterResource(id = R.drawable.ic_info), | ||
contentDescription = "", | ||
enabled = isEnabled | ||
) | ||
} | ||
|
||
Spacer(modifier = Modifier.padding(top = dimensionResource(R.dimen.spacing_s))) | ||
|
||
if (isSystemInDarkTheme()) { | ||
LightSurface(horizontalAlignment = Alignment.CenterHorizontally) { | ||
OdsIconButton( | ||
onClick = {}, | ||
painter = painterResource(id = R.drawable.ic_info), | ||
contentDescription = "", | ||
enabled = isEnabled, | ||
displaySurface = OdsDisplaySurface.Light | ||
) | ||
} | ||
} else { | ||
DarkSurface(horizontalAlignment = Alignment.CenterHorizontally) { | ||
OdsIconButton( | ||
onClick = {}, | ||
painter = painterResource(id = R.drawable.ic_info), | ||
contentDescription = "", | ||
enabled = isEnabled, | ||
displaySurface = OdsDisplaySurface.Dark | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
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