Skip to content

Commit cfbe963

Browse files
chore: update visibility modifiers (#993)
* Add InternalOudsApi annotation to token files in theme-contract * Token data classes in theme-orange are now internal * Token data classes in theme-sosh are now internal * Token data classes in theme-wireframe are now internal * Move InputStream.contentAsString extension method in app module * Most of test related classes are now internal * Rename OudsLink arrow to chevron * OudsColorMode is now internal * Change visibility of several properties, methods and classes of core module to internal * getDefaultIconPainter in OudsTag is now internal * Review: Remove internal modifier on constructors of OudsColorScheme.Repository and OudsColorScheme.Modes nested classes * Review: Use isSupported on OudsColoredBoxColor instead of OudsColorMode whenever possible * Review: getDefaultIconPainter is not abstract anymore and provides a default implementation
1 parent 1d1b0c4 commit cfbe963

File tree

193 files changed

+401
-323
lines changed

Some content is hidden

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

193 files changed

+401
-323
lines changed

app/src/main/java/com/orange/ouds/app/ui/components/ComponentIllustrations.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import com.orange.ouds.core.component.OudsColoredBox
4242
import com.orange.ouds.core.component.OudsFilterChip
4343
import com.orange.ouds.core.component.OudsHorizontalDivider
4444
import com.orange.ouds.core.component.OudsLink
45-
import com.orange.ouds.core.component.OudsLinkArrow
45+
import com.orange.ouds.core.component.OudsLinkChevron
4646
import com.orange.ouds.core.component.OudsNavigationBar
4747
import com.orange.ouds.core.component.OudsNavigationBarItem
4848
import com.orange.ouds.core.component.OudsNavigationBarItemIcon
@@ -131,7 +131,7 @@ fun DividerIllustration() = ComponentIllustration {
131131
fun LinkIllustration() = ComponentIllustration {
132132
OudsLink(
133133
label = stringResource(id = R.string.app_components_common_label_label),
134-
arrow = OudsLinkArrow.Next,
134+
chevron = OudsLinkChevron.Next,
135135
onClick = {}
136136
)
137137
}

app/src/main/java/com/orange/ouds/app/ui/components/coloredbackground/ColoredBackgroundDemoScreen.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import com.orange.ouds.core.component.OudsButton
4141
import com.orange.ouds.core.component.OudsColoredBox
4242
import com.orange.ouds.core.component.OudsColoredBoxColor
4343
import com.orange.ouds.core.component.OudsLink
44-
import com.orange.ouds.core.component.OudsLinkArrow
44+
import com.orange.ouds.core.component.OudsLinkChevron
4545
import com.orange.ouds.core.theme.OudsTheme
4646

4747
@Composable
@@ -58,7 +58,7 @@ fun ColoredBackgroundDemoScreen() {
5858
@Composable
5959
private fun ColoredBackgroundDemoBottomSheetContent(state: ColoredBackgroundDemoState) {
6060
with(state) {
61-
val colors = OudsColoredBoxColor.entries.filter { it.mode.isSupported }
61+
val colors = OudsColoredBoxColor.entries.filter { it.isSupported }
6262
CustomizationDropdownMenu(
6363
applyTopPadding = false,
6464
label = stringResource(id = R.string.app_components_coloredBackground_color_label),
@@ -83,7 +83,7 @@ private fun ColoredBackgroundDemoBottomSheetContent(state: ColoredBackgroundDemo
8383
@Composable
8484
private fun ColoredBackgroundDemoContent(state: ColoredBackgroundDemoState) {
8585
with(state) {
86-
if (!color.mode.isSupported) {
86+
if (!color.isSupported) {
8787
Toast.makeText(
8888
LocalContext.current,
8989
stringResource(id = R.string.app_components_coloredBackground_unsupportedColor_text, color.name.toSentenceCase()),
@@ -112,7 +112,7 @@ private fun ColoredBackgroundDemoContent(state: ColoredBackgroundDemoState) {
112112
)
113113
OudsLink(
114114
label = stringResource(id = R.string.app_components_link_label),
115-
arrow = OudsLinkArrow.Next,
115+
chevron = OudsLinkChevron.Next,
116116
onClick = {},
117117
)
118118
}
@@ -139,7 +139,7 @@ private fun Code.Builder.coloredBackgroundDemoCodeSnippet(state: ColoredBackgrou
139139
}
140140
functionCall("OudsLink") {
141141
labelArgument(R.string.app_components_link_label)
142-
typedArgument("arrow", OudsLinkArrow.Next)
142+
typedArgument("chevron", OudsLinkChevron.Next)
143143
onClickArgument {}
144144
}
145145
}

app/src/main/java/com/orange/ouds/app/ui/components/coloredbackground/ColoredBackgroundDemoState.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ object ColoredBackgroundDemoStateDefaults {
4545
val Color: OudsColoredBoxColor
4646
@Composable
4747
get() = OudsColoredBoxColor.BrandPrimary
48-
.takeIf { it.mode.isSupported }
49-
.orElse { OudsColoredBoxColor.entries.first { it.mode.isSupported } }
48+
.takeIf { it.isSupported }
49+
.orElse { OudsColoredBoxColor.entries.first { it.isSupported } }
5050
}

app/src/main/java/com/orange/ouds/app/ui/components/link/LinkDemoScreen.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import com.orange.ouds.app.ui.utilities.composable.CustomizationSwitchItem
3232
import com.orange.ouds.app.ui.utilities.composable.CustomizationTextField
3333
import com.orange.ouds.app.ui.utilities.composable.DemoScreen
3434
import com.orange.ouds.core.component.OudsLink
35-
import com.orange.ouds.core.component.OudsLinkArrow
35+
import com.orange.ouds.core.component.OudsLinkChevron
3636
import com.orange.ouds.core.component.OudsLinkIcon
3737
import com.orange.ouds.core.component.OudsLinkSize
3838
import com.orange.ouds.theme.OudsVersion
@@ -109,19 +109,19 @@ private fun LinkDemoContent(state: LinkDemoState) {
109109
size = size
110110
)
111111
}
112-
LinkDemoState.Layout.ArrowBack -> {
112+
LinkDemoState.Layout.ChevronBack -> {
113113
OudsLink(
114114
label = label,
115-
arrow = OudsLinkArrow.Back,
115+
chevron = OudsLinkChevron.Back,
116116
onClick = {},
117117
enabled = enabled,
118118
size = size
119119
)
120120
}
121-
LinkDemoState.Layout.ArrowNext -> {
121+
LinkDemoState.Layout.ChevronNext -> {
122122
OudsLink(
123123
label = label,
124-
arrow = OudsLinkArrow.Next,
124+
chevron = OudsLinkChevron.Next,
125125
onClick = {},
126126
enabled = enabled,
127127
size = size
@@ -143,8 +143,8 @@ private fun Code.Builder.linkDemoCodeSnippet(state: LinkDemoState, themeDrawable
143143
painterArgument(themeDrawableResources.tipsAndTricks)
144144
}
145145
}
146-
LinkDemoState.Layout.ArrowBack -> typedArgument("arrow", OudsLinkArrow.Back)
147-
LinkDemoState.Layout.ArrowNext -> typedArgument("arrow", OudsLinkArrow.Next)
146+
LinkDemoState.Layout.ChevronBack -> typedArgument("chevron", OudsLinkChevron.Back)
147+
LinkDemoState.Layout.ChevronNext -> typedArgument("chevron", OudsLinkChevron.Next)
148148
}
149149
onClickArgument()
150150
enabledArgument(enabled)

app/src/main/java/com/orange/ouds/app/ui/components/link/LinkDemoState.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class LinkDemoState(
8686
enum class Layout(@StringRes val labelRes: Int) {
8787
TextOnly(R.string.app_components_common_textOnlyLayout_label),
8888
TextAndIcon(R.string.app_components_common_textAndIconLayout_label),
89-
ArrowBack(R.string.app_components_link_backLayout_label),
90-
ArrowNext(R.string.app_components_link_nextLayout_label)
89+
ChevronBack(R.string.app_components_link_backLayout_label),
90+
ChevronNext(R.string.app_components_link_nextLayout_label)
9191
}
9292
}

app/src/main/java/com/orange/ouds/app/ui/tokens/TokenCategoryDetailScreen.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,9 @@ private fun CodeColumn(codeExample: String, modifier: Modifier = Modifier) {
268268
var isExpanded by rememberSaveable { mutableStateOf(false) }
269269
val linkStateDescription = stringResource(if (isExpanded) R.string.app_common_expanded_a11y else R.string.app_common_collapsed_a11y)
270270
val linkContentDescription = stringResource(R.string.app_tokens_common_viewCodeExample_label)
271-
val transition = updateTransition(targetState = isExpanded, label = "LinkArrowTransition")
272-
val linkArrowRotation by transition.animateFloat(
273-
label = "LinkArrowRotation",
271+
val transition = updateTransition(targetState = isExpanded, label = "LinkChevronTransition")
272+
val linkChevronRotation by transition.animateFloat(
273+
label = "LinkChevronRotation",
274274
transitionSpec = {
275275
tween(durationMillis = 300, easing = FastOutSlowInEasing)
276276
}
@@ -300,7 +300,7 @@ private fun CodeColumn(codeExample: String, modifier: Modifier = Modifier) {
300300
color = OudsTheme.colorScheme.content.default
301301
)
302302
Icon(
303-
modifier = Modifier.rotate(linkArrowRotation),
303+
modifier = Modifier.rotate(linkChevronRotation),
304304
painter = painterResource(LocalThemeDrawableResources.current.formChevronDown),
305305
tint = OudsTheme.colorScheme.content.brandPrimary,
306306
contentDescription = null

app/src/main/java/com/orange/ouds/app/ui/utilities/WebViewExt.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ package com.orange.ouds.app.ui.utilities
1515
import android.webkit.WebView
1616
import androidx.annotation.RawRes
1717
import com.orange.ouds.app.R
18-
import com.orange.ouds.foundation.extensions.contentAsString
18+
import java.io.InputStream
19+
import java.util.Scanner
1920

2021
internal fun WebView.injectLightDarkModeCss(darkMode: Boolean) {
2122
injectCss(R.raw.base_style)
@@ -29,4 +30,9 @@ private fun WebView.injectCss(@RawRes cssResource: Int) {
2930
val javascript = String.format(injectCssFunction, css.trim { it <= ' ' })
3031
val code = "javascript:(function() { $javascript })()"
3132
loadUrl(code)
32-
}
33+
}
34+
35+
private fun InputStream.contentAsString(): String? {
36+
val scanner = Scanner(this).useDelimiter("\\A")
37+
return if (scanner.hasNext()) scanner.next() else null
38+
}

core-test/src/main/java/com/orange/ouds/core/test/OudsBadgeTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import org.junit.runner.RunWith
1818
import org.junit.runners.Parameterized
1919

2020
@RunWith(Enclosed::class)
21-
class OudsBadgeTest {
21+
internal class OudsBadgeTest {
2222

2323
@RunWith(Parameterized::class)
2424
class Default(parameter: Any) : OudsComponentSnapshotTest(

core-test/src/main/java/com/orange/ouds/core/test/OudsButtonTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import org.junit.runner.RunWith
1818
import org.junit.runners.Parameterized
1919

2020
@RunWith(Enclosed::class)
21-
class OudsButtonTest {
21+
internal class OudsButtonTest {
2222

2323
@RunWith(Parameterized::class)
2424
class Default(parameter: Any) : OudsComponentSnapshotTest(

core-test/src/main/java/com/orange/ouds/core/test/OudsCheckboxItemTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import org.junit.runner.RunWith
1818
import org.junit.runners.Parameterized
1919

2020
@RunWith(Enclosed::class)
21-
class OudsCheckboxItemTest {
21+
internal class OudsCheckboxItemTest {
2222

2323
@RunWith(Parameterized::class)
2424
class Default(parameter: Any) : OudsComponentSnapshotTest(

0 commit comments

Comments
 (0)