-
Notifications
You must be signed in to change notification settings - Fork 39
Enhance NewModuleScript Template #344
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
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e656637
Added SampleTemplateTypes FAB_DialogOptions
shubham7109 c4b921a
Added new MainScreenSheetTemplate to script
shubham7109 b2c6d16
Merge branch 'v.next' into shubham/quality-enhancements
shubham7109 95438a9
Update jar script
shubham7109 3d6ab17
Merge branch 'v.next' into shubham/quality-enhancements
shubham7109 ee95123
PR feedback
shubham7109 ac753ed
Changed FAB_SheetOptions -> FAB_BottomSheetOptions
shubham7109 9aabfd3
Update BottomSheetPreview to match preview from DropDownMenuBox
shubham7109 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
samples-lib/src/main/java/com/esri/arcgismaps/sample/sampleslib/components/SampleDialog.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* Copyright 2025 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.esri.arcgismaps.sample.sampleslib.components | ||
|
||
import android.content.res.Configuration | ||
import androidx.compose.animation.animateContentSize | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.ColumnScope | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.rememberScrollState | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.foundation.verticalScroll | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.OutlinedButton | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.window.Dialog | ||
import androidx.compose.ui.window.DialogProperties | ||
|
||
/** | ||
* Composable component to display a dialog of the [content], which provides an [onDismissRequest]. | ||
* The [modifier] applies common dialog layout configurations using the default [properties]. | ||
*/ | ||
@Composable | ||
fun SampleDialog( | ||
modifier: Modifier = Modifier, | ||
properties: DialogProperties = DialogProperties(), | ||
onDismissRequest: () -> Unit, | ||
content: @Composable (ColumnScope) -> Unit | ||
) { | ||
Dialog(onDismissRequest = onDismissRequest, properties = properties) { | ||
Column( | ||
modifier = modifier | ||
.clip(RoundedCornerShape(12.dp)) | ||
.background(MaterialTheme.colorScheme.background) | ||
.padding(12.dp) | ||
.fillMaxWidth() | ||
.verticalScroll(rememberScrollState()) | ||
.animateContentSize(), | ||
verticalArrangement = Arrangement.spacedBy(8.dp), | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
) { | ||
content(this) | ||
} | ||
} | ||
} | ||
|
||
@Preview(showBackground = true) | ||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES, showBackground = true) | ||
@Composable | ||
fun DialogOptionsPreview() { | ||
SamplePreviewSurface { | ||
SampleDialog(onDismissRequest = {}) { | ||
Text("Sample options: ", style = MaterialTheme.typography.titleMedium) | ||
DropDownMenuBox( | ||
textFieldValue = "Current selection", | ||
textFieldLabel = "Select an option", | ||
dropDownItemList = emptyList(), | ||
onIndexSelected = { } | ||
) | ||
Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End) { | ||
OutlinedButton(onClick = { }) { Text("Dismiss") } | ||
} | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
samples-lib/src/main/java/com/esri/arcgismaps/sample/sampleslib/components/SamplePreview.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* Copyright 2025 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.esri.arcgismaps.sample.sampleslib.components | ||
|
||
import androidx.compose.material3.Surface | ||
import androidx.compose.runtime.Composable | ||
import com.esri.arcgismaps.sample.sampleslib.theme.SampleAppTheme | ||
|
||
/** | ||
* Helper composable to apply sample theme to the given [content] for previews. | ||
*/ | ||
@Composable | ||
fun SamplePreviewSurface(content: @Composable () -> Unit) { | ||
SampleAppTheme { | ||
Surface { content() } | ||
} | ||
} |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
/* Copyright 2023 Esri | ||
shubham7109 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* | ||
* 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.esri.arcgismaps.sample.displaycomposablemapview.screens | ||
|
||
import android.content.res.Configuration | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.filled.Settings | ||
import androidx.compose.material3.FloatingActionButton | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.OutlinedButton | ||
import androidx.compose.material3.Scaffold | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.setValue | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import androidx.lifecycle.viewmodel.compose.viewModel | ||
import com.arcgismaps.toolkit.geoviewcompose.MapView | ||
import com.esri.arcgismaps.sample.displaycomposablemapview.components.MapViewModel | ||
import com.esri.arcgismaps.sample.sampleslib.components.DropDownMenuBox | ||
import com.esri.arcgismaps.sample.sampleslib.components.MessageDialog | ||
import com.esri.arcgismaps.sample.sampleslib.components.SampleDialog | ||
import com.esri.arcgismaps.sample.sampleslib.components.SamplePreviewSurface | ||
import com.esri.arcgismaps.sample.sampleslib.components.SampleTopAppBar | ||
|
||
/** | ||
* Main screen layout for the sample app | ||
*/ | ||
@Composable | ||
fun MainScreen(sampleName: String) { | ||
val mapViewModel: MapViewModel = viewModel() | ||
var isDialogOptionsVisible by remember { mutableStateOf(false) } | ||
|
||
Scaffold( | ||
topBar = { SampleTopAppBar(title = sampleName) }, | ||
floatingActionButton = { | ||
if (!isDialogOptionsVisible) { | ||
FloatingActionButton( | ||
modifier = Modifier.padding(bottom = 36.dp, end = 12.dp), | ||
onClick = { isDialogOptionsVisible = true } | ||
) { Icon(Icons.Filled.Settings, contentDescription = "Show options") } | ||
} | ||
}, | ||
content = { | ||
Column( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.padding(it), | ||
) { | ||
MapView( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.weight(1f), | ||
arcGISMap = mapViewModel.arcGISMap | ||
) | ||
} | ||
|
||
if (isDialogOptionsVisible) { | ||
DialogOptions( | ||
// isCurrentOptionEnabled = ..., | ||
// onOptionToggled = { ... } | ||
onDismissRequest = { isDialogOptionsVisible = false } | ||
) | ||
} | ||
|
||
mapViewModel.messageDialogVM.apply { | ||
if (dialogStatus) { | ||
MessageDialog( | ||
title = messageTitle, | ||
description = messageDescription, | ||
onDismissRequest = ::dismissDialog | ||
) | ||
} | ||
} | ||
} | ||
) | ||
} | ||
|
||
@Composable | ||
fun DialogOptions( | ||
onDismissRequest: () -> Unit | ||
) { | ||
SampleDialog(onDismissRequest = onDismissRequest) { | ||
Text("Sample options: ", style = MaterialTheme.typography.titleMedium) | ||
DropDownMenuBox( | ||
textFieldValue = "<selected-option>", | ||
textFieldLabel = "Select an option", | ||
dropDownItemList = emptyList(), | ||
shubham7109 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
onIndexSelected = { } | ||
) | ||
shubham7109 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End) { | ||
OutlinedButton(onClick = onDismissRequest) { Text("Dismiss") } | ||
} | ||
} | ||
} | ||
|
||
@Preview(showBackground = true) | ||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES, showBackground = true) | ||
@Composable | ||
fun DialogOptionsPreview() { | ||
SamplePreviewSurface { | ||
DialogOptions { } | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.