Skip to content

merge Popup feature branch into v.next #502

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

Merged
merged 26 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
cd47c25
`Popup`: component and app (#406)
sorenoid May 1, 2024
f35a1a0
Merge branch 'v.next' into feature-branches/popup
May 3, 2024
02f81e5
`Popup`: Adds TextPopupElement Composable (#413)
eri9000 May 6, 2024
971d6d6
Merge branch 'v.next' into feature-branches/popup
May 8, 2024
3473ecf
`Popup`: state collection (#420)
sorenoid May 14, 2024
b9738b1
update expandable card (#426)
sorenoid May 15, 2024
0c12c1e
`Popup` attachment element (#430)
sorenoid May 22, 2024
ad4a67d
`Popup:` Adds FieldsPopupElement composable (#428)
eri9000 May 22, 2024
a262d9f
Adds ViewableFile implementation (#445)
eri9000 May 31, 2024
bf86992
popup media element and media image thumbnail support (#449)
sorenoid Jun 3, 2024
9c5080f
`Popup`: chart images (#452)
sorenoid Jun 5, 2024
2223e8e
`Popup:` Fixes TextPopupElement composable shifting in size when comi…
eri9000 Jun 14, 2024
2a1413c
`Popup:` Adds a file viewer for image attachments (#455)
eri9000 Jun 18, 2024
9765625
`Popup:` Adds support for viewing videos and audio in FileViewer (#464)
eri9000 Jun 25, 2024
6d9a441
Adds support for opening files in the system file viewer (#472)
eri9000 Jun 25, 2024
d757c83
chart support for AsyncImage from saved files (#475)
sorenoid Jun 27, 2024
cf5100e
attachment instance id workaround (#483)
sorenoid Jun 29, 2024
5008108
`Popup:` Adds support for viewing media in file viewer (#481)
eri9000 Jul 3, 2024
8ef95e1
popup dynamic entity (#492)
sorenoid Jul 9, 2024
fc319d5
dont recreate the media image if it has already been saved to disk (#…
sorenoid Jul 9, 2024
ea5d453
Merge branch 'v.next' into feature-branches/popup
Jul 9, 2024
19561b1
remove space. add gradle stuff for tests
Jul 9, 2024
8fe0836
add Popup to t9manifest
Jul 10, 2024
9ac85a7
update api file
Jul 10, 2024
62557e7
some small fixes (#508)
sorenoid Jul 11, 2024
816bfc5
set default map to fourteeners.
Jul 11, 2024
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
4 changes: 4 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ hiltExt = "1.2.0"
junit = "4.13.2"
kotlin = "1.9.23"
ksp = "1.9.23-1.0.20"
media3Exoplayer = "1.3.1"
minSdk = "26"
kotlinxCoroutinesTest = "1.8.0"
kotlinxSerializationJson = "1.6.3"
Expand Down Expand Up @@ -50,6 +51,9 @@ androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecyc
androidx-lifecycle-viewmodel-compose = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-compose"}
androidx-lifecycle-runtime-compose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose"}
androidx-material-icons = { group = "androidx.compose.material", name = "material-icons-extended", version.ref = "androidxMaterialIcons"}
androidx-media3-exoplayer = { module = "androidx.media3:media3-exoplayer", version.ref = "media3Exoplayer" }
androidx-media3-ui = { module = "androidx.media3:media3-ui", version.ref = "media3Exoplayer" }
androidx-media3-exoplayer-dash = { module = "androidx.media3:media3-exoplayer-dash", version.ref = "media3Exoplayer" }
androidx-test-ext = { group = "androidx.test.ext", name = "junit-ktx", version.ref = "androidxTestExt" }
androidx-test-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "androidxEspresso" }
androidx-uiautomator = { module = "androidx.test.uiautomator:uiautomator", version.ref = "uiautomator" }
Expand Down
15 changes: 15 additions & 0 deletions microapps/PopupApp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
9 changes: 9 additions & 0 deletions microapps/PopupApp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Popup Micro-app

This micro-app demonstrates the use of the `Popup` toolkit component which provides a rich, responsive view of information about a GeoElement.

## Usage

The application provides a map viewer, which invokes the form when GeoElements are tapped.

For more information on the `Popup` component and how it works, see it's [Readme](../../toolkit/popup/README.md).
1 change: 1 addition & 0 deletions microapps/PopupApp/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
105 changes: 105 additions & 0 deletions microapps/PopupApp/app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/*
*
* Copyright 2024 Esri
*
* 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.
*
*/

plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin")
}

secrets {
// this file doesn't contain secrets, it just provides defaults which can be committed into git.
defaultPropertiesFileName = "secrets.defaults.properties"
}

android {
namespace = "com.arcgismaps.toolkit.popupapp"
compileSdk = libs.versions.compileSdk.get().toInt()

defaultConfig {
applicationId ="com.arcgismaps.toolkit.popupapp"
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.compileSdk.get().toInt()
versionCode = 1
versionName = "1.0"

testInstrumentationRunner ="androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}
}

buildTypes {
release {
isMinifyEnabled = true
isShrinkResources = true

proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}

buildFeatures {
compose = true
buildConfig = true
}

composeOptions {
kotlinCompilerExtensionVersion = libs.versions.androidxComposeCompiler.get()
}

/**
* Configures the test report for connected (instrumented) tests to be copied to a central
* folder in the project's root directory.
*/
testOptions {
val connectedTestReportsPath: String by project
reportDir = "$connectedTestReportsPath/${project.name}"
}

packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}

dependencies {
implementation(project(":geoview-compose"))
implementation(arcgis.mapsSdk)
implementation(project(":popup"))
implementation(platform(libs.androidx.compose.bom))
implementation(libs.bundles.composeCore)
implementation(libs.bundles.core)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.lifecycle.viewmodel.compose)
testImplementation(libs.bundles.unitTest)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.bundles.composeTest)
debugImplementation(libs.bundles.debug)
}
21 changes: 21 additions & 0 deletions microapps/PopupApp/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
47 changes: 47 additions & 0 deletions microapps/PopupApp/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~
~ Copyright 2024 Esri
~
~ 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.
~
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.PopupApp"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true"
android:theme="@style/Theme.PopupApp">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
*
*
* Copyright 2024 Esri
*
* 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.arcgismaps.toolkit.popupapp

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.viewModels
import androidx.compose.runtime.Composable
import com.arcgismaps.ArcGISEnvironment
import com.arcgismaps.httpcore.authentication.ArcGISAuthenticationChallenge
import com.arcgismaps.httpcore.authentication.ArcGISAuthenticationChallengeHandler
import com.arcgismaps.httpcore.authentication.ArcGISAuthenticationChallengeResponse
import com.arcgismaps.httpcore.authentication.TokenCredential
import com.arcgismaps.toolkit.popupapp.screens.mapscreen.MainScreen
import com.arcgismaps.toolkit.popupapp.screens.mapscreen.MapViewModel
import com.arcgismaps.toolkit.popupapp.ui.theme.PopupAppTheme

class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val viewModel: MapViewModel by viewModels { MapViewModel.Factory }
ArcGISEnvironment.authenticationManager.arcGISAuthenticationChallengeHandler =
TestArcGISAuthenticationChallengeHandler(
BuildConfig.webMapUser,
BuildConfig.webMapPassword
)
setContent {
PopupAppTheme {
PopupApp(viewModel)
}
}
}
}

@Composable
fun PopupApp(viewModel: MapViewModel) {
MainScreen(viewModel)
}

class TestArcGISAuthenticationChallengeHandler(
private val username: String,
private val password: String
) : ArcGISAuthenticationChallengeHandler {
override suspend fun handleArcGISAuthenticationChallenge(
challenge: ArcGISAuthenticationChallenge
): ArcGISAuthenticationChallengeResponse {
val result: Result<TokenCredential> =
TokenCredential.create(
challenge.requestUrl,
username,
password,
tokenExpirationInterval = 0
)
return result.let {
if (it.isSuccess) {
ArcGISAuthenticationChallengeResponse.ContinueWithCredential(it.getOrThrow())
} else {
ArcGISAuthenticationChallengeResponse.ContinueAndFailWithError(it.exceptionOrNull()!!)
}
}
}
}
Loading