-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Demonstrate scrolling dialogs #2002
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,15 +16,25 @@ | |
|
||
package com.google.android.horologist.screensizes | ||
|
||
import android.R | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.filled.Check | ||
import androidx.compose.material.icons.filled.Close | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.wear.compose.material.MaterialTheme | ||
import androidx.wear.compose.material.Text | ||
import androidx.wear.compose.material.dialog.Alert | ||
import com.google.android.horologist.compose.layout.ScalingLazyColumnState | ||
import com.google.android.horologist.compose.layout.rememberColumnState | ||
import com.google.android.horologist.compose.material.AlertContent | ||
import com.google.android.horologist.compose.material.Button | ||
import com.google.android.horologist.compose.material.ResponsiveDialogContent | ||
import com.google.android.horologist.compose.material.ToggleChip | ||
import com.google.android.horologist.compose.material.ToggleChipToggleControl | ||
import com.google.android.horologist.compose.tools.Device | ||
import kotlinx.coroutines.runBlocking | ||
import org.junit.Test | ||
|
||
class DialogTest(device: Device) : ScreenSizeTest( | ||
|
@@ -70,4 +80,54 @@ class DialogTest(device: Device) : ScreenSizeTest( | |
} | ||
} | ||
} | ||
|
||
@Test | ||
fun longDialogScreen1() { | ||
lateinit var columnState: ScalingLazyColumnState | ||
|
||
runTest(testFn = { | ||
screenshotTestRule.interact { | ||
runBlocking { | ||
columnState.state.scrollToItem(999, 0) | ||
} | ||
} | ||
|
||
screenshotTestRule.takeScreenshot() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should this be called from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure I wanted the minimal way to let me get multiple screenshots. I should improve the API. Will follow up. |
||
}) { | ||
columnState = rememberColumnState() | ||
|
||
ResponsiveDialogContent( | ||
title = { | ||
Text( | ||
text = "Turn on Bedtime mode?", | ||
color = MaterialTheme.colors.onBackground, | ||
textAlign = TextAlign.Center, | ||
maxLines = 3, | ||
) | ||
}, | ||
onOkButtonClick = {}, | ||
onCancelButtonClick = {}, | ||
okButtonContentDescription = stringResource(R.string.ok), | ||
cancelButtonContentDescription = stringResource(R.string.cancel), | ||
state = columnState, | ||
) { | ||
item { | ||
Text( | ||
text = "Watch screen, tilt-to-wake, and touch are turned off. " + | ||
"Only calls from starred contacts, repeat callers, " + | ||
"and alarms will notify you.", | ||
textAlign = TextAlign.Left, | ||
) | ||
} | ||
item { | ||
ToggleChip( | ||
checked = false, | ||
onCheckedChanged = {}, | ||
label = "Don't show again", | ||
toggleControl = ToggleChipToggleControl.Checkbox, | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: drop 1 from name