commit 50c411f1dd5ebf075318f90bfd79d8cf7d32c4e5
Author: bim <dsnake(a)protonmail.com>
Date: Tue Feb 2 20:17:09 2021 -0500
When tor stops, stop sohwing wrong bandwidth stats
---
.../main/java/org/torproject/android/OrbotMainActivity.java | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/app/src/main/java/org/torproject/android/OrbotMainActivity.java b/app/src/main/java/org/torproject/android/OrbotMainActivity.java
index 1ee58106..a53fb4c9 100644
--- a/app/src/main/java/org/torproject/android/OrbotMainActivity.java
+++ b/app/src/main/java/org/torproject/android/OrbotMainActivity.java
@@ -308,9 +308,7 @@ public class OrbotMainActivity extends AppCompatActivity implements OrbotConstan
downloadText = findViewById(R.id.trafficDown);
uploadText = findViewById(R.id.trafficUp);
- String zero = String.format("%s / %s", formatCount(0), formatTotal(0));
- downloadText.setText(zero);
- uploadText.setText(zero);
+ resetBandwidthStatTextviews();
mBtnStart = findViewById(R.id.btnStart);
mBtnStart.setOnClickListener(v -> toggleTor());
@@ -340,6 +338,12 @@ public class OrbotMainActivity extends AppCompatActivity implements OrbotConstan
mPulsator = findViewById(R.id.pulsator);
}
+ private void resetBandwidthStatTextviews() {
+ String zero = String.format("%s / %s", formatCount(0), formatTotal(0));
+ downloadText.setText(zero);
+ uploadText.setText(zero);
+ }
+
private void toggleTor() { // UI entry point for (dis)connecting to Tor
if (torStatus.equals(TorServiceConstants.STATUS_OFF)) {
lblStatus.setText(getString(R.string.status_starting_up));
@@ -1033,6 +1037,7 @@ public class OrbotMainActivity extends AppCompatActivity implements OrbotConstan
lblStatus.setText(String.format("Tor v%s", OrbotService.BINARY_TOR_VERSION));
mBtnStart.setText(R.string.menu_start);
mPulsator.start();
+ resetBandwidthStatTextviews();
break;
}