diff options
Diffstat (limited to 'packages/meshbay-android/app')
4 files changed, 29 insertions, 0 deletions
diff --git a/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/MainActivity.kt b/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/MainActivity.kt index fc446b9..0fa63d6 100644 --- a/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/MainActivity.kt +++ b/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/MainActivity.kt @@ -6,9 +6,11 @@ import android.content.Intent import android.net.Uri import android.os.Build import android.os.Bundle +import android.os.SystemClock import android.util.Log import android.view.View import android.view.ViewGroup +import android.view.ViewTreeObserver import android.view.WindowInsets import android.webkit.ConsoleMessage import android.webkit.PermissionRequest @@ -66,6 +68,7 @@ class MainActivity : Activity() { root = FrameLayout(this) setContentView(root) applyInsets(root) + if (savedInstanceState == null && Build.VERSION.SDK_INT >= 31) holdSplash() // A WebView too old for the page's crypto would fail at the first // handshake; say so before loading anything. @@ -255,6 +258,22 @@ class MainActivity : Activity() { catch (e: android.content.ActivityNotFoundException) { Log.w(Bridge.TAG, "no browser for $url") } } + /** + * Android 12+ shows the launcher icon until the first frame is drawn, which + * on a warm process is a flash. Holding that frame keeps it up long enough + * to be seen; the WebView loads underneath in the meantime. + */ + private fun holdSplash() { + val until = SystemClock.uptimeMillis() + SPLASH_MS + root.viewTreeObserver.addOnPreDrawListener(object : ViewTreeObserver.OnPreDrawListener { + override fun onPreDraw(): Boolean { + if (SystemClock.uptimeMillis() < until) return false + root.viewTreeObserver.removeOnPreDrawListener(this) + return true + } + }) + } + /** Edge-to-edge is enforced from Android 15: keep the page clear of the bars and the keyboard. */ private fun applyInsets(view: View) { view.setOnApplyWindowInsetsListener { v, insets -> @@ -296,4 +315,8 @@ class MainActivity : Activity() { if (::web.isInitialized) { root.removeView(web); web.destroy() } super.onDestroy() } + + companion object { + private const val SPLASH_MS = 500L + } } diff --git a/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/keys/Kdf.kt b/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/keys/Kdf.kt index 30f094e..404efcb 100644 --- a/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/keys/Kdf.kt +++ b/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/keys/Kdf.kt @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Part of MeshBay's protocol layer, under the LGPL so that any client may use it. package org.meshbay.client.keys import org.bouncycastle.crypto.digests.SHA256Digest diff --git a/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/keys/Keyring.kt b/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/keys/Keyring.kt index fa8ff71..9a7dd9f 100644 --- a/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/keys/Keyring.kt +++ b/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/keys/Keyring.kt @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Part of MeshBay's protocol layer, under the LGPL so that any client may use it. package org.meshbay.client.keys import org.bouncycastle.crypto.agreement.X25519Agreement diff --git a/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/keys/Transcripts.kt b/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/keys/Transcripts.kt index 4d183f7..cf20a0b 100644 --- a/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/keys/Transcripts.kt +++ b/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/keys/Transcripts.kt @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Part of MeshBay's protocol layer, under the LGPL so that any client may use it. package org.meshbay.client.keys import org.json.JSONObject |