|
| 1 | +/* Copyright 2024 Esri |
| 2 | + * |
| 3 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | + * you may not use this file except in compliance with the License. |
| 5 | + * You may obtain a copy of the License at |
| 6 | + * |
| 7 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | + * |
| 9 | + * Unless required by applicable law or agreed to in writing, software |
| 10 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | + * See the License for the specific language governing permissions and |
| 13 | + * limitations under the License. |
| 14 | + * |
| 15 | + */ |
| 16 | + |
| 17 | +package com.esri.arcgismaps.sample.createandsavemap |
| 18 | + |
| 19 | +import android.os.Bundle |
| 20 | +import androidx.activity.ComponentActivity |
| 21 | +import androidx.activity.compose.setContent |
| 22 | +import androidx.compose.material3.MaterialTheme |
| 23 | +import androidx.compose.material3.Surface |
| 24 | +import androidx.compose.runtime.Composable |
| 25 | +import androidx.lifecycle.viewmodel.compose.viewModel |
| 26 | + |
| 27 | +import com.esri.arcgismaps.sample.sampleslib.theme.SampleAppTheme |
| 28 | +import com.esri.arcgismaps.sample.createandsavemap.screens.MainScreen |
| 29 | +import com.arcgismaps.toolkit.authentication.DialogAuthenticator |
| 30 | +import com.esri.arcgismaps.sample.createandsavemap.components.MapViewModel |
| 31 | + |
| 32 | +class MainActivity : ComponentActivity() { |
| 33 | + |
| 34 | + override fun onCreate(savedInstanceState: Bundle?) { |
| 35 | + super.onCreate(savedInstanceState) |
| 36 | + |
| 37 | + setContent { |
| 38 | + SampleAppTheme { |
| 39 | + SampleApp() |
| 40 | + } |
| 41 | + } |
| 42 | + } |
| 43 | + |
| 44 | + @Composable |
| 45 | + private fun SampleApp() { |
| 46 | + val mapViewModel: MapViewModel = viewModel() |
| 47 | + Surface( |
| 48 | + color = MaterialTheme.colorScheme.background |
| 49 | + ) { |
| 50 | + MainScreen( |
| 51 | + sampleName = getString(R.string.app_name) |
| 52 | + ) |
| 53 | + } |
| 54 | + |
| 55 | + // authenticator at bottom can draw over the top of the sample |
| 56 | + DialogAuthenticator(authenticatorState = mapViewModel.authenticatorState) |
| 57 | + } |
| 58 | +} |
0 commit comments