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

@@ -28,7 +28,6 @@ import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import net.i2p.android.router.service.IRouterState;
@@ -413,24 +412,6 @@ public class EmailListActivity extends ActionBarActivity implements
mDrawerToggle.onConfigurationChanged(newConfig);
}
private 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() {
// 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");
}
}
// FolderFragment.OnEmailSelectedListener
@Override

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");
}
}