Skip to content

Commit

Permalink
Improve formatting of lon/lat info messages
Browse files Browse the repository at this point in the history
  • Loading branch information
CNugteren committed Jul 28, 2020
1 parent 80f9a3b commit 286c12e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ class BuienradarChartFragment : Fragment() {
latitude!!.toFloat() < 49.5f ||
longitude!!.toFloat() > 8.0f ||
longitude!!.toFloat() < 1.0f) {
chart.setNoDataText(getString(R.string.menu_buienradar_chart_outside_of_range) + " :" +
"lat=" + latitude.toString() + ", lon=" + longitude.toString())
chart.setNoDataText(getString(R.string.menu_buienradar_chart_outside_of_range) + ": " +
"lat=%.2f, lon=%.2f".format(latitude, longitude))
chart.invalidate()
}
else {
Expand All @@ -134,8 +134,8 @@ class BuienradarChartFragment : Fragment() {
// When complete: parses the result
override fun onPostExecute(htmlDocument: Document?) {
if (htmlDocument == null || htmlDocument.text() == "") {
chart.setNoDataText(getString(R.string.menu_buienradar_chart_error) + " :" +
"lat=" + latitude.toString() + ", lon=" + longitude.toString())
chart.setNoDataText(getString(R.string.menu_buienradar_chart_error) + ": " +
"lat=%.2f, lon=%.2f".format(latitude, longitude))
chart.invalidate()
return
}
Expand Down Expand Up @@ -168,7 +168,8 @@ class BuienradarChartFragment : Fragment() {
dataSet.setColors(colors, context)
chart.data = BarData(dataSet)
}
chart.setNoDataText(getString(R.string.menu_buienradar_chart_empty))
chart.setNoDataText(getString(R.string.menu_buienradar_chart_empty) + ": " +
"lat=%.2f, lon=%.2f".format(latitude, longitude))

// The labels on the x-axis
val formatter: ValueFormatter =
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-nl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<string name="menu_buienradar_chart_unit">mm/u</string>
<string name="menu_buienradar_chart_description">Twee uur vooruit op</string>
<string name="menu_buienradar_chart_loading">Data wordt geladen...</string>
<string name="menu_buienradar_chart_empty">Geen regen verwacht</string>
<string name="menu_buienradar_chart_empty">Geen regen verwacht op</string>
<string name="menu_buienradar_chart_no_location">Fout: Locatie niet opgegeven, controleer de instellingen</string>
<string name="menu_buienradar_chart_outside_of_range">Fout: Locatie is buiten Nederland</string>
<string name="menu_buienradar_chart_error">Data kon niet geladen worden, probeer later opnieuw</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 @@ -40,7 +40,7 @@
<string name="menu_buienradar_chart_unit">mm/h</string>
<string name="menu_buienradar_chart_description">Two hours ahead at</string>
<string name="menu_buienradar_chart_loading">Data is being loaded...</string>
<string name="menu_buienradar_chart_empty">No precipitation expected</string>
<string name="menu_buienradar_chart_empty">No precipitation expected at</string>
<string name="menu_buienradar_chart_no_location">Error: Location not set, verify the settings</string>
<string name="menu_buienradar_chart_outside_of_range">Error: Location outside of the Netherlands</string>
<string name="menu_buienradar_chart_error">Data could not be loaded, try again later</string>
Expand Down

0 comments on commit 286c12e

Please sign in to comment.