Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app-android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ android {
compileSdk 36
applicationId "de.tutao.tutanota"
minSdkVersion 26
targetSdkVersion 35
targetSdkVersion 36
versionCode 396573
versionName "317.251215.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
31 changes: 29 additions & 2 deletions app-android/app/src/main/java/de/tutao/tutanota/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import android.util.Log
import android.view.ContextMenu
import android.view.ContextMenu.ContextMenuInfo
import android.view.View
import android.view.ViewGroup
import android.webkit.CookieManager
import android.webkit.MimeTypeMap
import android.webkit.PermissionRequest
Expand All @@ -33,6 +34,7 @@ import android.webkit.WebSettings
import android.webkit.WebView
import android.webkit.WebView.HitTestResult
import android.webkit.WebViewClient
import android.widget.LinearLayout
import android.widget.Toast
import androidx.activity.addCallback
import androidx.annotation.MainThread
Expand Down Expand Up @@ -102,6 +104,7 @@ interface WebauthnHandler {


class MainActivity : FragmentActivity() {
lateinit var linearLayout: LinearLayout
lateinit var webView: WebView
private set
private lateinit var sseStorage: SseStorage
Expand Down Expand Up @@ -133,6 +136,8 @@ class MainActivity : FragmentActivity() {
createAndroidKeyStoreFacade()
)

linearLayout = LinearLayout(this)

// On top before CalendarFacade because we need the user agent to sync external calendars
webView = WebView(this)

Expand Down Expand Up @@ -161,7 +166,8 @@ class MainActivity : FragmentActivity() {
themeFacade = AndroidThemeFacade(this, this)

sqlCipherFacade = AndroidSqlCipherFacade(this)
commonSystemFacade = AndroidCommonSystemFacade(this, sqlCipherFacade, fileFacade.tempDir, NetworkUtils.defaultClient)
commonSystemFacade =
AndroidCommonSystemFacade(this, sqlCipherFacade, fileFacade.tempDir, NetworkUtils.defaultClient)

val webauthnFacade = AndroidWebauthnFacade(this, ipcJson)

Expand Down Expand Up @@ -310,7 +316,19 @@ class MainActivity : FragmentActivity() {
// Handle long click on links in the WebView
registerForContextMenu(webView)

setContentView(webView)
//to make the webView edge-to-edge add the statusBar and bottomNavigation height as top and bottom padding to its parent linearLayout
val navigationBarHeight = getBarHeight("navigation_bar_height")
val statusBarHeight = getBarHeight("status_bar_height")

linearLayout.setPadding(0, statusBarHeight, 0, navigationBarHeight)

webView.setLayoutParams(
ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
)

linearLayout.addView(webView)

setContentView(linearLayout)

// Set callback for back press
onBackPressedDispatcher.addCallback(this) {
Expand Down Expand Up @@ -357,6 +375,15 @@ class MainActivity : FragmentActivity() {
firstLoaded = true
}

// return the statusBar/BottomNavigationBar height
private fun getBarHeight(sectionName: String): Int {
var result = 0
val resourceId = resources.getIdentifier(sectionName, "dimen", "android")
if (resourceId > 0) {
result = resources.getDimensionPixelSize(resourceId)
}
return result
}

/** @return "result" extra value */
suspend fun startWebauthn(uri: Uri): String {
Expand Down
1 change: 0 additions & 1 deletion app-android/app/src/main/res/values-night-v35/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@
<item name="android:windowSplashScreenAnimatedIcon">
@drawable/ic_logo
</item>
<item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>
</style>
</resources>
2 changes: 0 additions & 2 deletions app-android/app/src/main/res/values-v35/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<item name="android:colorPrimaryDark">@color/red</item>
<item name="android:statusBarColor">@color/white</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>
</style>

<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
Expand All @@ -15,6 +14,5 @@
<item name="android:windowBackground">@drawable/splash_background</item>
<item name="android:statusBarColor">@color/white</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>
</style>
</resources>