From c7617ba85643f4c115cb7bc73def144d764a306f Mon Sep 17 00:00:00 2001
From: str4d <str4d@mail.i2p>
Date: Mon, 30 Dec 2013 00:08:29 +0000
Subject: [PATCH] Ensure state image is correct when router has shut down

---
 src/net/i2p/android/router/MainFragment.java | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/net/i2p/android/router/MainFragment.java b/src/net/i2p/android/router/MainFragment.java
index 4550837f2..7e90c9ffa 100644
--- a/src/net/i2p/android/router/MainFragment.java
+++ b/src/net/i2p/android/router/MainFragment.java
@@ -171,6 +171,14 @@ public class MainFragment extends I2PFragmentBase {
 
         boolean isOn = mCallback.shouldBeOn();
         b.setChecked(isOn);
+
+        if (!isOn) {
+            // Sometimes the final state message from the RouterService
+            // is not received. Ensure that the state image is correct.
+            // TODO: Fix the race between RouterService shutdown and
+            // IRouterState unbinding.
+            updateState("INIT");
+        }
     }
 
     public boolean onBackPressed() {
-- 
GitLab