Ensure that I2P system vars are set in any Activity that uses I2PBote

Sometimes the Android runtime kills off the Bote process to save memory, and
recreates it when the user next opens it. If the user was on an Activity that
was not EmailListActivity, then when recreated the I2P system vars would not be
set, and the first call to I2PBote.getInstance() would create an instance with
invalid paths. This was non-fatal - killing Bote and restarting it would fix
the problem - but was bad UX, because from the user's PoV all their emails and
data had disappeared.
This commit is contained in:
str4d
2014-07-02 03:01:28 +00:00
parent 8ed6bbd0fe
commit 085778c98f
10 changed files with 47 additions and 3 deletions

View File

@@ -2,7 +2,7 @@ package i2p.bote.android;
import android.content.Context;
class InitActivities {
public class InitActivities {
private final Context ctx;
private final String myDir;
@@ -12,7 +12,7 @@ class InitActivities {
myDir = c.getFilesDir().getAbsolutePath();
}
void initialize() {
public void initialize() {
// Don't initialize twice
if (System.getProperty("i2pbote.initialized", "false").equals("true"))
return;