-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upcoming instructions android (#326)
* First pass at upcoming maneuvers view for Android * Make it scroll * Apply automatic changes * Build the content view correctly * Add snapshot tests * Add s * Improve the expand button UX * Update snapshots * Implement pill for expand/contract * Regen snapshots --------- Co-authored-by: ianthetechie <[email protected]>
- Loading branch information
1 parent
649a68c
commit 35a9dee
Showing
12 changed files
with
193 additions
and
19 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
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