Browse Source

Fixes #1563

pull/1564/head
user 4 years ago
parent
commit
bfcf3cfbf1
  1. 11
      android/AndroidManifest.xml
  2. 4
      android/build.gradle
  3. 4
      android/res/layout/activity_web_console.xml
  4. 11
      android/src/org/purplei2p/i2pd/I2PDActivity.java
  5. 41
      android/src/org/purplei2p/i2pd/WebConsoleActivity.java

11
android/AndroidManifest.xml

@ -15,10 +15,10 @@ @@ -15,10 +15,10 @@
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@android:style/Theme.Holo.Light.DarkActionBar"
android:requestLegacyExternalStorage="true"
android:usesCleartextTraffic="true"
>
android:theme="@android:style/Theme.Holo.Light.DarkActionBar"
android:usesCleartextTraffic="true">
<activity android:name=".WebConsoleActivity"></activity>
<receiver android:name=".NetworkStateChangeReceiver">
<intent-filter>
@ -31,10 +31,10 @@ @@ -31,10 +31,10 @@
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".I2PDActivity"
android:label="@string/app_name" />
@ -52,4 +52,5 @@ @@ -52,4 +52,5 @@
android:value="org.purplei2p.i2pd.I2PDPermsAskerActivity" />
</activity>
</application>
</manifest>
</manifest>

4
android/build.gradle

@ -21,6 +21,8 @@ repositories { @@ -21,6 +21,8 @@ repositories {
dependencies {
implementation 'androidx.core:core:1.0.2'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
}
android {
@ -90,7 +92,7 @@ android { @@ -90,7 +92,7 @@ android {
}
}
ext.abiCodes = ['armeabi-v7a':1, 'x86':2, 'arm64-v8a':3, 'x86_64':4]
ext.abiCodes = ['armeabi-v7a': 1, 'x86': 2, 'arm64-v8a': 3, 'x86_64': 4]
import com.android.build.OutputFile
android.applicationVariants.all { variant ->

4
android/res/layout/webview.xml → android/res/layout/activity_web_console.xml

@ -1,12 +1,14 @@ @@ -1,12 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/layout_prompt"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context=".I2PDActivity">
tools:context=".WebConsoleActivity">
<WebView
android:id="@+id/webview1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>

11
android/src/org/purplei2p/i2pd/I2PDActivity.java

@ -276,15 +276,8 @@ public class I2PDActivity extends Activity { @@ -276,15 +276,8 @@ public class I2PDActivity extends Activity {
return true;
case R.id.action_start_webview:
setContentView(R.layout.webview);
final WebView webView = findViewById(R.id.webview1);
webView.setWebViewClient(new WebViewClient());
final WebSettings webSettings = webView.getSettings();
webSettings.setBuiltInZoomControls(true);
webSettings.setJavaScriptEnabled(false);
webView.loadUrl("http://127.0.0.1:7070"); // TODO: instead 7070 I2Pd....HttpPort
break;
startActivity(new Intent(getApplicationContext(), WebConsoleActivity.class));
return true;
}
return super.onOptionsItemSelected(item);

41
android/src/org/purplei2p/i2pd/WebConsoleActivity.java

@ -0,0 +1,41 @@ @@ -0,0 +1,41 @@
package org.purplei2p.i2pd;
import androidx.appcompat.app.AppCompatActivity;
import android.app.Activity;
import android.os.Bundle;
import android.view.MenuItem;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import java.util.Objects;
public class WebConsoleActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_web_console);
Objects.requireNonNull(getActionBar()).setDisplayHomeAsUpEnabled(true);
final WebView webView = findViewById(R.id.webview1);
webView.setWebViewClient(new WebViewClient());
final WebSettings webSettings = webView.getSettings();
webSettings.setBuiltInZoomControls(true);
webSettings.setJavaScriptEnabled(false);
webView.loadUrl("http://127.0.0.1:7070"); // TODO: instead 7070 I2Pd....HttpPort
}
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id==android.R.id.home) {
finish();
return true;
}
return false;
}
}
Loading…
Cancel
Save