mirror of
				https://github.com/PurpleI2P/i2pd.git
				synced 2025-11-04 08:30:46 +00:00 
			
		
		
		
	Fixes #1563
This commit is contained in:
		
							parent
							
								
									db3e48a81a
								
							
						
					
					
						commit
						bfcf3cfbf1
					
				
					 5 changed files with 55 additions and 16 deletions
				
			
		| 
						 | 
				
			
			@ -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 @@
 | 
			
		|||
            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 @@
 | 
			
		|||
                android:value="org.purplei2p.i2pd.I2PDPermsAskerActivity" />
 | 
			
		||||
        </activity>
 | 
			
		||||
    </application>
 | 
			
		||||
</manifest>
 | 
			
		||||
 | 
			
		||||
</manifest>
 | 
			
		||||
| 
						 | 
				
			
			@ -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 {
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 ->
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -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
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								android/src/org/purplei2p/i2pd/WebConsoleActivity.java
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -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…
	
	Add table
		Add a link
		
	
		Reference in a new issue