-
Notifications
You must be signed in to change notification settings - Fork 139
Migrate SyncStatus to Jetpack Compose #3488
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
e2b0beb
a14b168
87cdef1
cee8c12
7512b2d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| /* | ||
| * 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 | ||
| * | ||
| * https://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 org.groundplatform.android.ui.syncstatus | ||
|
|
||
| import androidx.compose.foundation.layout.fillMaxSize | ||
| import androidx.compose.foundation.layout.padding | ||
| import androidx.compose.foundation.lazy.LazyColumn | ||
| import androidx.compose.foundation.lazy.items | ||
| import androidx.compose.material.icons.Icons | ||
| import androidx.compose.material.icons.automirrored.filled.ArrowBack | ||
| import androidx.compose.material3.ExperimentalMaterial3Api | ||
| import androidx.compose.material3.Icon | ||
| import androidx.compose.material3.IconButton | ||
| import androidx.compose.material3.Scaffold | ||
| import androidx.compose.material3.Text | ||
| import androidx.compose.material3.TopAppBar | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.platform.testTag | ||
| import androidx.compose.ui.res.stringResource | ||
| import androidx.compose.ui.semantics.semantics | ||
| import androidx.compose.ui.semantics.testTag | ||
| import org.groundplatform.android.R | ||
|
|
||
| @OptIn(ExperimentalMaterial3Api::class) | ||
| @Composable | ||
| fun SyncStatusScreen(uploadStatuses: List<SyncStatusDetail>, onBack: () -> Unit) { | ||
| Scaffold( | ||
| topBar = { | ||
| TopAppBar( | ||
| title = { Text(text = stringResource(R.string.data_sync_status)) }, | ||
| navigationIcon = { | ||
| IconButton(onClick = onBack) { | ||
| Icon( | ||
| imageVector = Icons.AutoMirrored.Filled.ArrowBack, | ||
| contentDescription = stringResource(R.string.previous), | ||
| ) | ||
| } | ||
| }, | ||
| ) | ||
| } | ||
| ) { paddingValues -> | ||
| LazyColumn(modifier = Modifier.fillMaxSize().padding(paddingValues).testTag("sync list")) { | ||
| items(uploadStatuses) { | ||
| SyncListItem(modifier = Modifier.semantics { testTag = "item ${it.user}" }, detail = it) | ||
| } | ||
|
Comment on lines
+57
to
+59
Contributor
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. Here are a couple of suggestions to improve this
items(
items = uploadStatuses,
key = { "${it.timestamp.time}-${it.label}-${it.subtitle}" }
) {
SyncListItem(
modifier = Modifier.semantics { testTag = "item ${it.label} ${it.subtitle}" },
detail = it
)
} |
||
| } | ||
| } | ||
| } | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ | |
| # This option should only be used with decoupled projects. More details, visit | ||
| # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects | ||
| # org.gradle.parallel=true | ||
| org.gradle.java.home=/Applications/Android Studio.app/Contents/jbr/Contents/Home | ||
|
||
| #Thu Dec 26 12:25:19 EST 2019 | ||
| android.enableJetifier=true | ||
| android.useAndroidX=true | ||
|
|
||
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.
To improve code readability, it's better to import the classes used here instead of using their fully qualified names. Please add imports for
androidx.compose.ui.platform.ComposeView,androidx.compose.ui.platform.ViewCompositionStrategy, andorg.groundplatform.android.ui.theme.AppTheme.