From 70dcd5119d694b6582eee27fe71952fc2667fd95 Mon Sep 17 00:00:00 2001 From: Don Turner Date: Fri, 15 Mar 2024 13:32:00 +0000 Subject: [PATCH 1/2] Make path to module graph image dynamic. Fixes #1286 Change-Id: I595a841ef7b06cccc959ca96d18824f4fad4c261 --- app-nia-catalog/README.md | 2 +- app/README.md | 2 +- generateModuleGraphs.sh | 15 ++++++++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app-nia-catalog/README.md b/app-nia-catalog/README.md index 99503ba84..cf6d05f4f 100644 --- a/app-nia-catalog/README.md +++ b/app-nia-catalog/README.md @@ -1,3 +1,3 @@ # :app-nia-catalog module ## Dependency graph -![Dependency graph](../../docs/images/graphs/dep_graph_app_nia_catalog.svg) +![Dependency graph](../docs/images/graphs/dep_graph_app_nia_catalog.svg) diff --git a/app/README.md b/app/README.md index f80083494..a3fb4572a 100644 --- a/app/README.md +++ b/app/README.md @@ -1,3 +1,3 @@ # :app module ## Dependency graph -![Dependency graph](../../docs/images/graphs/dep_graph_app.svg) +![Dependency graph](../docs/images/graphs/dep_graph_app.svg) diff --git a/generateModuleGraphs.sh b/generateModuleGraphs.sh index 27dea22da..faeac9a30 100755 --- a/generateModuleGraphs.sh +++ b/generateModuleGraphs.sh @@ -56,14 +56,23 @@ check_and_create_readme() { local file_name="$2" local readme_path="${module_path:1}" # Remove leading colon - readme_path=${readme_path//:/\/} # Replace colons with slashes using sed + readme_path=${readme_path//:/\/} # Replace colons with slashes readme_path="${readme_path}/README.md" #Append the filename # Check if README.md exists and create it if not if [[ ! -f "$readme_path" ]]; then echo "Creating README.md for ${module_path}" - # Calculate the correct relative path to the image - local relative_image_path="../../docs/images/graphs/${file_name}.svg" + + # Determine the depth of the module based on the number of colons + local depth=$(awk -F: '{print NF-1}' <<< "${module_path}") + + # Construct the relative image path with the correct number of "../" + local relative_image_path="../" + for ((i=1; i<$depth; i++)); do + relative_image_path+="../" + done + relative_image_path+="docs/images/graphs/${file_name}.svg" + echo "# ${module_path} module" > "$readme_path" echo "## Dependency graph" >> "$readme_path" echo "![Dependency graph](${relative_image_path})" >> "$readme_path" From dac1a9e446dd8bd41012227ba59bb65ffba7adad Mon Sep 17 00:00:00 2001 From: Jonathan Koren Date: Fri, 15 Mar 2024 09:39:26 -0700 Subject: [PATCH 2/2] Topic detail pane placeholder (#1280) * Topic detail pane placeholder Change-Id: I92b84493a5406240285c0759b30aa10d29871f09 * Add modifier parameter Change-Id: Ie363be83b44f26291030c04c1513cecb851a6899 --- .../InterestsListDetailScreen.kt | 7 +- .../feature/topic/TopicDetailPlaceholder.kt | 71 +++++++++++++++++++ .../feature_topic_ic_topic_placeholder.xml | 55 ++++++++++++++ feature/topic/src/main/res/values/strings.xml | 1 + 4 files changed, 129 insertions(+), 5 deletions(-) create mode 100644 feature/topic/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/topic/TopicDetailPlaceholder.kt create mode 100644 feature/topic/src/main/res/drawable/feature_topic_ic_topic_placeholder.xml diff --git a/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/interests2pane/InterestsListDetailScreen.kt b/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/interests2pane/InterestsListDetailScreen.kt index b3594b81f..335f83371 100644 --- a/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/interests2pane/InterestsListDetailScreen.kt +++ b/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/interests2pane/InterestsListDetailScreen.kt @@ -17,8 +17,6 @@ package com.google.samples.apps.nowinandroid.ui.interests2pane import androidx.activity.compose.BackHandler -import androidx.compose.foundation.layout.Box -import androidx.compose.material3.Text import androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi import androidx.compose.material3.adaptive.layout.ListDetailPaneScaffold import androidx.compose.material3.adaptive.layout.ListDetailPaneScaffoldRole @@ -39,6 +37,7 @@ import androidx.navigation.navArgument import com.google.samples.apps.nowinandroid.feature.interests.InterestsRoute import com.google.samples.apps.nowinandroid.feature.interests.navigation.INTERESTS_ROUTE import com.google.samples.apps.nowinandroid.feature.interests.navigation.TOPIC_ID_ARG +import com.google.samples.apps.nowinandroid.feature.topic.TopicDetailPlaceholder import com.google.samples.apps.nowinandroid.feature.topic.navigation.TOPIC_ROUTE import com.google.samples.apps.nowinandroid.feature.topic.navigation.navigateToTopic import com.google.samples.apps.nowinandroid.feature.topic.navigation.topicScreen @@ -113,9 +112,7 @@ internal fun InterestsListDetailScreen( onTopicClick = ::onTopicClickShowDetailPane, ) composable(route = TOPIC_ROUTE) { - Box { - Text("Placeholder") - } + TopicDetailPlaceholder() } } }, diff --git a/feature/topic/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/topic/TopicDetailPlaceholder.kt b/feature/topic/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/topic/TopicDetailPlaceholder.kt new file mode 100644 index 000000000..627fb8fb3 --- /dev/null +++ b/feature/topic/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/topic/TopicDetailPlaceholder.kt @@ -0,0 +1,71 @@ +/* + * Copyright 2024 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.samples.apps.nowinandroid.feature.topic + +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Card +import androidx.compose.material3.CardDefaults +import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import com.google.samples.apps.nowinandroid.core.designsystem.theme.NiaTheme + +@Composable +fun TopicDetailPlaceholder(modifier: Modifier = Modifier) { + Card( + modifier = modifier, + colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant), + shape = RoundedCornerShape(24.dp, 24.dp, 0.dp, 0.dp), + ) { + Column( + modifier = Modifier.fillMaxSize(), + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.spacedBy( + 20.dp, + alignment = Alignment.CenterVertically, + ), + ) { + Icon( + painter = painterResource(id = R.drawable.feature_topic_ic_topic_placeholder), + contentDescription = null, + tint = MaterialTheme.colorScheme.primary, + ) + Text( + text = stringResource(id = R.string.feature_topic_select_an_interest), + style = MaterialTheme.typography.titleLarge, + ) + } + } +} + +@Preview(widthDp = 200, heightDp = 300) +@Composable +fun TopicDetailPlaceholderPreview() { + NiaTheme { + TopicDetailPlaceholder() + } +} diff --git a/feature/topic/src/main/res/drawable/feature_topic_ic_topic_placeholder.xml b/feature/topic/src/main/res/drawable/feature_topic_ic_topic_placeholder.xml new file mode 100644 index 000000000..0518401da --- /dev/null +++ b/feature/topic/src/main/res/drawable/feature_topic_ic_topic_placeholder.xml @@ -0,0 +1,55 @@ + + + + + + + + + + diff --git a/feature/topic/src/main/res/values/strings.xml b/feature/topic/src/main/res/values/strings.xml index 5fefc3f42..fe4a6dc29 100644 --- a/feature/topic/src/main/res/values/strings.xml +++ b/feature/topic/src/main/res/values/strings.xml @@ -16,4 +16,5 @@ --> Loading topic + Select an Interest