From 35e8424293e62be087e4a0b5daac11153e46169a Mon Sep 17 00:00:00 2001 From: potatowipedlifereverse Date: Mon, 2 Mar 2020 01:47:48 +0300 Subject: [PATCH 1/3] preinit webview+configparser+README.md tabulation fixes configparser to comments dont need pre init webview readme changes delete submodules webview in main menu webview pre init delete modules delete submodules --- .gitmodules | 0 android/AndroidManifest.xml | 1 + android/README.md | 19 ++++++++++++++++ android/res/layout/webview.xml | 13 +++++++++++ android/res/menu/options_main.xml | 4 ++++ android/res/values/strings.xml | 1 + .../src/org/purplei2p/i2pd/I2PDActivity.java | 22 +++++++++++++++++++ 7 files changed, 60 insertions(+) create mode 100644 .gitmodules create mode 100644 android/README.md create mode 100644 android/res/layout/webview.xml diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..e69de29b diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 71526701..a95e3773 100755 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -17,6 +17,7 @@ android:label="@string/app_name" android:theme="@android:style/Theme.Holo.Light.DarkActionBar" android:requestLegacyExternalStorage="true" + android:usesCleartextTraffic="true" > diff --git a/android/README.md b/android/README.md new file mode 100644 index 00000000..de6a16c3 --- /dev/null +++ b/android/README.md @@ -0,0 +1,19 @@ +# how to compile? +## Install the gradle + NDK or use android-studio +[![https://gradle.org/install/]](https://gradle.org/install/) + +## Install the depencies +``` +git clone https://github.com/PurpleI2P/Boost-for-Android-Prebuilt.git -b boost-1_72_0 +git clone https://github.com/PurpleI2P/android-ifaddrs.git +git clone https://github.com/PurpleI2P/OpenSSL-for-Android-Prebuilt.git +git clone https://github.com/PurpleI2P/MiniUPnP-for-Android-Prebuilt.git +``` +## Set libs in jni/Application.mk on 24 line: +``` +# change to your own +I2PD_LIBS_PATH = /home/user/i2pd/android/ +``` + +## compile apk file +gradle clean assembleRelease diff --git a/android/res/layout/webview.xml b/android/res/layout/webview.xml new file mode 100644 index 00000000..d13be23e --- /dev/null +++ b/android/res/layout/webview.xml @@ -0,0 +1,13 @@ + + + + + diff --git a/android/res/menu/options_main.xml b/android/res/menu/options_main.xml index 089c2700..b0f23bd2 100644 --- a/android/res/menu/options_main.xml +++ b/android/res/menu/options_main.xml @@ -12,6 +12,10 @@ android:id="@+id/action_graceful_stop" android:orderInCategory="98" android:title="@string/action_graceful_stop" /> + Battery Optimizations Your Android OS version does not support showing the dialog for battery optimizations for applications. Planned shutdown canceled + Start webview diff --git a/android/src/org/purplei2p/i2pd/I2PDActivity.java b/android/src/org/purplei2p/i2pd/I2PDActivity.java index 89881b42..7949e8d0 100755 --- a/android/src/org/purplei2p/i2pd/I2PDActivity.java +++ b/android/src/org/purplei2p/i2pd/I2PDActivity.java @@ -39,15 +39,23 @@ import android.view.MenuItem; import android.widget.TextView; import android.widget.Toast; + import androidx.annotation.NonNull; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; // For future package update checking +import android.webkit.WebSettings; +import android.webkit.WebView; +import android.webkit.WebViewClient; + + import static android.provider.Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS; public class I2PDActivity extends Activity { + private WebView webView; + private static final String TAG = "i2pdActvt"; private static final int MY_PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE = 1; public static final int GRACEFUL_DELAY_MILLIS = 10 * 60 * 1000; @@ -56,6 +64,7 @@ public class I2PDActivity extends Activity { private TextView textView; private boolean assetsCopied; private String i2pdpath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/i2pd/"; + //private ConfigParser parser = new ConfigParser(i2pdpath); // TODO: private static final DaemonSingleton daemon = DaemonSingleton.getInstance(); @@ -262,6 +271,16 @@ public class I2PDActivity extends Activity { case R.id.action_battery_otimizations: onActionBatteryOptimizations(); return true; + case R.id.action_start_webview: + setContentView(R.layout.webview); + this.webView = (WebView) findViewById(R.id.webview1); + this.webView.setWebViewClient(new WebViewClient()); + + WebSettings webSettings = this.webView.getSettings(); + webSettings.setBuiltInZoomControls(true); + webSettings.setJavaScriptEnabled(false); + this.webView.loadUrl("http://127.0.0.1:7070"); // TODO: instead 7070 I2Pd....HttpPort + break; } return super.onOptionsItemSelected(item); @@ -617,4 +636,7 @@ public class I2PDActivity extends Activity { } System.exit(0); } + public String getI2pdpath(){ + return this.i2pdpath; + } } From b6368170ed4049859f8c3e22e11a3a1def7ce159 Mon Sep 17 00:00:00 2001 From: wipedlifepotato <60944239+wipedlifepotato@users.noreply.github.com> Date: Mon, 2 Mar 2020 04:00:28 +0300 Subject: [PATCH 2/3] Update README.md --- android/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/README.md b/android/README.md index de6a16c3..e0850b15 100644 --- a/android/README.md +++ b/android/README.md @@ -1,6 +1,6 @@ # how to compile? ## Install the gradle + NDK or use android-studio -[![https://gradle.org/install/]](https://gradle.org/install/) +[https://gradle.org/install/](https://gradle.org/install/) ## Install the depencies ``` From c6ccb373a22ed6df9f5c13f7ca20a77a9ecaf339 Mon Sep 17 00:00:00 2001 From: potatowipedlifereverse Date: Mon, 2 Mar 2020 05:04:37 +0300 Subject: [PATCH 3/3] del geti2pdpath --- android/src/org/purplei2p/i2pd/I2PDActivity.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/android/src/org/purplei2p/i2pd/I2PDActivity.java b/android/src/org/purplei2p/i2pd/I2PDActivity.java index 7949e8d0..258bafe2 100755 --- a/android/src/org/purplei2p/i2pd/I2PDActivity.java +++ b/android/src/org/purplei2p/i2pd/I2PDActivity.java @@ -636,7 +636,4 @@ public class I2PDActivity extends Activity { } System.exit(0); } - public String getI2pdpath(){ - return this.i2pdpath; - } }