Skip to content

Commit

Permalink
add parameter to replace value with 'Inaccurate' message when it is i…
Browse files Browse the repository at this point in the history
…naccurate
  • Loading branch information
ruleant committed Nov 19, 2013
1 parent 01e21bf commit f7a143f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/org/ruleant/ariadne/AbstractAriadneActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,10 @@ protected final void refreshCrouton() {

/**
* Refresh current speed/bearing views.
*
* @param displayInaccurate display value when it is inaccurate
*/
protected final void refreshCurrentViews() {
protected final void refreshCurrentViews(final boolean displayInaccurate) {
// only refresh items if activity is bound to service
// connection state is checked in getNavigator
Navigator navigator = getNavigator();
Expand All @@ -320,13 +322,13 @@ protected final void refreshCurrentViews() {
String currentBearingText = res.getString(R.string.inaccurate);

// Update current speed
if (navigator.isLocationAccurate()) {
if (!displayInaccurate || navigator.isLocationAccurate()) {
currentSpeedText = FormatUtils.formatSpeed(
navigator.getCurrentSpeed(), this);
}

// Update current bearing
if (navigator.isBearingAccurate()) {
if (!displayInaccurate || navigator.isBearingAccurate()) {
currentBearingText = FormatUtils.formatAngle(
FormatUtils.normalizeAngle(navigator.getCurrentBearing()));
}
Expand Down
2 changes: 1 addition & 1 deletion src/org/ruleant/ariadne/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected final void refreshDisplay() {
super.refreshDisplay();

// refresh views with "current" info
refreshCurrentViews();
refreshCurrentViews(true);

// only refresh items if activity is bound to service
// connection state is checked in getNavigator
Expand Down

0 comments on commit f7a143f

Please sign in to comment.