Skip to content

Commit dac1a9e

Browse files
authored
Topic detail pane placeholder (#1280)
* Topic detail pane placeholder Change-Id: I92b84493a5406240285c0759b30aa10d29871f09 * Add modifier parameter Change-Id: Ie363be83b44f26291030c04c1513cecb851a6899
1 parent 0fce45c commit dac1a9e

File tree

4 files changed

+129
-5
lines changed

4 files changed

+129
-5
lines changed

app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/interests2pane/InterestsListDetailScreen.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
package com.google.samples.apps.nowinandroid.ui.interests2pane
1818

1919
import androidx.activity.compose.BackHandler
20-
import androidx.compose.foundation.layout.Box
21-
import androidx.compose.material3.Text
2220
import androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi
2321
import androidx.compose.material3.adaptive.layout.ListDetailPaneScaffold
2422
import androidx.compose.material3.adaptive.layout.ListDetailPaneScaffoldRole
@@ -39,6 +37,7 @@ import androidx.navigation.navArgument
3937
import com.google.samples.apps.nowinandroid.feature.interests.InterestsRoute
4038
import com.google.samples.apps.nowinandroid.feature.interests.navigation.INTERESTS_ROUTE
4139
import com.google.samples.apps.nowinandroid.feature.interests.navigation.TOPIC_ID_ARG
40+
import com.google.samples.apps.nowinandroid.feature.topic.TopicDetailPlaceholder
4241
import com.google.samples.apps.nowinandroid.feature.topic.navigation.TOPIC_ROUTE
4342
import com.google.samples.apps.nowinandroid.feature.topic.navigation.navigateToTopic
4443
import com.google.samples.apps.nowinandroid.feature.topic.navigation.topicScreen
@@ -113,9 +112,7 @@ internal fun InterestsListDetailScreen(
113112
onTopicClick = ::onTopicClickShowDetailPane,
114113
)
115114
composable(route = TOPIC_ROUTE) {
116-
Box {
117-
Text("Placeholder")
118-
}
115+
TopicDetailPlaceholder()
119116
}
120117
}
121118
},
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
* Copyright 2024 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.samples.apps.nowinandroid.feature.topic
18+
19+
import androidx.compose.foundation.layout.Arrangement
20+
import androidx.compose.foundation.layout.Column
21+
import androidx.compose.foundation.layout.fillMaxSize
22+
import androidx.compose.foundation.shape.RoundedCornerShape
23+
import androidx.compose.material3.Card
24+
import androidx.compose.material3.CardDefaults
25+
import androidx.compose.material3.Icon
26+
import androidx.compose.material3.MaterialTheme
27+
import androidx.compose.material3.Text
28+
import androidx.compose.runtime.Composable
29+
import androidx.compose.ui.Alignment
30+
import androidx.compose.ui.Modifier
31+
import androidx.compose.ui.res.painterResource
32+
import androidx.compose.ui.res.stringResource
33+
import androidx.compose.ui.tooling.preview.Preview
34+
import androidx.compose.ui.unit.dp
35+
import com.google.samples.apps.nowinandroid.core.designsystem.theme.NiaTheme
36+
37+
@Composable
38+
fun TopicDetailPlaceholder(modifier: Modifier = Modifier) {
39+
Card(
40+
modifier = modifier,
41+
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant),
42+
shape = RoundedCornerShape(24.dp, 24.dp, 0.dp, 0.dp),
43+
) {
44+
Column(
45+
modifier = Modifier.fillMaxSize(),
46+
horizontalAlignment = Alignment.CenterHorizontally,
47+
verticalArrangement = Arrangement.spacedBy(
48+
20.dp,
49+
alignment = Alignment.CenterVertically,
50+
),
51+
) {
52+
Icon(
53+
painter = painterResource(id = R.drawable.feature_topic_ic_topic_placeholder),
54+
contentDescription = null,
55+
tint = MaterialTheme.colorScheme.primary,
56+
)
57+
Text(
58+
text = stringResource(id = R.string.feature_topic_select_an_interest),
59+
style = MaterialTheme.typography.titleLarge,
60+
)
61+
}
62+
}
63+
}
64+
65+
@Preview(widthDp = 200, heightDp = 300)
66+
@Composable
67+
fun TopicDetailPlaceholderPreview() {
68+
NiaTheme {
69+
TopicDetailPlaceholder()
70+
}
71+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright 2024 The Android Open Source Project
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
18+
android:width="64dp"
19+
android:height="64dp"
20+
android:viewportWidth="64"
21+
android:viewportHeight="64">
22+
<path
23+
android:fillColor="#00000000"
24+
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"
25+
android:strokeColor="#8C4190"
26+
android:strokeWidth="2" />
27+
<path
28+
android:fillColor="#00000000"
29+
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"
30+
android:strokeColor="#8C4190"
31+
android:strokeWidth="2" />
32+
<path
33+
android:fillColor="#00000000"
34+
android:pathData="M6,23a10,10 0,1 1,20 0a10,10 0,1 1,-20 0"
35+
android:strokeColor="#8C4190"
36+
android:strokeWidth="2" />
37+
<path
38+
android:fillColor="#00000000"
39+
android:pathData="M10,23l4,4l7.5,-7.5"
40+
android:strokeColor="#8C4190"
41+
android:strokeLineCap="round"
42+
android:strokeWidth="1.6"/>
43+
<path
44+
android:fillColor="#00000000"
45+
android:pathData="M30,42H50 M30,52H50 M30,47H44 M30,37H42 M46,37H50 M30,57H35"
46+
android:strokeColor="#8C4190"
47+
android:strokeLineCap="round"
48+
android:strokeWidth="2" />
49+
<path
50+
android:fillColor="#00000000"
51+
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"
52+
android:strokeColor="#8C4190"
53+
android:strokeLineCap="round"
54+
android:strokeWidth="2" />
55+
</vector>

feature/topic/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@
1616
-->
1717
<resources>
1818
<string name="feature_topic_loading">Loading topic</string>
19+
<string name="feature_topic_select_an_interest">Select an Interest</string>
1920
</resources>

0 commit comments

Comments
 (0)