Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
6e7fa5b
[Jetnews] Upgrade to snapshot 7141639
JolandaVerhoef Feb 15, 2021
7b9a5ad
[Rally] Upgrade to snapshot 7141639
JolandaVerhoef Feb 16, 2021
f804e32
[Rally] Run spotlessApply
JolandaVerhoef Feb 16, 2021
18ee035
[Rally] Use selectableGroup to indicate that topAppBar tabs are part …
JolandaVerhoef Feb 16, 2021
171e6fa
Merge pull request #397 from android/jv/rally_beta01
JolandaVerhoef Feb 16, 2021
5bd997b
Merge branch 'dev_beta01' into jv/jn_beta01
JolandaVerhoef Feb 16, 2021
e1432b8
[Jetnews] Fix review comments
JolandaVerhoef Feb 16, 2021
c0276f5
Merge remote-tracking branch 'origin/jv/jn_beta01' into jv/jn_beta01
JolandaVerhoef Feb 16, 2021
881c128
[Rally] Specify content description and role of tabs
JolandaVerhoef Feb 16, 2021
43d673a
[Jetchat] Update to snapshot 7141639
JoseAlcerreca Feb 16, 2021
5a349f7
Cleanup and some fixes
JoseAlcerreca Feb 16, 2021
b3bc011
[Rally] Group elements at a higher granularity
JolandaVerhoef Feb 16, 2021
d6a4a72
Merge pull request #395 from android/jv/jn_beta01
JolandaVerhoef Feb 16, 2021
22f3487
[Jetcaster] Update to beta01 snapshot
yrezgui Feb 16, 2021
8b45361
Merge branch 'dev_beta01' into jetcaster-beta01
yrezgui Feb 16, 2021
f41063a
Apply update changes
yrezgui Feb 16, 2021
68bfcfe
Merge branch 'dev_beta01' into jv/rally_a11y
JolandaVerhoef Feb 17, 2021
2dd3282
[Rally] Add comment explaining use of mergeDescendants
JolandaVerhoef Feb 17, 2021
db1f112
Update imports
yrezgui Feb 17, 2021
f63a7d8
Update imports
yrezgui Feb 17, 2021
4f29b06
Update .draggable modifier usage
yrezgui Feb 17, 2021
3b8ec59
Move up clickable logic comment
yrezgui Feb 17, 2021
381c5aa
Merge pull request #400 from android/jv/rally_a11y
JolandaVerhoef Feb 17, 2021
8ece21f
Apply spotless
yrezgui Feb 17, 2021
a96126f
Add viewModel temporary fix
yrezgui Feb 17, 2021
f0730e5
Merge branch 'dev_beta01' into jetcaster-beta01
yrezgui Feb 17, 2021
ef07b94
Change FIXME to TODO (spotless wasn't happy)
yrezgui Feb 17, 2021
7a61a8e
Use snapshot version of compose viewmodel
yrezgui Feb 17, 2021
94aabf7
[Owl] Update to snapshot 7141639.
nickbutcher Feb 15, 2021
5958320
[Jetsnack] Update to snapshot 7141639.
nickbutcher Feb 15, 2021
3292ea4
Bring back click logic
yrezgui Feb 18, 2021
9a068b4
[Crane] Update to snapshot 7141639 (#396)
manuelvicnt Feb 18, 2021
c4f4d25
Merge branch 'dev_beta01' into nb/owl_beta01
nickbutcher Feb 18, 2021
24296f7
Merge branch 'dev_beta01' into jetcaster-beta01
yrezgui Feb 18, 2021
4a132dc
Remove dependencies resolution strategy
yrezgui Feb 18, 2021
18948cd
Merge pull request #393 from android/nb/owl_beta01
nickbutcher Feb 18, 2021
f6b189e
Merge branch 'dev_beta01' into nb/js_beta01
nickbutcher Feb 18, 2021
56e294b
Merge pull request #394 from android/nb/js_beta01
nickbutcher Feb 18, 2021
64ba0e9
[Jetsnack] Update to snapshot 7141639.
nickbutcher Feb 15, 2021
284bf9e
[Owl] Update to snapshot 7141639.
nickbutcher Feb 15, 2021
8e4b4de
Revert initial revert on viewmodel initialization
yrezgui Feb 18, 2021
0487537
Merge branch 'dev_beta01' into jetcaster-beta01
yrezgui Feb 18, 2021
c01f1b0
Merge pull request #401 from yrezgui/jetcaster-beta01
yrezgui Feb 18, 2021
2e5768a
Extracts FragmentAwareAndroidViewBinding to file
JoseAlcerreca Feb 18, 2021
85ee055
spotless...
JoseAlcerreca Feb 18, 2021
d3e192c
Merge pull request #399 from JoseAlcerreca/jetchat_beta01
JoseAlcerreca Feb 18, 2021
a0e7ad4
[Jetsnack] Correct creation of coroutines within composition.
nickbutcher Feb 18, 2021
4e81ef5
[Jetsnack] Key bottom nav anim on anim spec.
nickbutcher Feb 18, 2021
e3bd277
Merge pull request #402 from android/nb/js_anim_launch
nickbutcher Feb 18, 2021
a30b2c6
[Owl] Encapsulate onboarding transition.
nickbutcher Feb 19, 2021
a18c2f7
[Owl] Spell gooder.
nickbutcher Feb 19, 2021
66fa1da
Merge pull request #403 from android/nb/owl_transition
nickbutcher Feb 19, 2021
50b2502
[Jetsurvey] Update to beta01 snapshot
florina-muntenescu Feb 16, 2021
5ecde53
[Jetsurvey] Removing a preview and upgrading to 7154166 snapshot
florina-muntenescu Feb 21, 2021
4212a1c
Merge pull request #398 from android/fm/jetsurvey_beta01
florina-muntenescu Feb 23, 2021
d3af512
[All] Update to beta01
florina-muntenescu Feb 23, 2021
0f195d9
Merge pull request #406 from android/fm/beta01
florina-muntenescu Feb 24, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import androidx.compose.samples.crane.data.DatesRepository
import androidx.compose.samples.crane.ui.CraneTheme
import androidx.compose.ui.test.SemanticsMatcher
import androidx.compose.ui.test.assertContentDescriptionEquals
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.junit4.ComposeTestRule
import androidx.compose.ui.test.junit4.createAndroidComposeRule
import androidx.compose.ui.test.onNodeWithContentDescription
Expand Down Expand Up @@ -68,16 +69,17 @@ class CalendarTest {
@Ignore("performScrollTo doesn't work with LazyLists: issuetracker.google.com/178483889")
@Test
fun scrollsToTheBottom() {
composeTestRule.onNodeWithContentDescription("January 1").assertExists()
composeTestRule.onNodeWithContentDescription("January 1").assertIsDisplayed()
composeTestRule.onNodeWithContentDescription("December 31").performScrollTo().performClick()
assert(datesRepository.datesSelected.toString() == "Dec 31")
}

@Test
fun onDaySelected() {
composeTestRule.onNodeWithContentDescription("January 1").assertExists()
composeTestRule.onNodeWithContentDescription("January 2").assertExists().performClick()
composeTestRule.onNodeWithContentDescription("January 3").assertExists()
composeTestRule.onNodeWithContentDescription("January 1").assertIsDisplayed()
composeTestRule.onNodeWithContentDescription("January 2")
.assertIsDisplayed().performClick()
composeTestRule.onNodeWithContentDescription("January 3").assertIsDisplayed()

val datesNoSelected = composeTestRule.onDateNodes(NoSelected)
datesNoSelected[0].assertContentDescriptionEquals("January 1")
Expand All @@ -88,13 +90,15 @@ class CalendarTest {

@Test
fun twoDaysSelected() {
composeTestRule.onNodeWithContentDescription("January 2").assertExists().performClick()
composeTestRule.onNodeWithContentDescription("January 2")
.assertIsDisplayed().performClick()

val datesNoSelectedOneClick = composeTestRule.onDateNodes(NoSelected)
datesNoSelectedOneClick[0].assertContentDescriptionEquals("January 1")
datesNoSelectedOneClick[1].assertContentDescriptionEquals("January 3")

composeTestRule.onNodeWithContentDescription("January 4").assertExists().performClick()
composeTestRule.onNodeWithContentDescription("January 4")
.assertIsDisplayed().performClick()

composeTestRule.onDateNode(FirstDay).assertContentDescriptionEquals("January 2")
composeTestRule.onDateNode(Selected).assertContentDescriptionEquals("January 3")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@

package androidx.compose.samples.crane.home

import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.junit4.createAndroidComposeRule
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
import dagger.hilt.android.testing.HiltAndroidRule
import dagger.hilt.android.testing.HiltAndroidTest
import org.junit.Before
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test

Expand All @@ -41,14 +43,15 @@ class HomeTest {
}
}

@Ignore("Swipeable bug makes the app crash: https://issuetracker.google.com/180488877")
@Test
fun home_navigatesToAllScreens() {
composeTestRule.onNodeWithText("Explore Flights by Destination").assertExists()
composeTestRule.onNodeWithText("Explore Flights by Destination").assertIsDisplayed()
composeTestRule.onNodeWithText("SLEEP").performClick()
composeTestRule.onNodeWithText("Explore Properties by Destination").assertExists()
composeTestRule.onNodeWithText("Explore Properties by Destination").assertIsDisplayed()
composeTestRule.onNodeWithText("EAT").performClick()
composeTestRule.onNodeWithText("Explore Restaurants by Destination").assertExists()
composeTestRule.onNodeWithText("Explore Restaurants by Destination").assertIsDisplayed()
composeTestRule.onNodeWithText("FLY").performClick()
composeTestRule.onNodeWithText("Explore Flights by Destination").assertExists()
composeTestRule.onNodeWithText("Explore Flights by Destination").assertIsDisplayed()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.preferredSize
import androidx.compose.foundation.layout.preferredWidth
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.material.Icon
import androidx.compose.material.LocalContentColor
Expand All @@ -39,6 +39,7 @@ import androidx.compose.samples.crane.ui.captionTextStyle
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.tooling.preview.Preview
Expand Down Expand Up @@ -104,7 +105,7 @@ fun CraneEditableUserInput(
} else {
MaterialTheme.typography.body1.copy(color = LocalContentColor.current)
},
cursorColor = LocalContentColor.current
cursorBrush = SolidColor(LocalContentColor.current)
)
}
}
Expand All @@ -123,20 +124,20 @@ private fun CraneBaseUserInput(
Row(Modifier.padding(all = 12.dp)) {
if (vectorImageId != null) {
Icon(
modifier = Modifier.preferredSize(24.dp, 24.dp),
modifier = Modifier.size(24.dp, 24.dp),
painter = painterResource(id = vectorImageId),
tint = if (tintIcon()) tint else Color(0x80FFFFFF),
contentDescription = null
)
Spacer(Modifier.preferredWidth(8.dp))
Spacer(Modifier.width(8.dp))
}
if (caption != null && showCaption()) {
Text(
modifier = Modifier.align(Alignment.CenterVertically),
text = caption,
style = (captionTextStyle).copy(color = tint)
)
Spacer(Modifier.preferredWidth(8.dp))
Spacer(Modifier.width(8.dp))
}
Row(Modifier.weight(1f).align(Alignment.CenterVertically)) {
content()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.preferredHeight
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
Expand All @@ -47,7 +47,7 @@ fun CraneDrawer(modifier: Modifier = Modifier) {
contentDescription = stringResource(R.string.cd_drawer)
)
for (screen in screens) {
Spacer(Modifier.preferredHeight(24.dp))
Spacer(Modifier.height(24.dp))
Text(text = screen, style = MaterialTheme.typography.h4)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.Image
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.ExperimentalLayout
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.preferredWidth
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Tab
Expand Down Expand Up @@ -58,7 +57,7 @@ fun CraneTabBar(
painter = painterResource(id = R.drawable.ic_menu),
contentDescription = stringResource(id = R.string.cd_menu)
)
Spacer(Modifier.preferredWidth(8.dp))
Spacer(Modifier.width(8.dp))
Image(
painter = painterResource(id = R.drawable.ic_crane_logo),
contentDescription = null
Expand All @@ -72,7 +71,6 @@ fun CraneTabBar(
}
}

@OptIn(ExperimentalLayout::class)
@Composable
fun CraneTabs(
modifier: Modifier = Modifier,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.preferredHeight
import androidx.compose.foundation.layout.preferredSize
import androidx.compose.foundation.layout.preferredWidth
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.RoundedCornerShape
Expand Down Expand Up @@ -62,7 +62,7 @@ fun ExploreSection(
text = title,
style = MaterialTheme.typography.caption.copy(color = crane_caption)
)
Spacer(Modifier.preferredHeight(8.dp))
Spacer(Modifier.height(8.dp))
LazyColumn(
modifier = Modifier.weight(1f),
) {
Expand Down Expand Up @@ -101,21 +101,21 @@ private fun ExploreItem(
loading = {
Box(Modifier.fillMaxSize()) {
Image(
modifier = Modifier.preferredSize(36.dp).align(Alignment.Center),
modifier = Modifier.size(36.dp).align(Alignment.Center),
painter = painterResource(id = R.drawable.ic_crane_logo),
contentDescription = null
)
}
}
)
}
Spacer(Modifier.preferredWidth(24.dp))
Spacer(Modifier.width(24.dp))
Column {
Text(
text = item.city.nameToDisplay,
style = MaterialTheme.typography.h6
)
Spacer(Modifier.preferredHeight(8.dp))
Spacer(Modifier.height(8.dp))
Text(
text = item.description,
style = MaterialTheme.typography.caption.copy(color = crane_caption)
Expand All @@ -126,7 +126,7 @@ private fun ExploreItem(

@Composable
private fun ExploreImageContainer(content: @Composable () -> Unit) {
Surface(Modifier.preferredSize(width = 60.dp, height = 60.dp), RoundedCornerShape(4.dp)) {
Surface(Modifier.size(width = 60.dp, height = 60.dp), RoundedCornerShape(4.dp)) {
content()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.preferredHeight
import androidx.compose.foundation.layout.preferredHeightIn
import androidx.compose.foundation.layout.preferredSize
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.foundation.lazy.LazyColumn
Expand Down Expand Up @@ -64,11 +64,11 @@ fun Calendar(
modifier: Modifier = Modifier
) {
LazyColumn(modifier) {
item { Spacer(Modifier.preferredHeight(32.dp)) }
item { Spacer(Modifier.height(32.dp)) }
for (month in calendarYear) {
itemsCalendarMonth(month = month, onDayClicked = onDayClicked)
item {
Spacer(Modifier.preferredHeight(32.dp))
Spacer(Modifier.height(32.dp))
}
}
}
Expand Down Expand Up @@ -102,7 +102,7 @@ private fun Week(
Row(modifier = modifier) {
val spaceModifiers = Modifier
.weight(1f)
.preferredHeightIn(max = CELL_SIZE)
.heightIn(max = CELL_SIZE)
Surface(modifier = spaceModifiers, color = leftFillColor) {
Spacer(Modifier.fillMaxHeight())
}
Expand Down Expand Up @@ -175,7 +175,7 @@ private fun DayContainer(
) {
// What if this doesn't fit the screen? - LayoutFlexible(1f) + LayoutAspectRatio(1f)
Surface(
modifier = modifier.preferredSize(width = CELL_SIZE, height = CELL_SIZE),
modifier = modifier.size(width = CELL_SIZE, height = CELL_SIZE),
color = backgroundColor
) {
content()
Expand Down Expand Up @@ -234,7 +234,7 @@ private fun LazyListScope.itemsCalendarMonth(
)
}
item {
Spacer(Modifier.preferredHeight(8.dp))
Spacer(Modifier.height(8.dp))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ 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.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.preferredHeight
import androidx.compose.material.Button
import androidx.compose.material.ButtonDefaults
import androidx.compose.material.MaterialTheme
Expand Down Expand Up @@ -121,7 +121,7 @@ fun DetailsScreen(
@Composable
fun DetailsContent(exploreModel: ExploreModel) {
Column(verticalArrangement = Arrangement.Center) {
Spacer(Modifier.preferredHeight(32.dp))
Spacer(Modifier.height(32.dp))
Text(
modifier = Modifier.align(Alignment.CenterHorizontally),
text = exploreModel.city.nameToDisplay,
Expand All @@ -132,7 +132,7 @@ fun DetailsContent(exploreModel: ExploreModel) {
text = exploreModel.description,
style = MaterialTheme.typography.h6
)
Spacer(Modifier.preferredHeight(16.dp))
Spacer(Modifier.height(16.dp))
CityMapView(exploreModel.city.latitude, exploreModel.city.longitude)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ import androidx.compose.material.BackdropScaffold
import androidx.compose.material.BackdropValue
import androidx.compose.material.DrawerValue
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.ModalDrawerLayout
import androidx.compose.material.ModalDrawer
import androidx.compose.material.rememberBackdropScaffoldState
import androidx.compose.material.rememberDrawerState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.livedata.observeAsState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.samples.crane.base.CraneDrawer
import androidx.compose.samples.crane.base.CraneTabBar
Expand All @@ -37,6 +38,7 @@ import androidx.compose.samples.crane.data.ExploreModel
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.lifecycle.viewmodel.compose.viewModel
import kotlinx.coroutines.launch

typealias OnExploreItemClicked = (ExploreModel) -> Unit

Expand All @@ -51,19 +53,23 @@ fun CraneHome(
modifier: Modifier = Modifier,
) {
val drawerState = rememberDrawerState(DrawerValue.Closed)
ModalDrawerLayout(
ModalDrawer(
drawerState = drawerState,
gesturesEnabled = drawerState.isOpen,
drawerContent = { CraneDrawer() },
bodyContent = {
CraneHomeContent(
modifier = modifier,
onExploreItemClicked = onExploreItemClicked,
onDateSelectionClicked = onDateSelectionClicked,
openDrawer = { drawerState.open() }
)
}
)
) {
val scope = rememberCoroutineScope()
CraneHomeContent(
modifier = modifier,
onExploreItemClicked = onExploreItemClicked,
onDateSelectionClicked = onDateSelectionClicked,
openDrawer = {
scope.launch {
drawerState.open()
}
}
)
}
}

@OptIn(ExperimentalMaterialApi::class)
Expand Down
Loading