added base files

This commit is contained in:
2025-12-09 11:35:41 +01:00
commit ec90a7f3aa
102 changed files with 1644 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
namespace 'com.example.FastDocumentation' // Replace with your package name
compileSdk 34 // Use the latest stable SDK
defaultConfig {
applicationId "com.example.FastDocumentation"
minSdk 24
targetSdk 34
versionCode 1
versionName "1.0"
}
// Optional: for Kotlin usage
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
// Add necessary dependencies
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
}

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.FastDocumentation">
<activity
android:name=".MainActivity"
android:exported="true"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@@ -0,0 +1,93 @@
package com.example.FastDocumentation
import android.os.Bundle
import android.webkit.HttpAuthHandler
import android.webkit.WebView
import android.webkit.WebViewClient
import androidx.appcompat.app.AppCompatActivity
import android.app.AlertDialog // NEW IMPORT for the dialog
import android.widget.EditText // NEW IMPORT for text inputs
import android.widget.LinearLayout // NEW IMPORT for dialog layout
import android.view.ViewGroup.LayoutParams.MATCH_PARENT // NEW IMPORT for layout
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT // NEW IMPORT for layout
class MainActivity : AppCompatActivity() {
private lateinit var myWebView: WebView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
myWebView = findViewById(R.id.webview)
// 1. Configure WebView Settings
val settings = myWebView.settings
settings.javaScriptEnabled = true
settings.domStorageEnabled = true
// 2. Keep navigation inside the WebView AND handle HTTP Auth (MODIFIED)
myWebView.webViewClient = object : WebViewClient() {
// This method is called when the server requests HTTP authentication (like Basic Auth)
override fun onReceivedHttpAuthRequest(
view: WebView?,
handler: HttpAuthHandler?,
host: String?,
realm: String?
) {
// Manually trigger the popup using an AlertDialog
if (handler != null) {
showHttpAuthDialog(handler, host, realm)
}
}
}
// 3. Load the Target URL
val urlToLoad = "https://docs.nxs.solutions/Fast"
myWebView.loadUrl(urlToLoad)
}
// NEW FUNCTION: Manually constructs and shows the HTTP Auth dialog
private fun showHttpAuthDialog(handler: HttpAuthHandler, host: String?, realm: String?) {
val usernameInput = EditText(this).apply { hint = "Username" }
val passwordInput = EditText(this).apply {
hint = "Password"
inputType = android.text.InputType.TYPE_CLASS_TEXT or android.text.InputType.TYPE_TEXT_VARIATION_PASSWORD
}
// Create a simple vertical layout for the two text fields
val layout = LinearLayout(this).apply {
orientation = LinearLayout.VERTICAL
setPadding(50, 20, 50, 20) // Add some padding
addView(usernameInput, LinearLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT))
addView(passwordInput, LinearLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT))
}
AlertDialog.Builder(this)
.setTitle("Authentication Required")
.setMessage("Please enter credentials for $realm on $host")
.setView(layout) // Set the custom layout
.setPositiveButton("Log In") { _, _ ->
// When the user clicks "Log In", proceed with the provided credentials
val username = usernameInput.text.toString()
val password = passwordInput.text.toString()
handler.proceed(username, password)
}
.setNegativeButton("Cancel") { _, _ ->
// If the user cancels, cancel the authentication request
handler.cancel()
}
.setCancelable(false)
.show()
}
// 4. Handle the device's back button
override fun onBackPressed() {
if (myWebView.canGoBack()) {
myWebView.goBack()
} else {
super.onBackPressed()
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#1A237E</color>
<color name="colorPrimary">#6200EE</color>
<color name="colorPrimaryDark">#3700B3</color>
<color name="colorAccent">#03DAC5</color>
</resources>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">FastDocumentation</string>
</resources>

View File

@@ -0,0 +1,7 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="Theme.FastDocumentation" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#6200EE</item>
<item name="colorPrimaryDark">#3700B3</item>
<item name="colorAccent">#03DAC5</item>
</style>
</resources>