parent
9fa3dadcfd
commit
def11f26ff
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* 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.core.model.data
|
||||||
|
|
||||||
|
import kotlin.random.Random
|
||||||
|
|
||||||
|
fun Random.nextFakeAuthor(
|
||||||
|
id: String = nextLong().toString(),
|
||||||
|
name: String = "Android Dev $id",
|
||||||
|
imageUrl: String = "https://example.org/dev-android/$id.png",
|
||||||
|
twitter: String = "@dev-android-$id",
|
||||||
|
mediumPage: String = "https://medium.com/dev-android/$id",
|
||||||
|
bio: String = "At vero eos et accusamus et iusto odio dignissimos ducimus qui.",
|
||||||
|
): Author = Author(
|
||||||
|
id = id,
|
||||||
|
name = name,
|
||||||
|
imageUrl = imageUrl,
|
||||||
|
twitter = twitter,
|
||||||
|
mediumPage = mediumPage,
|
||||||
|
bio = bio,
|
||||||
|
)
|
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* 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.core.model.data
|
||||||
|
|
||||||
|
import com.google.samples.apps.nowinandroid.core.model.data.NewsResourceType.Unknown
|
||||||
|
import kotlin.random.Random
|
||||||
|
import kotlinx.datetime.Instant
|
||||||
|
|
||||||
|
fun Random.nextFakeNewsResource(
|
||||||
|
id: String = nextLong().toString(),
|
||||||
|
title: String = "News resource $id",
|
||||||
|
content: String = "",
|
||||||
|
url: String = "https://example.org/news/$id",
|
||||||
|
headerImageUrl: String? = "https://example.org/news/$id.png",
|
||||||
|
publishDate: Instant = Instant.fromEpochMilliseconds(0),
|
||||||
|
type: NewsResourceType = Unknown,
|
||||||
|
authors: List<Author> = emptyList(),
|
||||||
|
topics: List<Topic> = emptyList(),
|
||||||
|
): NewsResource = NewsResource(
|
||||||
|
id = id,
|
||||||
|
title = title,
|
||||||
|
content = content,
|
||||||
|
url = url,
|
||||||
|
headerImageUrl = headerImageUrl,
|
||||||
|
publishDate = publishDate,
|
||||||
|
type = type,
|
||||||
|
authors = authors,
|
||||||
|
topics = topics,
|
||||||
|
)
|
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* 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.core.model.data
|
||||||
|
|
||||||
|
import kotlin.random.Random
|
||||||
|
|
||||||
|
fun Random.nextFakeTopic(
|
||||||
|
id: String = nextLong().toString(),
|
||||||
|
name: String = "Topic $id",
|
||||||
|
shortDescription: String = "At vero eos et accusamus.",
|
||||||
|
longDescription: String = "At vero eos et accusamus et iusto odio dignissimos ducimus qui.",
|
||||||
|
url: String = "https://example.org/topic/$id",
|
||||||
|
imageUrl: String = "https://example.org/topic/$id.png"
|
||||||
|
): Topic = Topic(
|
||||||
|
id = id,
|
||||||
|
name = name,
|
||||||
|
shortDescription = shortDescription,
|
||||||
|
longDescription = longDescription,
|
||||||
|
url = url,
|
||||||
|
imageUrl = imageUrl,
|
||||||
|
)
|
Loading…
Reference in new issue