From db4c26a400ab1f8c6afe8e2697239e7fbf862622 Mon Sep 17 00:00:00 2001 From: orignal Date: Wed, 15 Aug 2018 09:52:13 -0400 Subject: [PATCH] copy assets before daemon start --- .../src/org/purplei2p/i2pd/I2PDActivity.java | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/android/src/org/purplei2p/i2pd/I2PDActivity.java b/android/src/org/purplei2p/i2pd/I2PDActivity.java index 28e30251..997b90ac 100755 --- a/android/src/org/purplei2p/i2pd/I2PDActivity.java +++ b/android/src/org/purplei2p/i2pd/I2PDActivity.java @@ -30,6 +30,7 @@ public class I2PDActivity extends Activity { public static final int GRACEFUL_DELAY_MILLIS = 10 * 60 * 1000; private TextView textView; + private boolean assetsCopied; private static final DaemonSingleton daemon = DaemonSingleton.getInstance(); @@ -37,7 +38,25 @@ public class I2PDActivity extends Activity { new DaemonSingleton.StateUpdateListener() { @Override - public void daemonStateUpdate() { + public void daemonStateUpdate() + { + try + { + // copy assets + if (!assetsCopied) + { + assetsCopied = true; + copyAsset("certificates"); + copyAsset("i2pd.conf"); + copyAsset("subsciptions.txt"); + copyAsset("tunnels.conf"); + } + } + catch (Throwable tr) + { + Log.e(TAG,"copy assets",tr); + }; + runOnUiThread(new Runnable(){ @Override @@ -79,12 +98,6 @@ public class I2PDActivity extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - // copy assets - copyAsset("certificates"); - copyAsset("i2pd.conf"); - copyAsset("subsciptions.txt"); - copyAsset("tunnels.conf"); - textView = new TextView(this); setContentView(textView); daemon.addStateChangeListener(daemonStateUpdatedListener);