-
Notifications
You must be signed in to change notification settings - Fork 3.1k
feat: extract on-device review app and tools to :ApiDemos:reviewer module #2428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 { | ||
|
|
@@ -38,6 +40,7 @@ android { | |
| buildFeatures { | ||
| buildConfig = true | ||
| viewBinding = true | ||
| compose = true | ||
| } | ||
|
|
||
| buildTypes { | ||
|
|
@@ -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) | ||
|
|
||
| // Below is used to run the easypermissions library to manage location permissions | ||
| // EasyPermissions is needed to help us request for permission to access location | ||
|
|
@@ -102,6 +106,7 @@ dependencies { | |
| androidTestImplementation(libs.uiautomator) | ||
|
|
||
| implementation(project(":ApiDemos:common-ui")) | ||
| implementation(project(":ApiDemos:reviewer")) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be And since |
||
| } | ||
|
|
||
| secrets { | ||
|
|
@@ -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
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't the launch intent carry I couldn't run it (no device here), so I may be missing something. Also |
||
| } | ||
|
|
||
| // 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() | ||
| } | ||
| } | ||
There was a problem hiding this comment.
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,volleyand the-Xopt-incompiler 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.