Skip to content

Commit

Permalink
#17 in progress - screens' titles
Browse files Browse the repository at this point in the history
  • Loading branch information
mjureczko committed May 29, 2024
1 parent eea6d14 commit 4bdedd7
Show file tree
Hide file tree
Showing 21 changed files with 147 additions and 32 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ GPLv3 (https://www.gnu.org/licenses/gpl-3.0.html)


TODO:
- add screens titles
-- on searching screen title show which treasure is being searched
- add all translations
- w introduction dodać widok-instrukcję z kodem QR
- kopiowanie "assetów" podczas wyświetlania splash screen
- remove dead code
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ fun CommemorativeScreen(
val scaffoldState: ScaffoldState = rememberScaffoldState()
Scaffold(
scaffoldState = scaffoldState,
topBar = { TopBar(navController, onClickOnGuide, goToFacebook) },
topBar = { TopBar(navController, stringResource(R.string.app_name), onClickOnGuide, goToFacebook) },
content = {
CommemorativeScreenBody(
navController,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fun FacebookScreen(
val scaffoldState: ScaffoldState = rememberScaffoldState()
Scaffold(
scaffoldState = scaffoldState,
topBar = { TopBar(navController, onClickOnGuide, {}) },
topBar = { TopBar(navController, stringResource(R.string.title_activity_facebook), onClickOnGuide, {}) },
content = { FacebookScreenBody(navController) }
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package pl.marianjureczko.poszukiwacz.activity.main

import android.content.res.Resources
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
Expand All @@ -24,6 +23,7 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
Expand All @@ -33,9 +33,8 @@ import pl.marianjureczko.poszukiwacz.ui.components.LargeButton
import pl.marianjureczko.poszukiwacz.ui.theme.PrimaryBackground

/** Kalinowice */
//TODO t: use stringResource
@Composable
fun CustomScreenBody(resources: Resources, goToSearching: (String) -> Unit) {
fun CustomScreenBody(goToSearching: (String) -> Unit) {
val viewModel: CustomMainViewModel = hiltViewModel()
val state = viewModel.state.value
Column(Modifier.background(PrimaryBackground)) {
Expand All @@ -46,7 +45,7 @@ fun CustomScreenBody(resources: Resources, goToSearching: (String) -> Unit) {
.weight(0.89f)
) {
Text(
text = resources.getString(R.string.custom_title),
text = stringResource(R.string.custom_title),
style = MaterialTheme.typography.h3,
textAlign = TextAlign.Center
)
Expand Down Expand Up @@ -101,7 +100,6 @@ private fun NextButton(viewModel: CustomMainViewModel) {
),
border = BorderStroke(2.dp, Color.LightGray), // Border color and thickness
elevation = ButtonDefaults.elevation(4.dp),
// modifier = Modifier.colo(Color.Gray),
content = {
Image(
imageVector = Icons.Rounded.ArrowForward,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private fun ComposeRoot(settings: Settings, resources: Resources, onClickGuide:

NavHost(navController, startDestination = "main") {
composable(route = "main") {
MainScreen(navController, settings.isClassicMode(), resources, onClickGuide, goToFacebook) { routeName ->
MainScreen(navController, settings.isClassicMode(), onClickGuide, goToFacebook) { routeName ->
navController.navigate("$SEARCHING_PATH/$routeName")
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package pl.marianjureczko.poszukiwacz.activity.main

import android.annotation.SuppressLint
import android.content.res.Resources
import androidx.compose.material.Scaffold
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import androidx.navigation.NavController
import pl.marianjureczko.poszukiwacz.R
import pl.marianjureczko.poszukiwacz.ui.components.TopBar

//TODO: add sample qr code to introduction
Expand All @@ -13,18 +14,17 @@ import pl.marianjureczko.poszukiwacz.ui.components.TopBar
fun MainScreen(
navController: NavController,
isClassic: Boolean,
resources: Resources,
onClickOnGuide: () -> Unit,
onClickOnFacebook: () -> Unit,
goToSearching: (String) -> Unit
) {
Scaffold(
topBar = { TopBar(navController, onClickOnGuide, onClickOnFacebook) },
topBar = { TopBar(navController, stringResource(R.string.app_name), onClickOnGuide, onClickOnFacebook) },
content = { _ ->
if (isClassic) {
ClassicScreenBody(goToSearching)
} else {
CustomScreenBody(resources, goToSearching)
CustomScreenBody(goToSearching)
}
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.Scaffold
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.viewinterop.AndroidView
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.NavController
import com.mapbox.bindgen.Value
import com.mapbox.maps.MapView
import com.mapbox.maps.Style
import pl.marianjureczko.poszukiwacz.App
import pl.marianjureczko.poszukiwacz.R
import pl.marianjureczko.poszukiwacz.model.Route
import pl.marianjureczko.poszukiwacz.shared.MapHelper
import pl.marianjureczko.poszukiwacz.ui.components.TopBar
Expand All @@ -27,7 +29,7 @@ fun MapScreen(
onClickOnFacebook: () -> Unit
) {
Scaffold(
topBar = { TopBar(navController, onClickOnGuide, onClickOnFacebook) },
topBar = { TopBar(navController, stringResource(R.string.map_activity_title), onClickOnGuide, onClickOnFacebook) },
content = {
MapScreenBody(resources)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.asImageBitmap
import androidx.compose.ui.graphics.painter.BitmapPainter
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.NavController
import pl.marianjureczko.poszukiwacz.R
import pl.marianjureczko.poszukiwacz.ui.components.AdvertBanner
import pl.marianjureczko.poszukiwacz.ui.components.TopBar
import pl.marianjureczko.poszukiwacz.ui.theme.SecondaryBackground
Expand All @@ -32,7 +34,7 @@ fun TipPhotoScreen(
onClickOnFacebook: () -> Unit
) {
Scaffold(
topBar = { TopBar(navController, onClickOnGuide, onClickOnFacebook) },
topBar = { TopBar(navController, stringResource(R.string.photo_tip), onClickOnGuide, onClickOnFacebook) },
content = {
TipPhotoScreenBody()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ fun ResultScreen(
onClickOnFacebook: () -> Unit
) {
Scaffold(
topBar = { TopBar(navController, onClickOnGuide, onClickOnFacebook) },
topBar = { TopBar(navController, stringResource(R.string.treasure), onClickOnGuide, onClickOnFacebook) },
content = {
ResultScreenBody(shareViewModelStoreOwner(navBackStackEntry, navController))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import androidx.compose.ui.draw.rotate
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.font.FontWeight
Expand Down Expand Up @@ -70,14 +71,16 @@ fun SearchingScreen(
goToFacebook: () -> Unit
) {
val scaffoldState: ScaffoldState = rememberScaffoldState()

val viewModel: SearchingViewModel = getViewModel()
val title = "${stringResource(R.string.treasure)} ${viewModel.state.value.currentTreasure.id}"
Scaffold(
scaffoldState = scaffoldState,
topBar = { TopBar(navController, onClickOnGuide, goToFacebook) },
topBar = { TopBar(navController, title, onClickOnGuide, goToFacebook) },
content = {
SearchingScreenBody(
navController,
isClassicMode,
viewModel,
resources,
scaffoldState,
goToTipPhoto,
Expand All @@ -94,14 +97,15 @@ fun SearchingScreen(
private fun SearchingScreenBody(
navController: NavController,
isClassicMode: Boolean,
viewModel: SearchingViewModel,
resources: Resources,
scaffoldState: ScaffoldState,
goToTipPhoto: (String) -> Unit,
goToResult: (ResultType, Int) -> Unit,
goToMap: (String) -> Unit,
goToTreasureSelector: (Int) -> Unit
) {
val viewModel: SearchingViewModel = getViewModel()

val state: SearchingSharedState = viewModel.state.value
if (!isOnStack(navController, SELECTOR_ROUTE)
&& !isOnStack(navController, RESULTS_ROUTE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fun SelectorScreen(
val scaffoldState: ScaffoldState = rememberScaffoldState()
Scaffold(
scaffoldState = scaffoldState,
topBar = { TopBar(navController, onClickOnGuide, onClickOnFacebook) },
topBar = { TopBar(navController, stringResource(R.string.select_treasure_dialog_title), onClickOnGuide, onClickOnFacebook) },
content = {
SelectorScreenBody(
navController,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.navigation.NavController
import pl.marianjureczko.poszukiwacz.App
import pl.marianjureczko.poszukiwacz.R
import pl.marianjureczko.poszukiwacz.ui.theme.Primary

@Composable
fun TopBar(navController: NavController, onClickOnGuide: () -> Unit, onClickOnFacebook: () -> Unit) {
fun TopBar(navController: NavController, title:String, onClickOnGuide: () -> Unit, onClickOnFacebook: () -> Unit) {
val showMenu = remember { mutableStateOf(false) }
TopAppBar(
backgroundColor = Primary,
Expand Down Expand Up @@ -72,7 +71,7 @@ fun TopBar(navController: NavController, onClickOnGuide: () -> Unit, onClickOnFa
contentScale = ContentScale.FillHeight
)
Text(
text = App.getResources().getString(R.string.app_name),
text = title,
//TODO save color in theme
color = Color.White,
style = MaterialTheme.typography.h6,
Expand Down
127 changes: 120 additions & 7 deletions assets/kalinowice/assets/custom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
<name>custom</name>
<treasures class="java.util.ArrayList">
<treasureDescription>
<!--witacz-->
<id>1</id>
<latitude>50.501055</latitude>
<longitude>18.180191</longitude>
<photoFileName>photo_3035c809-d834-4dc6-a7ef-c8a0b670b945.jpg</photoFileName>
<photoFileName>tip_01.jpg</photoFileName>
<tipFileName>sound_ddaa89a4-2925-45a1-a5a1-93f72c04aeff.3gp</tipFileName>
<qrCode>k01001</qrCode>
<movieFileName>kalinowice_01.mp4</movieFileName>
Expand All @@ -16,21 +17,133 @@
<id>2</id>
<latitude>50.5079648</latitude>
<longitude>18.1846258</longitude>
<photoFileName></photoFileName>
<tipFileName></tipFileName>
<photoFileName>tip_02.jpg</photoFileName>
<tipFileName>sound_ddaa89a4-2925-45a1-a5a1-93f72c04aeff.3gp</tipFileName>
<qrCode>k01002</qrCode>
<movieFileName>kalinowice_01.mp4</movieFileName>
<subtitlesFileName>en_01.srt</subtitlesFileName>
</treasureDescription>
<treasureDescription>
<!--dąbrówka-->
<id>3</id>
<latitude>50.520650</latitude>
<longitude>18.200960</longitude>
<photoFileName>photo_3035c809-d834-4dc6-a7ef-c8a0b670b945.jpg</photoFileName>
<tipFileName>sound_ddaa89a4-2925-45a1-a5a1-93f72c04aeff.3gp</tipFileName>
<qrCode>k01003</qrCode>
<movieFileName>kalinowice_01.mp4</movieFileName>
<subtitlesFileName>en_01.srt</subtitlesFileName>
</treasureDescription>
<treasureDescription>
<!--dzwonek zmarłych-->
<id>4</id>
<latitude>50.509795</latitude>
<longitude>18.181506</longitude>
<photoFileName>photo_3035c809-d834-4dc6-a7ef-c8a0b670b945.jpg</photoFileName>
<tipFileName>sound_ddaa89a4-2925-45a1-a5a1-93f72c04aeff.3gp</tipFileName>
<qrCode>k01004</qrCode>
<movieFileName>kalinowice_01.mp4</movieFileName>
<subtitlesFileName>en_01.srt</subtitlesFileName>
</treasureDescription>
<treasureDescription>
<!-- kapliczka u Nieszwieca-->
<id>5</id>
<latitude>50.511045</latitude>
<longitude>18.180305</longitude>
<photoFileName>photo_3035c809-d834-4dc6-a7ef-c8a0b670b945.jpg</photoFileName>
<tipFileName>sound_ddaa89a4-2925-45a1-a5a1-93f72c04aeff.3gp</tipFileName>
<qrCode>k01005</qrCode>
<movieFileName>kalinowice_01.mp4</movieFileName>
<subtitlesFileName>en_01.srt</subtitlesFileName>
</treasureDescription>
<treasureDescription>
<!-- kopaczka -->
<id>6</id>
<latitude>50.505667</latitude>
<longitude>18.185020</longitude>
<photoFileName>photo_2185c623-ef91-4e00-b1fc-3c6d4082d1be.jpg</photoFileName>
<latitude>50.505620</latitude>
<longitude>18.185022</longitude>
<photoFileName>tip_06.jpg</photoFileName>
<tipFileName>sound_72686712-ceb1-40b6-a420-2d4016bf3872.3gp</tipFileName>
<qrCode>k01002</qrCode>
<qrCode>k01006</qrCode>
<movieFileName>kalinowice_01.mp4</movieFileName>
<subtitlesFileName>en_01.srt</subtitlesFileName>
</treasureDescription>
<treasureDescription>
<!-- krzyż przy wiejskiej -->
<id>7</id>
<latitude>50.502843</latitude>
<longitude>18.179361</longitude>
<photoFileName>tip_07.jpg</photoFileName>
<tipFileName>sound_72686712-ceb1-40b6-a420-2d4016bf3872.3gp</tipFileName>
<qrCode>k01007</qrCode>
<movieFileName>kalinowice_01.mp4</movieFileName>
<subtitlesFileName>en_01.srt</subtitlesFileName>
</treasureDescription>
<treasureDescription>
<!-- lipa -->
<id>8</id>
<latitude>50.489289</latitude>
<longitude>18.177942</longitude>
<photoFileName>photo_3035c809-d834-4dc6-a7ef-c8a0b670b945.jpg</photoFileName>
<tipFileName>sound_72686712-ceb1-40b6-a420-2d4016bf3872.3gp</tipFileName>
<qrCode>k01008</qrCode>
<movieFileName>kalinowice_01.mp4</movieFileName>
<subtitlesFileName>en_01.srt</subtitlesFileName>
</treasureDescription>
<treasureDescription>
<!-- miłorząb -->
<id>9</id>
<latitude>50.505919</latitude>
<longitude>18.184735</longitude>
<photoFileName>tip_09.jpg</photoFileName>
<tipFileName>sound_72686712-ceb1-40b6-a420-2d4016bf3872.3gp</tipFileName>
<qrCode>k01009</qrCode>
<movieFileName>kalinowice_01.mp4</movieFileName>
<subtitlesFileName>en_01.srt</subtitlesFileName>
</treasureDescription>
<treasureDescription>
<!-- Oko opatrzności -->
<id>10</id>
<latitude>50.506084</latitude>
<longitude>18.192550</longitude>
<photoFileName>photo_3035c809-d834-4dc6-a7ef-c8a0b670b945.jpg</photoFileName>
<tipFileName>sound_72686712-ceb1-40b6-a420-2d4016bf3872.3gp</tipFileName>
<qrCode>k01010</qrCode>
<movieFileName>kalinowice_01.mp4</movieFileName>
<subtitlesFileName>en_01.srt</subtitlesFileName>
</treasureDescription>
<treasureDescription>
<!-- plac zabaw -->
<id>11</id>
<latitude>50.506154</latitude>
<longitude>18.179228</longitude>
<photoFileName>photo_3035c809-d834-4dc6-a7ef-c8a0b670b945.jpg</photoFileName>
<tipFileName>sound_72686712-ceb1-40b6-a420-2d4016bf3872.3gp</tipFileName>
<qrCode>k01011</qrCode>
<movieFileName>kalinowice_01.mp4</movieFileName>
<subtitlesFileName>en_01.srt</subtitlesFileName>
</treasureDescription>
<treasureDescription>
<!-- Stary cmentarz -->
<id>12</id>
<latitude>50.505077</latitude>
<longitude>18.184561</longitude>
<photoFileName>tip_12.jpg</photoFileName>
<tipFileName>sound_72686712-ceb1-40b6-a420-2d4016bf3872.3gp</tipFileName>
<qrCode>k01012</qrCode>
<movieFileName>kalinowice_01.mp4</movieFileName>
<subtitlesFileName>en_01.srt</subtitlesFileName>
</treasureDescription>
<treasureDescription>
<!-- Szkoła -->
<id>13</id>
<latitude>50.506781</latitude>
<longitude>18.180218</longitude>
<photoFileName>tip_13.jpg</photoFileName>
<tipFileName>sound_72686712-ceb1-40b6-a420-2d4016bf3872.3gp</tipFileName>
<qrCode>k01013</qrCode>
<movieFileName>kalinowice_01.mp4</movieFileName>
<subtitlesFileName>en_01.srt</subtitlesFileName>
</treasureDescription>

</treasures>
</route>
Binary file not shown.
Binary file added assets/kalinowice/assets/tip_01.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/kalinowice/assets/tip_02.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/kalinowice/assets/tip_06.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/kalinowice/assets/tip_07.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/kalinowice/assets/tip_09.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/kalinowice/assets/tip_12.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/kalinowice/assets/tip_13.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4bdedd7

Please sign in to comment.