Skip to content

Commit 93041ab

Browse files
sorenoidSoren Rotheri9000
authored
merge Popup feature branch into v.next (#502)
* `Popup`: component and app (#406) * add Popup component and microapp * add bottom sheet and api file. * add READMEs * address review feedback * change name in android manifest that were changed in previous commit * Update microapps/PopupApp/README.md Co-authored-by: Erick Lopez Solis <[email protected]> * Update toolkit/popup/README.md Co-authored-by: Erick Lopez Solis <[email protected]> * add initialization support to the Popup composable. --------- Co-authored-by: Soren Roth <[email protected]> Co-authored-by: Erick Lopez Solis <[email protected]> * `Popup`: Adds TextPopupElement Composable (#413) * `Popup`: state collection (#420) * pull compose bom into androidTest and test Implementations when needed. Add missing version for artifact not covered by compose bom (androidx-activity:activity-compose) * Address warnings from version upgrades. pull compose bom into androidTest and test Implementations when needed. Add missing version for artifact not covered by compose bom (androidx-activity:activity-compose). * preliminary setup of state collection. * add initialization support to the Popup composable. * workaround for known issue in gradle task graph progress. opt in for experimental coroutine API * view model added to the Popup App. * move files around. make state objects Parcelable. * ensure states are not created until expressions are evaluated. * Update toolkit/popup/src/main/java/com/arcgismaps/toolkit/popup/Popup.kt Co-authored-by: Erick Lopez Solis <[email protected]> * remove Parcelable super class from base state class * remove comment --------- Co-authored-by: Soren Roth <[email protected]> Co-authored-by: Erick Lopez Solis <[email protected]> * update expandable card (#426) * pull compose bom into androidTest and test Implementations when needed. Add missing version for artifact not covered by compose bom (androidx-activity:activity-compose) * Address warnings from version upgrades. pull compose bom into androidTest and test Implementations when needed. Add missing version for artifact not covered by compose bom (androidx-activity:activity-compose). * preliminary setup of state collection. * add initialization support to the Popup composable. * workaround for known issue in gradle task graph progress. opt in for experimental coroutine API * view model added to the Popup App. * move files around. make state objects Parcelable. * ensure states are not created until expressions are evaluated. * Update toolkit/popup/src/main/java/com/arcgismaps/toolkit/popup/Popup.kt Co-authored-by: Erick Lopez Solis <[email protected]> * remove Parcelable super class from base state class * make expandable card more like field maps. * add defaults * address PR feedback * fix formatting * default to expandable card expanded --------- Co-authored-by: Soren Roth <[email protected]> Co-authored-by: Erick Lopez Solis <[email protected]> * `Popup` attachment element (#430) * pull compose bom into androidTest and test Implementations when needed. Add missing version for artifact not covered by compose bom (androidx-activity:activity-compose) * Address warnings from version upgrades. pull compose bom into androidTest and test Implementations when needed. Add missing version for artifact not covered by compose bom (androidx-activity:activity-compose). * preliminary setup of state collection. * add initialization support to the Popup composable. * workaround for known issue in gradle task graph progress. opt in for experimental coroutine API * view model added to the Popup App. * move files around. make state objects Parcelable. * ensure states are not created until expressions are evaluated. * attachment initial support * Revert "attachment initial support" This reverts commit c888b6b. * attachment initial support * Atachments hooked up to state collection and rendering in the Popup. * remove file from other branch * Update toolkit/popup/src/main/java/com/arcgismaps/toolkit/popup/Popup.kt Co-authored-by: Erick Lopez Solis <[email protected]> * remove Parcelable super class from base state class * make expandable card more like field maps. * add defaults * address PR feedback * fix formatting * default to expandable card expanded * merge in expandable card refactors * support document and other content types. * add all shapes sizes and color to theme defaults object * remove newlines * remove element count, add toggleable parameter to expandable card --------- Co-authored-by: Soren Roth <[email protected]> Co-authored-by: Erick Lopez Solis <[email protected]> * `Popup:` Adds FieldsPopupElement composable (#428) * Adds ViewableFile implementation (#445) * popup media element and media image thumbnail support (#449) * Media element images wip * Media element with support for images * use colors from defaults * fix capitalization --------- Co-authored-by: Soren Roth <[email protected]> * `Popup`: chart images (#452) * Media element images wip * Media element with support for images * chart image support, dark mode support for media. * update SDK dependency for Popups * tweak padding of charts vs images --------- Co-authored-by: Soren Roth <[email protected]> * `Popup:` Fixes TextPopupElement composable shifting in size when coming back into visibility (#461) * `Popup:` Adds a file viewer for image attachments (#455) * `Popup:` Adds support for viewing videos and audio in FileViewer (#464) * Adds support for opening files in the system file viewer (#472) * chart support for AsyncImage from saved files (#475) * chart support for AsyncImage from saved files * remove unused lambda. update comment --------- Co-authored-by: Soren Roth <[email protected]> * attachment instance id workaround (#483) * chart support for AsyncImage from saved files * remove unused lambda. update comment * d * copy attachments on first fetch and pass down into the composition --------- Co-authored-by: Soren Roth <[email protected]> * `Popup:` Adds support for viewing media in file viewer (#481) * popup dynamic entity (#492) * wip * Basic support for DynamicEntity in Popups * minor formatting * merge in media FileViewer * only animate the fields element when the dynamic entity pulses -- for now. * remove unused named lambda parameter. remove newline --------- Co-authored-by: Soren Roth <[email protected]> * dont recreate the media image if it has already been saved to disk (#497) Co-authored-by: Soren Roth <[email protected]> * remove space. add gradle stuff for tests * add Popup to t9manifest * update api file * some small fixes (#508) Co-authored-by: Soren Roth <[email protected]> * set default map to fourteeners. --------- Co-authored-by: Soren Roth <[email protected]> Co-authored-by: Erick Lopez Solis <[email protected]>
1 parent a692aa3 commit 93041ab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+4216
-0
lines changed

gradle/libs.versions.toml

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ hiltExt = "1.2.0"
2121
junit = "4.13.2"
2222
kotlin = "1.9.23"
2323
ksp = "1.9.23-1.0.20"
24+
media3Exoplayer = "1.3.1"
2425
minSdk = "26"
2526
kotlinxCoroutinesTest = "1.8.0"
2627
kotlinxSerializationJson = "1.6.3"
@@ -50,6 +51,9 @@ androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecyc
5051
androidx-lifecycle-viewmodel-compose = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-compose"}
5152
androidx-lifecycle-runtime-compose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose"}
5253
androidx-material-icons = { group = "androidx.compose.material", name = "material-icons-extended", version.ref = "androidxMaterialIcons"}
54+
androidx-media3-exoplayer = { module = "androidx.media3:media3-exoplayer", version.ref = "media3Exoplayer" }
55+
androidx-media3-ui = { module = "androidx.media3:media3-ui", version.ref = "media3Exoplayer" }
56+
androidx-media3-exoplayer-dash = { module = "androidx.media3:media3-exoplayer-dash", version.ref = "media3Exoplayer" }
5357
androidx-test-ext = { group = "androidx.test.ext", name = "junit-ktx", version.ref = "androidxTestExt" }
5458
androidx-test-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "androidxEspresso" }
5559
androidx-uiautomator = { module = "androidx.test.uiautomator:uiautomator", version.ref = "uiautomator" }

microapps/PopupApp/.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
local.properties

microapps/PopupApp/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Popup Micro-app
2+
3+
This micro-app demonstrates the use of the `Popup` toolkit component which provides a rich, responsive view of information about a GeoElement.
4+
5+
## Usage
6+
7+
The application provides a map viewer, which invokes the form when GeoElements are tapped.
8+
9+
For more information on the `Popup` component and how it works, see it's [Readme](../../toolkit/popup/README.md).

microapps/PopupApp/app/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build
+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
/*
2+
*
3+
* Copyright 2024 Esri
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
17+
*/
18+
19+
plugins {
20+
id("com.android.application")
21+
id("org.jetbrains.kotlin.android")
22+
id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin")
23+
}
24+
25+
secrets {
26+
// this file doesn't contain secrets, it just provides defaults which can be committed into git.
27+
defaultPropertiesFileName = "secrets.defaults.properties"
28+
}
29+
30+
android {
31+
namespace = "com.arcgismaps.toolkit.popupapp"
32+
compileSdk = libs.versions.compileSdk.get().toInt()
33+
34+
defaultConfig {
35+
applicationId ="com.arcgismaps.toolkit.popupapp"
36+
minSdk = libs.versions.minSdk.get().toInt()
37+
targetSdk = libs.versions.compileSdk.get().toInt()
38+
versionCode = 1
39+
versionName = "1.0"
40+
41+
testInstrumentationRunner ="androidx.test.runner.AndroidJUnitRunner"
42+
vectorDrawables {
43+
useSupportLibrary = true
44+
}
45+
}
46+
47+
buildTypes {
48+
release {
49+
isMinifyEnabled = true
50+
isShrinkResources = true
51+
52+
proguardFiles(
53+
getDefaultProguardFile("proguard-android-optimize.txt"),
54+
"proguard-rules.pro"
55+
)
56+
}
57+
}
58+
compileOptions {
59+
sourceCompatibility = JavaVersion.VERSION_1_8
60+
targetCompatibility = JavaVersion.VERSION_1_8
61+
}
62+
kotlinOptions {
63+
jvmTarget = "1.8"
64+
}
65+
66+
buildFeatures {
67+
compose = true
68+
buildConfig = true
69+
}
70+
71+
composeOptions {
72+
kotlinCompilerExtensionVersion = libs.versions.androidxComposeCompiler.get()
73+
}
74+
75+
/**
76+
* Configures the test report for connected (instrumented) tests to be copied to a central
77+
* folder in the project's root directory.
78+
*/
79+
testOptions {
80+
val connectedTestReportsPath: String by project
81+
reportDir = "$connectedTestReportsPath/${project.name}"
82+
}
83+
84+
packaging {
85+
resources {
86+
excludes += "/META-INF/{AL2.0,LGPL2.1}"
87+
}
88+
}
89+
}
90+
91+
dependencies {
92+
implementation(project(":geoview-compose"))
93+
implementation(arcgis.mapsSdk)
94+
implementation(project(":popup"))
95+
implementation(platform(libs.androidx.compose.bom))
96+
implementation(libs.bundles.composeCore)
97+
implementation(libs.bundles.core)
98+
implementation(libs.androidx.lifecycle.runtime.ktx)
99+
implementation(libs.androidx.activity.compose)
100+
implementation(libs.androidx.lifecycle.viewmodel.compose)
101+
testImplementation(libs.bundles.unitTest)
102+
androidTestImplementation(platform(libs.androidx.compose.bom))
103+
androidTestImplementation(libs.bundles.composeTest)
104+
debugImplementation(libs.bundles.debug)
105+
}
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
~
4+
~ Copyright 2024 Esri
5+
~
6+
~ Licensed under the Apache License, Version 2.0 (the "License");
7+
~ you may not use this file except in compliance with the License.
8+
~ You may obtain a copy of the License at
9+
~
10+
~ http://www.apache.org/licenses/LICENSE-2.0
11+
~
12+
~ Unless required by applicable law or agreed to in writing, software
13+
~ distributed under the License is distributed on an "AS IS" BASIS,
14+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
~ See the License for the specific language governing permissions and
16+
~ limitations under the License.
17+
~
18+
-->
19+
20+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
21+
xmlns:tools="http://schemas.android.com/tools">
22+
23+
<uses-permission android:name="android.permission.INTERNET" />
24+
25+
<application
26+
android:allowBackup="true"
27+
android:dataExtractionRules="@xml/data_extraction_rules"
28+
android:fullBackupContent="@xml/backup_rules"
29+
android:icon="@mipmap/ic_launcher"
30+
android:label="@string/app_name"
31+
android:roundIcon="@mipmap/ic_launcher_round"
32+
android:supportsRtl="true"
33+
android:theme="@style/Theme.PopupApp"
34+
tools:targetApi="31">
35+
<activity
36+
android:name=".MainActivity"
37+
android:exported="true"
38+
android:theme="@style/Theme.PopupApp">
39+
<intent-filter>
40+
<action android:name="android.intent.action.MAIN" />
41+
42+
<category android:name="android.intent.category.LAUNCHER" />
43+
</intent-filter>
44+
</activity>
45+
</application>
46+
47+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/*
2+
*
3+
*
4+
* Copyright 2024 Esri
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*
18+
*
19+
*/
20+
21+
package com.arcgismaps.toolkit.popupapp
22+
23+
import android.os.Bundle
24+
import androidx.activity.ComponentActivity
25+
import androidx.activity.compose.setContent
26+
import androidx.activity.viewModels
27+
import androidx.compose.runtime.Composable
28+
import com.arcgismaps.ArcGISEnvironment
29+
import com.arcgismaps.httpcore.authentication.ArcGISAuthenticationChallenge
30+
import com.arcgismaps.httpcore.authentication.ArcGISAuthenticationChallengeHandler
31+
import com.arcgismaps.httpcore.authentication.ArcGISAuthenticationChallengeResponse
32+
import com.arcgismaps.httpcore.authentication.TokenCredential
33+
import com.arcgismaps.toolkit.popupapp.screens.mapscreen.MainScreen
34+
import com.arcgismaps.toolkit.popupapp.screens.mapscreen.MapViewModel
35+
import com.arcgismaps.toolkit.popupapp.ui.theme.PopupAppTheme
36+
37+
class MainActivity : ComponentActivity() {
38+
override fun onCreate(savedInstanceState: Bundle?) {
39+
super.onCreate(savedInstanceState)
40+
val viewModel: MapViewModel by viewModels { MapViewModel.Factory }
41+
ArcGISEnvironment.authenticationManager.arcGISAuthenticationChallengeHandler =
42+
TestArcGISAuthenticationChallengeHandler(
43+
BuildConfig.webMapUser,
44+
BuildConfig.webMapPassword
45+
)
46+
setContent {
47+
PopupAppTheme {
48+
PopupApp(viewModel)
49+
}
50+
}
51+
}
52+
}
53+
54+
@Composable
55+
fun PopupApp(viewModel: MapViewModel) {
56+
MainScreen(viewModel)
57+
}
58+
59+
class TestArcGISAuthenticationChallengeHandler(
60+
private val username: String,
61+
private val password: String
62+
) : ArcGISAuthenticationChallengeHandler {
63+
override suspend fun handleArcGISAuthenticationChallenge(
64+
challenge: ArcGISAuthenticationChallenge
65+
): ArcGISAuthenticationChallengeResponse {
66+
val result: Result<TokenCredential> =
67+
TokenCredential.create(
68+
challenge.requestUrl,
69+
username,
70+
password,
71+
tokenExpirationInterval = 0
72+
)
73+
return result.let {
74+
if (it.isSuccess) {
75+
ArcGISAuthenticationChallengeResponse.ContinueWithCredential(it.getOrThrow())
76+
} else {
77+
ArcGISAuthenticationChallengeResponse.ContinueAndFailWithError(it.exceptionOrNull()!!)
78+
}
79+
}
80+
}
81+
}

0 commit comments

Comments
 (0)