Skip to content

A fully functional Android app built entirely with Kotlin and Jetpack Compose

Topic detail pane placeholder (#1280)

Jonathan Korendac1a9e446dd
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 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ 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
+
+ http://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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="64dp"
+ android:height="64dp"
+ android:viewportWidth="64"
+ android:viewportHeight="64">
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M1,14.125C1,10.742 3.742,8 7.125,8H49.875C53.258,8 56,10.742 56,14.125V56.875C56,60.258 53.258,63 49.875,63H7.125C3.742,63 1,60.258 1,56.875V14.125Z"
+ android:strokeColor="#8C4190"
+ android:strokeWidth="2" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M31,18.79C31,17.437 31.307,16.536 31.768,15.988C32.203,15.469 32.895,15.125 34.008,15.125H47.367C48.119,15.125 48.846,15.306 49.377,15.775C49.883,16.223 50.375,17.08 50.375,18.79V27.272C50.375,28.871 50.054,29.737 49.63,30.208C49.229,30.654 48.56,30.938 47.367,30.938H34.008C32.719,30.938 32.046,30.497 31.65,29.94C31.211,29.322 31,28.399 31,27.272V18.79Z"
+ android:strokeColor="#8C4190"
+ android:strokeWidth="2" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M6,23a10,10 0,1 1,20 0a10,10 0,1 1,-20 0"
+ android:strokeColor="#8C4190"
+ android:strokeWidth="2" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M10,23l4,4l7.5,-7.5"
+ android:strokeColor="#8C4190"
+ android:strokeLineCap="round"
+ android:strokeWidth="1.6"/>
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M30,42H50 M30,52H50 M30,47H44 M30,37H42 M46,37H50 M30,57H35"
+ android:strokeColor="#8C4190"
+ android:strokeLineCap="round"
+ android:strokeWidth="2" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M12,5C12,5 14,2 19,2C22.699,2 40.627,2 49.707,2C53.103,2 56.349,3.349 58.75,5.75V5.75C61.151,8.151 62.5,11.408 62.5,14.803V51"
+ android:strokeColor="#8C4190"
+ android:strokeLineCap="round"
+ android:strokeWidth="2" />
+</vector>
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 @@
-->
<resources>
<string name="feature_topic_loading">Loading topic</string>
+ <string name="feature_topic_select_an_interest">Select an Interest</string>
</resources>