Skip to content

Commit

Permalink
Add material confirmation sample to sample application
Browse files Browse the repository at this point in the history
  • Loading branch information
oas004 committed Dec 1, 2023
1 parent ddc30f2 commit 39e55f7
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.android.horologist.materialcomponents

import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.wear.compose.material.Text
import com.google.android.horologist.compose.material.Confirmation

@Composable
internal fun SampleConfirmationScreen(
modifier: Modifier = Modifier,
) {
Confirmation(
modifier = modifier.fillMaxSize(),
onTimeout = {},
) {
ConfirmationContent()
}
}

@Composable
private fun ConfirmationContent() {
Text(text = "Confirmation Content")
}
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ fun MenuScreen(
onClick = { navigateToRoute(Screen.MaterialCompactChips.route) },
)
}
item {
Chip(
label = stringResource(id = R.string.sample_material_confirmation_dialog),
modifier = modifier.fillMaxWidth(),
onClick = { navigateToRoute(Screen.MaterialConfirmationScreen.route) },
)
}
item {
ListHeader {
Text(text = "Rotary Scrolling")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import com.google.android.horologist.materialcomponents.SampleButtonScreen
import com.google.android.horologist.materialcomponents.SampleChipIconWithProgressScreen
import com.google.android.horologist.materialcomponents.SampleChipScreen
import com.google.android.horologist.materialcomponents.SampleCompactChipScreen
import com.google.android.horologist.materialcomponents.SampleConfirmationScreen
import com.google.android.horologist.networks.NetworkScreen
import com.google.android.horologist.pager.SamplePagerScreen
import com.google.android.horologist.paging.PagingItemScreen
Expand Down Expand Up @@ -186,6 +187,11 @@ fun SampleWearApp() {
) {
SampleCompactChipScreen(columnState = it.columnState)
}
scrollable(
route = Screen.MaterialConfirmationScreen.route
) {
SampleConfirmationScreen()
}
scrollable(
route = Screen.SectionedListMenuScreen.route,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ sealed class Screen(
object MaterialChips : Screen("materialChips")
object MaterialChipIconWithProgress : Screen("materialChipIconWithProgress")
object MaterialCompactChips : Screen("materialCompactChips")
object MaterialConfirmationScreen : Screen("materialConfirmationScreen")

object DataLayerNodes : Screen("nodes")

Expand Down
1 change: 1 addition & 0 deletions sample/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<string name="sample_material_chips">Material Chips Sample</string>
<string name="sample_material_chip_icon_with_progress">Material Chip Icon With Progress</string>
<string name="sample_material_compact_chip">Material Compact Chips</string>
<string name="sample_material_confirmation_dialog">Material Confirmation Dialog</string>

<string name="sectionedlist_samples_menu">SectionedList Samples</string>
<string name="sectionedlist_stateless_sections_menu">Stateless sections</string>
Expand Down

0 comments on commit 39e55f7

Please sign in to comment.