-
Notifications
You must be signed in to change notification settings - Fork 24
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
Upcoming instructions android #326
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
06f6716
First pass at upcoming maneuvers view for Android
ianthetechie 6ecfdb3
Make it scroll
ianthetechie b2b28c1
Apply automatic changes
ianthetechie 7aa483f
Build the content view correctly
ianthetechie 5c7a8e0
Add snapshot tests
ianthetechie a27dd87
Add s
ianthetechie 59a8b4b
Improve the expand button UX
ianthetechie d40ff98
Update snapshots
ianthetechie 1a70e36
Implement pill for expand/contract
ianthetechie f4bfe97
Regen snapshots
ianthetechie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
68 changes: 68 additions & 0 deletions
68
...mposeui/src/main/java/com/stadiamaps/ferrostar/composeui/views/controls/PillDragHandle.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,68 @@ | ||
package com.stadiamaps.ferrostar.composeui.views.controls | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.width | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.rounded.KeyboardArrowUp | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.semantics.Role | ||
import androidx.compose.ui.semantics.onClick | ||
import androidx.compose.ui.semantics.role | ||
import androidx.compose.ui.semantics.semantics | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
|
||
@Composable | ||
fun PillDragHandle( | ||
isExpanded: Boolean, | ||
modifier: Modifier = Modifier.fillMaxWidth(), | ||
iconTintColor: Color = MaterialTheme.colorScheme.onSurface, | ||
toggle: () -> Unit = {} | ||
) { | ||
val handleHeight = if (isExpanded) 36.dp else 4.dp | ||
Box(modifier = modifier.height(handleHeight).clickable(onClick = toggle)) { | ||
if (isExpanded) { | ||
Icon( | ||
Icons.Rounded.KeyboardArrowUp, | ||
modifier = Modifier.align(Alignment.Center), | ||
contentDescription = "Show upcoming maneuvers", | ||
tint = iconTintColor) | ||
} else { | ||
Box( | ||
modifier = | ||
Modifier.align(Alignment.Center) | ||
.height(handleHeight) | ||
.width(24.dp) | ||
.background(iconTintColor, RoundedCornerShape(6.dp)) | ||
.semantics { | ||
role = Role.Button | ||
onClick(label = "Hide upcoming maneuvers") { | ||
toggle() | ||
true | ||
} | ||
}) | ||
} | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
fun PreviewPillDragHandleCollapsed() { | ||
PillDragHandle(isExpanded = false, iconTintColor = Color.White) | ||
} | ||
|
||
@Preview | ||
@Composable | ||
fun PreviewPillDragHandleExpanded() { | ||
PillDragHandle(isExpanded = true, iconTintColor = Color.White) | ||
} |
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
Binary file modified
BIN
-822 Bytes
(92%)
...ages/com.stadiamaps.ferrostar.views_InstructionViewTest_testInstructionView.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.7 KB
....stadiamaps.ferrostar.views_InstructionViewTest_testInstructionViewExpanded.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-845 Bytes
(91%)
...m.stadiamaps.ferrostar.views_RTLInstructionViewTests_testRTLInstructionView.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
FWIW this came from the Material 3 spec
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.
My only comment on this is:
When material theme is used, the more complex the value is, the less likely someone has it in their theme. This isn't so much a problem. More just a warning when someone asks why their instructions row isn't changing color. It'll be because people rarely set those very nuanced values.