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

Change get ui address to handle empty locality, admin and country code #311

Merged
merged 1 commit into from
Nov 4, 2024
Merged
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
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ android {
applicationId "org.permanent.PermanentArchive"
minSdkVersion 26
targetSdkVersion 34
versionCode 72
versionCode 73
versionName "1.9.4"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,7 @@ class FileData private constructor() : Parcelable {
originalFileName = recordVO.uploadFileName?.substringBefore(".")
originalFileType = recordVO.uploadFileName?.substringAfter(".")

completeAddress = recordVO.LocnVO?.let {
val streetName = if (it.streetName == null) "" else it.streetName + ", "
val addressValue =
(it.streetNumber ?: "") + " " + streetName + it.locality +
", " + it.adminOneName + ", " + it.countryCode
if (!addressValue.contains("null")) addressValue else ""
}
completeAddress = recordVO.LocnVO?.getUIAddress()
latitude = recordVO.LocnVO?.latitude ?: -1.0
longitude = recordVO.LocnVO?.longitude ?: -1.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ class LocnVO() : Parcelable {
}

fun getUIAddress(): String {
if (uiAddress == null) {
if (uiAddress.isNullOrEmpty()) {
val strName = if (streetName == null) "" else "$streetName, "
val localityName = if (locality == null) "" else "$locality, "
val adminName = if (adminOneName == null) "" else "$adminOneName, "
val countryCodeName = if (countryCode == null) "" else "$countryCode"
val addressValue = (streetNumber ?: "") + " " + strName +
locality + ", " + adminOneName + ", " + countryCode
localityName + adminName + countryCodeName
uiAddress = if (!addressValue.contains("null")) addressValue.trim() else ""
}

Expand Down
Loading