Skip to content

Commit 8b5414b

Browse files
Merge pull request #3 from yml-org/CM-1336_Tag_Container_Animation
Alpha animation for tag view and content size animation for tag view container
2 parents 7fb244a + c4f5b34 commit 8b5414b

File tree

17 files changed

+675
-594
lines changed

17 files changed

+675
-594
lines changed

app/src/main/java/co/yml/coreui/MainActivity.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import androidx.compose.foundation.layout.padding
1111
import androidx.compose.material3.ExperimentalMaterial3Api
1212
import androidx.compose.material3.Scaffold
1313
import androidx.compose.ui.Modifier
14-
import co.yml.coreui.feature.ytag.ui.YTagActivity
1514
import co.yml.coreui.core.ui.templates.AppBar
1615
import co.yml.coreui.core.ui.theme.CoreUICatalogTheme
16+
import co.yml.coreui.feature.ytag.ui.YTagActivity
1717
import co.yml.coreui.ui.R
1818
import co.yml.coreui.ui.presentation.CoreUIComponents
1919
import dagger.hilt.android.AndroidEntryPoint
@@ -30,10 +30,11 @@ class MainActivity : ComponentActivity() {
3030
super.onCreate(savedInstanceState)
3131
setContent {
3232
CoreUICatalogTheme {
33-
Scaffold(modifier = Modifier.fillMaxSize(),
33+
Scaffold(
34+
modifier = Modifier.fillMaxSize(),
3435
containerColor = CoreUICatalogTheme.colors.background,
35-
topBar = { AppBar() })
36-
{
36+
topBar = { AppBar() }
37+
) {
3738
Column(
3839
modifier = Modifier
3940
.padding(it)

app/src/main/java/co/yml/coreui/ui/presentation/CoreUIComponents.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ fun CoreUIComponents(title: String, onClick: () -> Unit) {
2424
)
2525
)
2626
.fillMaxWidth()
27-
.height(48.dp), onClick = onClick,
27+
.height(48.dp),
28+
onClick = onClick,
2829
colors = ButtonDefaults.buttonColors(containerColor = CoreUICatalogTheme.colors.button)
2930
) {
3031
Text(

core/common/src/test/java/co/yml/coreui/common/TestCoroutineProvider.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package co.yml.coreui.common
22

3+
import co.yml.coreui.core.common.di.DispatcherModule
4+
import co.yml.coreui.core.common.di.DispatcherModule_ProvideNetworkDispatcherFactory.provideNetworkDispatcher
35
import kotlinx.coroutines.test.runTest
46
import org.junit.Assert.assertTrue
57
import org.junit.Test
6-
import co.yml.coreui.core.common.di.DispatcherModule
7-
import co.yml.coreui.core.common.di.DispatcherModule_ProvideNetworkDispatcherFactory.provideNetworkDispatcher
88

99
/**
1010
* Test coroutine provider

core/data/src/main/java/co/yml/coreui/core/data/di/RepositoryModule.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,4 @@ import dagger.hilt.components.SingletonComponent
1111
*/
1212
@Module
1313
@InstallIn(SingletonComponent::class)
14-
interface RepositoryModule {
15-
16-
}
14+
interface RepositoryModule

core/ui/src/androidTest/java/co/yml/coreui/ui/ytag/TagViewContainerTesting.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,14 @@ class TagViewContainerTesting {
8282
}
8383

8484
@Test
85-
fun tagViewContainer_tags_shown(){
85+
fun tagViewContainer_tags_shown() {
8686
launchTagViewContainer()
8787

8888
composeTestRule.onNodeWithText("Tag 1").assertIsDisplayed()
8989
}
9090

9191
@Test
92-
fun tagViewContainer_with_less_space_more_tag_shown(){
92+
fun tagViewContainer_with_less_space_more_tag_shown() {
9393
val tagViewContainerModifiers = TagViewContainerModifiers.Builder()
9494
.width(150.dp)
9595
.height(50.dp)

core/ui/src/androidTest/java/co/yml/coreui/ui/ytag/TagViewTest.kt

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import androidx.compose.ui.text.style.TextDecoration
2121
import androidx.compose.ui.text.style.TextOverflow
2222
import androidx.compose.ui.unit.dp
2323
import androidx.compose.ui.unit.sp
24-
import co.yml.coreui.core.ui.ytag.model.TagViewModifiers
2524
import co.yml.coreui.core.ui.ytag.TagView
25+
import co.yml.coreui.core.ui.ytag.model.TagViewModifiers
2626
import org.junit.Rule
2727
import org.junit.Test
2828

@@ -50,7 +50,6 @@ class TagViewTest {
5050

5151
@Test
5252
fun tagView_shown() {
53-
5453
launchYTag(text = "YTag")
5554
composeTestRule.onNodeWithTag("tag_view", useUnmergedTree = true).printToString()
5655

@@ -94,7 +93,6 @@ class TagViewTest {
9493

9594
@Test
9695
fun tagView_leading_and_trailing_icon_shown() {
97-
9896
launchYTag(text = "YTag", leadingIcon = {
9997
IconButton(onClick = {}, modifier = Modifier.testTag("leading_icon")) {
10098
Icon(
@@ -103,20 +101,20 @@ class TagViewTest {
103101
)
104102
}
105103
}, trailingIcon = {
106-
IconButton(onClick = {}, modifier = Modifier.testTag("trailing_icon")) {
107-
Icon(
108-
painter = painterResource(id = R.drawable.ic_menu_mylocation),
109-
contentDescription = null
110-
)
111-
}
112-
})
104+
IconButton(onClick = {}, modifier = Modifier.testTag("trailing_icon")) {
105+
Icon(
106+
painter = painterResource(id = R.drawable.ic_menu_mylocation),
107+
contentDescription = null
108+
)
109+
}
110+
})
113111

114112
composeTestRule.onNodeWithTag("leading_icon", useUnmergedTree = true).assertIsDisplayed()
115113
composeTestRule.onNodeWithTag("trailing_icon", useUnmergedTree = true).assertIsDisplayed()
116114
}
117115

118116
@Test
119-
fun tag_with_modifiers_are_executed(){
117+
fun tag_with_modifiers_are_executed() {
120118
val tagViewModifiers = TagViewModifiers.Builder()
121119
.minWidth(32.dp)
122120
.minHeight(100.dp)
@@ -134,7 +132,7 @@ class TagViewTest {
134132
.overFlow(TextOverflow.Ellipsis)
135133
.softWrap(true)
136134
.maxLines(1)
137-
.onTextLayout { }
135+
.onTextLayout { }
138136
.style(TextStyle())
139137
.enableBorder(true)
140138
.borderColor(Color.Red)
@@ -145,7 +143,7 @@ class TagViewTest {
145143
.tonalElevation(2.dp)
146144
.shadowElevation(2.dp)
147145
.containerPaddingValues(PaddingValues(4.dp))
148-
.onCLick { }
146+
.onCLick { }
149147
.borderWidth(1.dp)
150148
.build()
151149

core/ui/src/main/java/co/yml/coreui/core/ui/templates/AppBar.kt

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ fun AppBar() {
3838
}
3939
}
4040

41-
4241
/**
4342
* Top app bars display information and actions at the top of a screen.
4443
*
4544
* @param title title of the screen
4645
* @param onBackPressed implementation of back press event
4746
*/
47+
@OptIn(ExperimentalMaterial3Api::class)
4848
@Composable
4949
fun AppBarWithBackButton(title: String, onBackPressed: () -> Unit) {
5050
Surface(shadowElevation = dimensionResource(id = R.dimen.padding_small)) {
@@ -69,38 +69,39 @@ fun AppBarWithBackButton(title: String, onBackPressed: () -> Unit) {
6969
Icon(
7070
painter = painterResource(id = R.drawable.ic_back_arrow),
7171
contentDescription = "Back",
72-
tint = Color.Black
72+
tint = CoreUICatalogTheme.colors.primary
7373
)
7474
}
7575
}
7676
)
7777
}
7878
}
7979

80-
8180
@Preview(showBackground = true)
8281
@Composable
8382
fun DefaultPreview() {
8483
CoreUICatalogTheme {
85-
Scaffold(modifier = Modifier.fillMaxSize(),
84+
Scaffold(
85+
modifier = Modifier.fillMaxSize(),
8686
containerColor = CoreUICatalogTheme.colors.background,
8787
topBar = { AppBar() },
88-
content = { Box(Modifier.padding(it)) {} })
88+
content = { Box(Modifier.padding(it)) {} }
89+
)
8990
}
9091
}
9192

92-
9393
@Preview(showBackground = true)
9494
@Composable
9595
fun AppBarWithBackButton() {
9696
CoreUICatalogTheme {
97-
Scaffold(modifier = Modifier.fillMaxSize(),
97+
Scaffold(
98+
modifier = Modifier.fillMaxSize(),
9899
containerColor = CoreUICatalogTheme.colors.background,
99100
topBar = {
100101
AppBarWithBackButton(title = stringResource(id = R.string.title_y_tag)) {
101102
}
102103
},
103-
content = { Box(Modifier.padding(it)) {} })
104-
104+
content = { Box(Modifier.padding(it)) {} }
105+
)
105106
}
106107
}

core/ui/src/main/java/co/yml/coreui/core/ui/theme/Shape.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ data class CoreUICatalogShapes(
1010
val large: RoundedCornerShape = RoundedCornerShape(0.dp)
1111
)
1212

13-
internal val LocalShapes = staticCompositionLocalOf {CoreUICatalogShapes() }
13+
internal val LocalShapes = staticCompositionLocalOf { CoreUICatalogShapes() }

0 commit comments

Comments
 (0)