-
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
69d1609
commit 1ba3ddf
Showing
6 changed files
with
208 additions
and
71 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
55 changes: 55 additions & 0 deletions
55
demo/src/main/java/com/orange/ods/demo/ui/components/banners/BannerCustomizationState.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,55 @@ | ||
/* | ||
* | ||
* 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.banners | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.MutableState | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.saveable.rememberSaveable | ||
|
||
@Composable | ||
fun rememberBannerCustomizationState( | ||
buttonsCount: MutableState<Int> = rememberSaveable { mutableStateOf(BannerCustomizationState.MinActionButtonCount) }, | ||
textLinesCount: MutableState<Int> = rememberSaveable { mutableStateOf(BannerCustomizationState.MaxTextCount) }, | ||
dividerChecked: MutableState<Boolean> = rememberSaveable { mutableStateOf(true) }, | ||
iconChecked: MutableState<Boolean> = rememberSaveable { mutableStateOf(false) } | ||
) = | ||
remember(buttonsCount, textLinesCount, dividerChecked, iconChecked) { | ||
BannerCustomizationState(buttonsCount, textLinesCount, dividerChecked, iconChecked) | ||
} | ||
|
||
class BannerCustomizationState( | ||
val buttonsCount: MutableState<Int>, | ||
val textLinesCount: MutableState<Int>, | ||
val dividerChecked: MutableState<Boolean>, | ||
val iconChecked: MutableState<Boolean>, | ||
) { | ||
|
||
companion object { | ||
const val MinActionButtonCount = 1 | ||
const val MaxActionButtonCount = 2 | ||
const val MinTextCount = 1 | ||
const val MaxTextCount = 2 | ||
} | ||
|
||
val hasDivider | ||
get() = dividerChecked.value | ||
|
||
val hasIcon | ||
get() = iconChecked.value | ||
|
||
val hasButton | ||
get() = buttonsCount.value > 1 | ||
|
||
val hasTextLines | ||
get() = textLinesCount.value > 1 | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="360dp" | ||
android:height="180dp" | ||
android:viewportWidth="360" | ||
android:viewportHeight="180"> | ||
<path | ||
android:pathData="M0,0h360v180h-360z" | ||
android:strokeWidth="1" | ||
android:fillColor="#1B1B1B" | ||
android:fillType="evenOdd" | ||
android:strokeColor="#00000000"/> | ||
<path | ||
android:pathData="M60,60h240v60h-240z" | ||
android:strokeWidth="1" | ||
android:fillColor="#333333" | ||
android:fillType="evenOdd" | ||
android:strokeColor="#00000000"/> | ||
<path | ||
android:pathData="M90,86m-14,0a14,14 0,1 1,28 0a14,14 0,1 1,-28 0" | ||
android:strokeWidth="1" | ||
android:fillColor="#D8D8D8" | ||
android:strokeColor="#979797" | ||
android:fillType="evenOdd"/> | ||
<path | ||
android:pathData="M112,76h172v5h-172z" | ||
android:strokeWidth="1" | ||
android:fillColor="#CCCCCC" | ||
android:fillType="evenOdd" | ||
android:strokeColor="#00000000"/> | ||
<path | ||
android:pathData="M112,89h95v5h-95z" | ||
android:strokeWidth="1" | ||
android:fillColor="#CCCCCC" | ||
android:fillType="evenOdd" | ||
android:strokeColor="#00000000"/> | ||
<path | ||
android:pathData="M254,107h30v5h-30z" | ||
android:strokeWidth="1" | ||
android:fillColor="#FF7900" | ||
android:fillType="evenOdd" | ||
android:strokeColor="#00000000"/> | ||
<path | ||
android:pathData="M216,107h30v5h-30z" | ||
android:strokeWidth="1" | ||
android:fillColor="#FF7900" | ||
android:fillType="evenOdd" | ||
android:strokeColor="#00000000"/> | ||
</vector> |
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