Skip to content

Commit 34e5189

Browse files
committed
Added Edge-to-Edge support
1 parent 73f431d commit 34e5189

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/CreateMessageActivity.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ import android.os.Bundle
1111
import android.view.LayoutInflater
1212
import android.widget.Toast
1313
import androidx.activity.OnBackPressedCallback
14+
import androidx.activity.enableEdgeToEdge
15+
import androidx.core.view.ViewCompat
16+
import androidx.core.view.WindowInsetsCompat
17+
import androidx.core.view.updatePadding
1418
import androidx.navigation.NavHostController
1519
import androidx.navigation.ui.AppBarConfiguration
1620
import com.flowcrypt.email.Constants
@@ -69,12 +73,14 @@ class CreateMessageActivity : BaseActivity<ActivityCreateMessageBinding>(),
6973
}
7074

7175
override fun onCreate(savedInstanceState: Bundle?) {
76+
enableEdgeToEdge()
7277
super.onCreate(savedInstanceState)
7378
(navController as? NavHostController)?.enableOnBackPressed(true)
7479
isNavigationArrowDisplayed = true
7580
val navGraph = navController.navInflater.inflate(R.navigation.create_msg_graph)
7681
navController.setGraph(navGraph, intent.extras)
7782
FileAndDirectoryUtils.cleanDir(File(cacheDir, Constants.DRAFT_CACHE_DIR))
83+
applyInsetsToSupportEdgeToEdge()
7884
}
7985

8086
override fun onAccountInfoRefreshed(accountEntity: AccountEntity?) {
@@ -95,6 +101,15 @@ class CreateMessageActivity : BaseActivity<ActivityCreateMessageBinding>(),
95101
}
96102
}
97103

104+
fun applyInsetsToSupportEdgeToEdge() {
105+
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { _, insets ->
106+
val bars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
107+
binding.appBarLayout.updatePadding(top = bars.top)
108+
binding.root.updatePadding(bottom = bars.bottom)
109+
insets
110+
}
111+
}
112+
98113
companion object {
99114
fun generateIntent(
100115
context: Context?,

FlowCrypt/src/main/res/values/themes.xml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,10 @@
33
~ Contributors: denbond7
44
-->
55

6-
<resources xmlns:tools="http://schemas.android.com/tools">
6+
<resources>
77
<!-- Base application theme. -->
88
<style name="AppTheme" parent="Theme.Material3.DayNight">
99

10-
<!-- A temporary solution to fix edge-to-edge issue, should be finally fixed by
11-
https://github.com/FlowCrypt/flowcrypt-android/issues/2958
12-
-->
13-
<item name="android:windowOptOutEdgeToEdgeEnforcement" tools:targetApi="35">true</item>
14-
1510
<!-- Customize your theme here. -->
1611
<item name="colorPrimary">@color/colorPrimary</item>
1712
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>

0 commit comments

Comments
 (0)