Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.

Commit

Permalink
Avoid screen updates if hr is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
micrusa committed Jun 7, 2020
1 parent aa9a55e commit 1cde3bc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
12 changes: 7 additions & 5 deletions app/src/main/java/me/micrusa/amaztimer/AmazTimer.java
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,13 @@ private void timerUpdate(int v) {
if (!time.getText().toString().equals("--:--")) {
time.setText("--:--");
}
int latestHr = hrSensor.getLatestValue();
if(latestHr == 0)
hr.setText(getResources().getString(R.string.nullinfo));
else
hr.setText(hrSensor.getLatestValue());
if (new file(defValues.SETTINGS_FILE, this).get(defValues.SETTINGS_HRSWITCH, defValues.DEFAULT_HRSWITCH)){
int latestHr = hrSensor.getLatestValue();
if(latestHr == 0)
hr.setText(getResources().getString(R.string.nullinfo));
else
hr.setText(hrSensor.getLatestValue());
}
}
if (v < 4) {
if (v == 1)
Expand Down
12 changes: 7 additions & 5 deletions app/src/main/java/me/micrusa/amaztimer/widget.java
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,13 @@ private void timerUpdate(int v) {
if (!time.getText().toString().equals("--:--")) {
time.setText("--:--");
}
int latestHr = hrSensor.getLatestValue();
if(latestHr == 0)
hr.setText(this.mView.getContext().getResources().getString(R.string.nullinfo));
else
hr.setText(hrSensor.getLatestValue());
if (new file(defValues.SETTINGS_FILE, this.mView.getContext()).get(defValues.SETTINGS_HRSWITCH, defValues.DEFAULT_HRSWITCH)) {
int latestHr = hrSensor.getLatestValue();
if (latestHr == 0)
hr.setText(this.mView.getContext().getResources().getString(R.string.nullinfo));
else
hr.setText(hrSensor.getLatestValue());
}
}
if (v < 4) {
if (v == 1)
Expand Down

0 comments on commit 1cde3bc

Please sign in to comment.