Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package com.android.ai.samples.geminilivetodo.data

import kotlin.random.Random


Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove this, I will run detekt in a separate PR.

data class Todo(
val id: Int = Random.nextInt(),
val task: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class TodoRepository @Inject constructor() {

fun getTodoList(): List<Todo> = _todos.value

fun addTodo(taskDescription: String) : Int? {
fun addTodo(taskDescription: String): Int? {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove this.

if (taskDescription.isNotBlank()) {
val newTodo = Todo(task = taskDescription)
_todos.update { currentList ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.JsonPrimitive
import kotlinx.serialization.json.int
import kotlinx.serialization.json.jsonPrimitive
import kotlinx.serialization.json.long
Comment thread
yrezgui marked this conversation as resolved.

@OptIn(PublicPreviewAPI::class)
@HiltViewModel
Expand Down Expand Up @@ -198,7 +197,7 @@ class TodoScreenViewModel @Inject constructor(private val todoRepository: TodoRe
val taskDescription = functionCall.args["taskDescription"]!!.jsonPrimitive.content
val id = todoRepository.addTodo(taskDescription)

if (id!=null) {
if (id != null) {
val response = JsonObject(
mapOf(
"success" to JsonPrimitive(true),
Expand All @@ -215,7 +214,6 @@ class TodoScreenViewModel @Inject constructor(private val todoRepository: TodoRe
)
FunctionResponsePart(functionCall.name, response, functionCall.id)
}

}
"removeTodo" -> {
try {
Expand All @@ -237,7 +235,6 @@ class TodoScreenViewModel @Inject constructor(private val todoRepository: TodoRe
)
FunctionResponsePart(functionCall.name, response, functionCall.id)
}

}
"toggleTodoStatus" -> {
val taskId = functionCall.args["todoId"]!!.jsonPrimitive.int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,27 @@ data class VideoItem(
val uri: Uri,
)

const val VIDEO_BASE_URL = "https://storage.googleapis.com/androiddevelopers/samples_assets"

val sampleVideoList = listOf(
VideoItem(
R.string.video_title_android_spotlight_shorts,
"https://storage.googleapis.com/exoplayer-test-media-0/shorts_android_developers/shorts_10.mp4".toUri(),
"$VIDEO_BASE_URL/exoplayer-test-media-0/shorts_android_developers/shorts_10.mp4".toUri(),
),
VideoItem(
R.string.video_title_big_buck_bunny,
"https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4".toUri(),
"$VIDEO_BASE_URL/gtv-videos-bucket/sample/BigBuckBunny.mp4".toUri(),
),
VideoItem(
R.string.video_title_tears_of_steel,
"https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/TearsOfSteel.mp4".toUri(),
"$VIDEO_BASE_URL/gtv-videos-bucket/sample/TearsOfSteel.mp4".toUri(),
),
VideoItem(
R.string.video_title_for_bigger_blazes,
"https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4".toUri(),
"$VIDEO_BASE_URL/gtv-videos-bucket/sample/ForBiggerBlazes.mp4".toUri(),
),
VideoItem(
R.string.video_title_for_bigger_escape,
"https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerEscapes.mp4".toUri(),
"$VIDEO_BASE_URL/gtv-videos-bucket/sample/ForBiggerEscapes.mp4".toUri(),
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,31 @@ data class VideoItem(
val uri: Uri,
)

const val VIDEO_BASE_URL = "https://storage.googleapis.com/androiddevelopers/samples_assets"

val sampleVideoList = listOf(
VideoItem(
R.string.video_title_big_buck_bunny,
"https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4".toUri(),
"$VIDEO_BASE_URL/gtv-videos-bucket/sample/BigBuckBunny.mp4".toUri(),
),
VideoItem(
R.string.video_title_android_spotlight_shorts,
"https://storage.googleapis.com/exoplayer-test-media-0/shorts_android_developers/shorts_10.mp4".toUri(),
"$VIDEO_BASE_URL/exoplayer-test-media-0/shorts_android_developers/shorts_10.mp4".toUri(),
),
VideoItem(
R.string.video_title_youtube_google_tv,
"https://www.youtube.com/watch?v=QFMIP5GOo70".toUri(),
),
VideoItem(
R.string.video_title_tears_of_steel,
"https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/TearsOfSteel.mp4".toUri(),
"$VIDEO_BASE_URL/gtv-videos-bucket/sample/TearsOfSteel.mp4".toUri(),
),
VideoItem(
R.string.video_title_for_bigger_blazes,
"https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4".toUri(),
"$VIDEO_BASE_URL/gtv-videos-bucket/sample/ForBiggerBlazes.mp4".toUri(),
),
VideoItem(
R.string.video_title_for_bigger_escape,
"https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerEscapes.mp4".toUri(),
"$VIDEO_BASE_URL/gtv-videos-bucket/sample/ForBiggerEscapes.mp4".toUri(),
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,13 @@ fun VideoPickerDropdown(
}
}

const val VIDEO_BASE_URL = "https://storage.googleapis.com/androiddevelopers/samples_assets/gtv-videos-bucket/sample"

// Sample data for the picker
private val sampleVideosForPicker = listOf(
VideoPickerData("Big Buck Bunny", "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4".toUri()),
VideoPickerData("Tears of Steel", "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/TearsOfSteel.mp4".toUri()),
VideoPickerData("For Bigger Blazes", "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4".toUri()),
VideoPickerData("Big Buck Bunny", "$VIDEO_BASE_URL/BigBuckBunny.mp4".toUri()),
VideoPickerData("Tears of Steel", "$VIDEO_BASE_URL/TearsOfSteel.mp4".toUri()),
VideoPickerData("For Bigger Blazes", "$VIDEO_BASE_URL/ForBiggerBlazes.mp4".toUri()),
)

@Preview
Expand Down
Loading