Skip to content

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

Create template for composable Resource card

Caren Chang841f9af5d16e
diff --git a/app/src/main/java/com/google/samples/apps/nowinandroid/ui/ResourceCard.kt b/app/src/main/java/com/google/samples/apps/nowinandroid/ui/ResourceCard.kt
new file mode 100644
index 000000000..2db7eb367
--- /dev/null
+++ b/app/src/main/java/com/google/samples/apps/nowinandroid/ui/ResourceCard.kt
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2022 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.ui
+
+import android.content.res.Configuration
+import androidx.compose.material.Surface
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.tooling.preview.Preview
+import com.google.samples.apps.nowinandroid.data.news.NewsResource
+import com.google.samples.apps.nowinandroid.ui.theme.NiaTheme
+
+/**
+ * [com.google.samples.apps.nowinandroid.data.news.NewsResource] card used on the following screens:
+ * For You, Episodes, Saved
+ */
+
+@Composable
+fun ResourceAuthors(
+ newsResource: NewsResource
+) {
+ TODO()
+}
+
+@Composable
+fun ResourceHeaderImage(
+ newsResource: NewsResource
+) {
+ TODO()
+}
+
+@Composable
+fun ResourceTitle(
+ newsResource: NewsResource
+) {
+ TODO()
+}
+
+@Composable
+fun ResourceDate(
+ newsResource: NewsResource
+) {
+ TODO()
+}
+
+@Composable
+fun ResourceLink(
+ newsResource: NewsResource
+) {
+ TODO()
+}
+
+@Composable
+fun ResourceShortDescription(
+ newsResource: NewsResource
+) {
+ TODO()
+}
+
+@Composable
+fun ResourceTopics(
+ newsResource: NewsResource
+) {
+ TODO()
+}
+
+@Composable
+fun ResourceCardExpanded() {
+ TODO()
+}
+
+@Preview("Expanded resource card")
+@Preview("Expanded resource card (dark)", uiMode = Configuration.UI_MODE_NIGHT_YES)
+@Composable
+fun ExpandedResourcePreview() {
+ NiaTheme {
+ Surface {
+ ResourceCardExpanded()
+ }
+ }
+}