Move app initialization out of EmailListActivity so it can be used elsewhere

This commit is contained in:
str4d
2014-07-02 01:39:50 +00:00
parent 5f9879eb0f
commit b6310ab263
2 changed files with 27 additions and 19 deletions

View File

@@ -0,0 +1,27 @@
package i2p.bote.android;
import android.content.Context;
class InitActivities {
private final Context ctx;
private final String myDir;
public InitActivities(Context c) {
ctx = c;
// This needs to be changed so that we can have an alternative place
myDir = c.getFilesDir().getAbsolutePath();
}
void initialize() {
// Don't initialize twice
if (System.getProperty("i2pbote.initialized", "false").equals("true"))
return;
// Set up the locations so settings can find them
System.setProperty("i2p.dir.base", myDir);
System.setProperty("i2p.dir.config", myDir);
System.setProperty("wrapper.logfile", myDir + "/wrapper.log");
System.setProperty("i2pbote.initialized", "true");
}
}