Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
14 changes: 12 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,15 @@ secrets.properties

# This covers new IDEs, like Antigravity
.vscode/
**/bin/
.kotlin/

# Temporary verification screenshot files
*_screen*.png
sydney_final.png
*_sydney.png
*_verified.png
!**/assets/screenshots/*.png
.kotlin/
.gradle-test/
eval_runs/
__pycache__/
*.pyc
1 change: 1 addition & 0 deletions ApiDemos/project/java-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ dependencies {
implementation(libs.material)
implementation(libs.activity)
implementation(project(":ApiDemos:common-ui"))
implementation(project(":ApiDemos:reviewer"))
implementation(libs.uiautomator)
implementation(libs.maps.utils.ktx)

Expand Down

Large diffs are not rendered by default.

33 changes: 19 additions & 14 deletions ApiDemos/project/kotlin-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.compose)
alias(libs.plugins.kotlin.parcelize)
alias(libs.plugins.secrets.gradle.plugin)
}

android {
namespace = "com.example.kotlindemos"
compileSdk = libs.versions.compileSdk.get().toInt()

defaultConfig {
Expand All @@ -38,6 +40,7 @@ android {
buildFeatures {
buildConfig = true
viewBinding = true
compose = true
}

buildTypes {
Expand All @@ -56,36 +59,37 @@ android {
sarifOutput = layout.buildDirectory.file("reports/lint-results-debug.sarif").get().asFile
}

namespace = "com.example.kotlindemos"

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}

kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
freeCompilerArgs.add("-Xopt-in=kotlin.RequiresOptIn")
kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
javaParameters.set(true)
}
}
}

dependencies {
implementation(libs.appcompat)
implementation(libs.kotlin.stdlib)
implementation(libs.cardview)
implementation(libs.recyclerview)
implementation(libs.multidex)
implementation(libs.volley)
implementation(libs.material)

implementation(libs.core.ktx)
implementation(libs.lifecycle.runtime.ktx)
implementation(libs.maps.ktx)
implementation(libs.maps.utils.ktx)
implementation(libs.play.services.location)

implementation(libs.activity)
implementation(libs.activity.compose)
implementation(platform(libs.compose.bom))
implementation(libs.ui)
implementation(libs.ui.graphics)
implementation(libs.ui.tooling.preview)
implementation(libs.material3)
implementation(libs.material.icons.extended)
debugImplementation(libs.ui.tooling)
Comment on lines +85 to +92

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.

Can this go in its own commit? Adding the whole Compose stack to kotlin-app — plus dropping kotlin.stdlib, cardview, recyclerview, multidex, volley and the -Xopt-in compiler arg — is a fair-sized change to land under "extract review tools to :ApiDemos:reviewer".

It does all still build, so the removals look safe, I'd just rather they were visible on their own rather than buried in a 12k-line diff.


// Below is used to run the easypermissions library to manage location permissions
// EasyPermissions is needed to help us request for permission to access location
Expand All @@ -102,6 +106,7 @@ dependencies {
androidTestImplementation(libs.uiautomator)

implementation(project(":ApiDemos:common-ui"))
implementation(project(":ApiDemos:reviewer"))

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.

Should this be debugImplementation? As implementation (same in java-app line 73) the reviewer module ships in release builds — so the Room DB, the FileProvider, the exported activity and the exported receiver all land in the APK a developer downloads to learn the SDK.

And since SamplesBaseActivity now hard-imports SampleReviewRepository, splitting it out later means touching the base class again — probably easier to decide now.

}

secrets {
Expand All @@ -114,4 +119,4 @@ secrets {
// A properties file containing default secret values. This file can be
// checked in version control.
defaultPropertiesFileName = "local.defaults.properties"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* Copyright 2026 Google LLC
*
* 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.
*/

package com.example.kotlindemos

import androidx.test.core.app.ActivityScenario
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withContentDescription
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import com.example.common_ui.R
import com.google.android.material.appbar.MaterialToolbar
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertTrue
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class BasicMapReviewerUiTest {

@Test
fun testBasicMapHasReviewerToolbarActions() {
val scenario = ActivityScenario.launch(BasicMapDemoActivity::class.java)

scenario.onActivity { activity ->
val toolbar = activity.findViewById<MaterialToolbar>(R.id.top_bar)
assertNotNull("Top bar must be present in layout", toolbar)

// Verify action bar is attached to the toolbar
val actionBar = activity.supportActionBar
assertNotNull("SupportActionBar must be attached to MaterialToolbar", actionBar)

// Verify menu items are present in toolbar
val menu = toolbar.menu
assertNotNull("Toolbar menu must not be null", menu)

val infoItem = menu.findItem(2001)
assertNotNull("Criteria & Purpose (id 2001) action button must exist in toolbar menu", infoItem)

val goodJobItem = menu.findItem(2003)
assertNotNull("Good Job (id 2003) action button must exist in toolbar menu", goodJobItem)

val wrongItem = menu.findItem(2004)
assertNotNull("Something's Wrong (id 2004) action button must exist in toolbar menu", wrongItem)
Comment on lines +40 to +61

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.

Shouldn't the launch intent carry extra_is_reviewer_mode? Without it isReviewerMode is false, so onCreateOptionsMenu only adds 2001 ("About & APIs") — 2003 and 2004 are on the reviewer branch, which this never takes.

I couldn't run it (no device here), so I may be missing something. Also assertTrue is imported but unused, and there's no Java counterpart.

}

// Verify action icons are displayed and clickable on screen
onView(withContentDescription("Criteria & Purpose")).check(matches(isDisplayed()))
onView(withContentDescription("Good Job (Pass)")).check(matches(isDisplayed()))
onView(withContentDescription("Something's Wrong")).check(matches(isDisplayed()))

scenario.close()
}
}
Loading
Loading