Skip to content
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

Fix snackbar 1104 #1109

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package org.greenstand.android.TreeTracker.dashboard
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
Expand All @@ -27,9 +28,12 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.progressSemantics
import androidx.compose.material.ButtonColors
import androidx.compose.material.Scaffold
import androidx.compose.material.Snackbar
import androidx.compose.material.SnackbarHost
import androidx.compose.material.Text
import androidx.compose.material.rememberScaffoldState
import androidx.compose.runtime.*
Expand All @@ -52,6 +56,7 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.lifecycle.viewmodel.compose.viewModel
import org.greenstand.android.TreeTracker.R
import org.greenstand.android.TreeTracker.models.NavRoute
Expand Down Expand Up @@ -126,6 +131,23 @@ fun Dashboard(
DashboardTopBar(state, onOrgClicked)
},
scaffoldState = scaffoldState,
snackbarHost = {
SnackbarHost(hostState = it, modifier = Modifier
.fillMaxWidth()
.wrapContentHeight(Alignment.Top)) { snackBarData->
val backgroundColor = Color.Green

Box(modifier = Modifier.fillMaxSize()) {
Snackbar(
contentColor = CustomTheme.textColors.darkText,
backgroundColor = backgroundColor,
modifier = Modifier.align(Alignment.TopStart)
) {
Text(text = snackBarData.message, fontWeight = FontWeight.Bold, fontSize = 20.sp, modifier = Modifier.padding(vertical = 15.dp))
}
}
}
}
) {
Column(
modifier = Modifier
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-pt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<string name="tree">árvore</string>

<string name="sync_blocked" translatable="false">Sincronização bloqueada</string>
<string name="sync_started">Sincronização iniciada</string>
<string name="sync_started">Sincronização iniciada, aguarde</string>
<string name="sync_preparing">Preparando a sincronização</string>
<string name="sync_stopped">Sincronização interrompida</string>
<string name="nothing_to_sync">Sem dados para sincronizar</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-sw/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<!--Strings add for fragment_new_tree.xml-->
<string name="tree">Mti</string>
<string name="sync_blocked" translatable="false">Kutuma na kupokea kumesitishwa</string>
<string name="sync_started">Kutuma na kupokea kumeanza</string>
<string name="sync_started">Kutuma na kupokea kumeanza, tafadhali subiri</string>
<string name="sync_preparing">Kutuma na kupokea kunatayarishwa</string>
<string name="sync_stopped">kutuma na kupokea kumesimama</string>
<string name="nothing_to_sync">Hakuna cha kutuma na kupokea</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<string name="tree">tree</string>

<string name="sync_blocked" translatable="false">Sync Blocked</string>
<string name="sync_started">Sync Started</string>
<string name="sync_started">Sync Started, please wait</string>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job on the PR! However, I noticed that you added the phrase "Sync Started, please wait" in English to the strings.xml file, but did not provide translations for this addition in the other language files.

For consistency and to ensure a smooth user experience for non-English speakers, could you please add the corresponding translations for "Sync Started, please wait" in the other language files as well? This will help maintain the app's localization standards.

Thank you for your attention to this!

Best regards,

<string name="sync_preparing">Sync Preparing</string>
<string name="sync_stopped">Sync Stopped</string>
<string name="nothing_to_sync">Nothing to Sync</string>
Expand Down
Loading