Skip to content

Commit cd50839

Browse files
committed
Merge branch 'develop' into main
2 parents 314c36f + eee7e80 commit cd50839

File tree

10 files changed

+200
-206
lines changed

10 files changed

+200
-206
lines changed

CHANGELOG.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
## [1.2.1](https://github.com/mapcode-foundation/mapcode-android-app/releases/tag/v1.2.1)
2+
3+
#### 2022-11-11
4+
5+
- [#51](https://github.com/mapcode-foundation/mapcode-android-app/issues/51) Put the buttons to save
6+
and view locations next to each other so that they are easier to find.
7+
- [#50](https://github.com/mapcode-foundation/mapcode-android-app/issues/50) Add a button to go to
8+
see the tutorial again.
9+
- [#49](https://github.com/mapcode-foundation/mapcode-android-app/issues/49) Make the backgrounds of
10+
the tutorial lighter so the text is easier to read.
11+
112
## [1.2.0](https://github.com/mapcode-foundation/mapcode-android-app/releases/tag/v1.2.0)
213

314
#### 2022-10-21
@@ -12,14 +23,11 @@
1223
#### 2022-08-21
1324

1425
- [#47](https://github.com/mapcode-foundation/mapcode-android-app/issues/47) Improve address
15-
autocompletion results by
16-
using Google Places API.
26+
autocompletion results by using Google Places API.
1727
- [#48](https://github.com/mapcode-foundation/mapcode-android-app/issues/48) Allow comma decimal in
18-
latitude and
19-
longitude.
28+
latitude and longitude.
2029
- [#46](https://github.com/mapcode-foundation/mapcode-android-app/issues/46) Latitude and longitude
21-
text are invisible
22-
in dark mode.
30+
text are invisible in dark mode.
2331
- Button to clear latitude and longitude text is now a copy button.
2432

2533
## [1.1.0](https://github.com/mapcode-foundation/mapcode-android-app/releases/tag/v1.1.0)

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ android {
1818
minSdk 21
1919
//noinspection OldTargetApi wait for sources to be released before upgrading
2020
targetSdk 33
21-
versionCode 5
22-
versionName "1.2.0"
21+
versionCode 6
22+
versionName "1.2.1"
2323

2424
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2525
vectorDrawables {

app/src/androidTest/java/com/mapcode/map/MapScreenTest.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import assertk.assertions.prop
3232
import com.mapcode.Mapcode
3333
import com.mapcode.Territory
3434
import com.mapcode.destinations.FavouritesScreenDestination
35+
import com.mapcode.destinations.OnboardingScreenDestination
3536
import com.mapcode.favourites.Favourite
3637
import com.mapcode.util.Location
3738
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
@@ -785,6 +786,14 @@ class MapScreenTest {
785786
composeTestRule.onNodeWithText("Save a location first!").assertIsDisplayed()
786787
}
787788

789+
@Test
790+
fun navigate_to_onboarding_screen_when_click_view_tutorial() {
791+
setMapScreenAsContent()
792+
composeTestRule.onNodeWithContentDescription("More").performClick()
793+
composeTestRule.onNodeWithText("Tutorial").performClick()
794+
verify(mockDestinationsNavigator).navigate(OnboardingScreenDestination.route)
795+
}
796+
788797
private fun setMapScreenAsContent() {
789798
composeTestRule.setContent {
790799
MapScreen(

app/src/main/java/com/mapcode/map/AddressScreenPart.kt

Lines changed: 52 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,8 @@ import androidx.compose.foundation.text.KeyboardActions
2121
import androidx.compose.foundation.text.KeyboardOptions
2222
import androidx.compose.material.*
2323
import androidx.compose.material.icons.Icons
24-
import androidx.compose.material.icons.outlined.Bookmark
25-
import androidx.compose.material.icons.outlined.BookmarkAdd
2624
import androidx.compose.material.icons.outlined.Clear
2725
import androidx.compose.runtime.*
28-
import androidx.compose.ui.Alignment
2926
import androidx.compose.ui.Modifier
3027
import androidx.compose.ui.focus.FocusRequester
3128
import androidx.compose.ui.focus.focusRequester
@@ -38,7 +35,6 @@ import androidx.compose.ui.text.input.KeyboardType
3835
import androidx.compose.ui.tooling.preview.Preview
3936
import androidx.compose.ui.unit.dp
4037
import com.mapcode.R
41-
import com.mapcode.theme.MapcodeColor
4238
import com.mapcode.theme.MapcodeTheme
4339

4440
@OptIn(ExperimentalMaterialApi::class)
@@ -51,88 +47,72 @@ fun AddressArea(
5147
onSubmit: () -> Unit = {},
5248
helper: AddressHelper,
5349
error: AddressError,
54-
onAddFavouriteClick: () -> Unit = {},
55-
onDeleteFavouriteClick: () -> Unit = {},
56-
isFavouriteLocation: Boolean
5750
) {
5851
Column(modifier) {
5952

6053
var menuExpanded by remember { mutableStateOf(false) }
6154
val focusRequester = FocusRequester()
6255
val focusManager = LocalFocusManager.current
6356

64-
Row {
65-
ExposedDropdownMenuBox(
66-
modifier = Modifier.weight(1f),
67-
expanded = menuExpanded,
68-
onExpandedChange = { menuExpanded = it }) {
69-
OutlinedTextField(
70-
modifier = Modifier
71-
.fillMaxWidth()
72-
.focusRequester(focusRequester),
73-
value = address,
74-
onValueChange = {
75-
onChange(it)
76-
if (!menuExpanded) {
77-
menuExpanded = true
78-
}
79-
},
80-
singleLine = true,
81-
keyboardOptions = KeyboardOptions(
82-
imeAction = ImeAction.Search,
83-
keyboardType = KeyboardType.Text
84-
),
85-
keyboardActions = KeyboardActions(onSearch = {
86-
menuExpanded = false
87-
focusManager.clearFocus()
88-
onSubmit()
89-
}),
90-
label = { Text(stringResource(R.string.address_bar_label), maxLines = 1) },
91-
placeholder = { Text(address, maxLines = 1) },
92-
trailingIcon = {
93-
if (address.isNotEmpty()) {
94-
IconButton(
95-
onClick = {
96-
focusRequester.requestFocus()
97-
onChange("")
98-
}) {
99-
Icon(
100-
Icons.Outlined.Clear,
101-
contentDescription = stringResource(R.string.clear_address_content_description)
102-
)
103-
}
57+
ExposedDropdownMenuBox(
58+
modifier = Modifier.fillMaxWidth(),
59+
expanded = menuExpanded,
60+
onExpandedChange = { menuExpanded = it }) {
61+
OutlinedTextField(
62+
modifier = Modifier
63+
.fillMaxWidth()
64+
.focusRequester(focusRequester),
65+
value = address,
66+
onValueChange = {
67+
onChange(it)
68+
if (!menuExpanded) {
69+
menuExpanded = true
70+
}
71+
},
72+
singleLine = true,
73+
keyboardOptions = KeyboardOptions(
74+
imeAction = ImeAction.Search,
75+
keyboardType = KeyboardType.Text
76+
),
77+
keyboardActions = KeyboardActions(onSearch = {
78+
menuExpanded = false
79+
focusManager.clearFocus()
80+
onSubmit()
81+
}),
82+
label = { Text(stringResource(R.string.address_bar_label), maxLines = 1) },
83+
placeholder = { Text(address, maxLines = 1) },
84+
trailingIcon = {
85+
if (address.isNotEmpty()) {
86+
IconButton(
87+
onClick = {
88+
focusRequester.requestFocus()
89+
onChange("")
90+
}) {
91+
Icon(
92+
Icons.Outlined.Clear,
93+
contentDescription = stringResource(R.string.clear_address_content_description)
94+
)
10495
}
10596
}
106-
)
97+
}
98+
)
10799

108-
if (matchingAddresses.isNotEmpty()) {
109-
ExposedDropdownMenu(
110-
modifier = Modifier.testTag("address_dropdown"),
111-
expanded = menuExpanded, onDismissRequest = { menuExpanded = false }) {
112-
matchingAddresses.forEach { address ->
113-
DropdownMenuItem(onClick = {
114-
menuExpanded = false
115-
focusManager.clearFocus()
116-
onChange(address)
117-
onSubmit()
118-
}) {
119-
Text(address)
120-
}
100+
if (matchingAddresses.isNotEmpty()) {
101+
ExposedDropdownMenu(
102+
modifier = Modifier.testTag("address_dropdown"),
103+
expanded = menuExpanded, onDismissRequest = { menuExpanded = false }) {
104+
matchingAddresses.forEach { address ->
105+
DropdownMenuItem(onClick = {
106+
menuExpanded = false
107+
focusManager.clearFocus()
108+
onChange(address)
109+
onSubmit()
110+
}) {
111+
Text(address)
121112
}
122113
}
123114
}
124115
}
125-
126-
Spacer(Modifier.width(8.dp))
127-
128-
FavouriteButton(
129-
modifier = Modifier
130-
.align(Alignment.CenterVertically)
131-
.padding(top = 8.dp),
132-
isFavouriteLocation = isFavouriteLocation,
133-
addFavourite = onAddFavouriteClick,
134-
deleteFavourite = onDeleteFavouriteClick
135-
)
136116
}
137117

138118
val extraTextHeight = 20.dp
@@ -165,7 +145,6 @@ private fun AddressAreaPreview() {
165145
helper = AddressHelper.None,
166146
error = AddressError.None,
167147
matchingAddresses = listOf("Address 1", "VERY VERY VERY VERY VERY LONG ADDRESS"),
168-
isFavouriteLocation = true
169148
)
170149
}
171150
}
@@ -231,40 +210,4 @@ private fun HelperText(modifier: Modifier = Modifier, message: String) {
231210
style = MaterialTheme.typography.body1,
232211
fontWeight = FontWeight.Bold
233212
)
234-
}
235-
236-
@Composable
237-
private fun FavouriteButton(
238-
modifier: Modifier = Modifier,
239-
isFavouriteLocation: Boolean,
240-
deleteFavourite: () -> Unit,
241-
addFavourite: () -> Unit
242-
) {
243-
IconButton(
244-
modifier = modifier,
245-
onClick = {
246-
if (isFavouriteLocation) {
247-
deleteFavourite()
248-
} else {
249-
addFavourite()
250-
}
251-
}
252-
) {
253-
if (isFavouriteLocation) {
254-
Icon(
255-
modifier = Modifier.size(32.dp),
256-
imageVector = Icons.Outlined.Bookmark,
257-
contentDescription = stringResource(R.string.delete_favourite_button_content_description),
258-
tint = MapcodeColor.addFavouritesButton()
259-
)
260-
} else {
261-
Icon(
262-
modifier = Modifier.size(32.dp),
263-
imageVector = Icons.Outlined.BookmarkAdd,
264-
contentDescription = stringResource(R.string.add_favourite_button_content_description),
265-
tint = MapcodeColor.addFavouritesButton()
266-
)
267-
}
268-
}
269-
270213
}

0 commit comments

Comments
 (0)