Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b7879a75 authored by Guillaume Jacquart's avatar Guillaume Jacquart
Browse files

Merge branch '3375-fix_edge_to_edge' into 'main'

3375 fix edge to edge

See merge request !203
parents ef9114e9 e9266e17
Loading
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 E FOUNDATION
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */
package foundation.e.advancedprivacy.common

import android.view.View
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.updatePadding

fun setInsetAsBottomPadding(view: View) {
    ViewCompat.setOnApplyWindowInsetsListener(view) { v, windowInsets ->
        val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout())
        v.updatePadding(bottom = insets.bottom)
        WindowInsetsCompat.CONSUMED
    }
}
+4 −1
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 - 2025 E FOUNDATION
 * Copyright (C) 2023-2024 MURENA SAS
 * Copyright (C) 2021 E FOUNDATION
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
@@ -33,6 +33,7 @@ import foundation.e.advancedprivacy.R
import foundation.e.advancedprivacy.common.BigNumberFormatter
import foundation.e.advancedprivacy.common.NavToolbarFragment
import foundation.e.advancedprivacy.common.extensions.safeNavigate
import foundation.e.advancedprivacy.common.setInsetAsBottomPadding
import foundation.e.advancedprivacy.databinding.FragmentDashboardBinding
import foundation.e.advancedprivacy.domain.entities.FeatureMode
import foundation.e.advancedprivacy.domain.entities.FeatureState
@@ -53,6 +54,8 @@ class DashboardFragment : NavToolbarFragment(R.layout.fragment_dashboard) {
        super.onViewCreated(view, savedInstanceState)
        binding = FragmentDashboardBinding.bind(view)

        setInsetAsBottomPadding(binding.container)

        with(binding.dataBlockedTrackers) {
            primaryMessage.apply {
                setText(R.string.dashboard_data_blocked_trackers_primary)
+19 −0
Original line number Diff line number Diff line
@@ -18,7 +18,14 @@
package foundation.e.advancedprivacy.features.debug

import android.os.Bundle
import android.view.View
import android.view.ViewGroup.MarginLayoutParams
import androidx.core.view.ViewCompat
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.updateLayoutParams
import androidx.fragment.app.FragmentActivity
import foundation.e.advancedprivacy.R
import foundation.e.advancedprivacy.databinding.DebugActivityBinding

// Hidden debug tools activity for AdvancedPrivacy
@@ -28,6 +35,18 @@ class DebugActivity : FragmentActivity() {
    private lateinit var binding: DebugActivityBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        WindowCompat.setDecorFitsSystemWindows(window, false)

        ViewCompat.setOnApplyWindowInsetsListener(findViewById<View>(R.id.nav_host_fragment)) { v, windowInsets ->
            val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout())
            v.updateLayoutParams<MarginLayoutParams> {
                topMargin = insets.top
                leftMargin = insets.left
                bottomMargin = insets.bottom
                rightMargin = insets.right
            }
            WindowInsetsCompat.CONSUMED
        }

        binding = DebugActivityBinding.inflate(layoutInflater)
        setContentView(binding.root)
+4 −1
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 - 2025 E FOUNDATION
 * Copyright (C) 2023 MURENA SAS
 * Copyright (C) 2021 - 2024 E FOUNDATION
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
@@ -29,6 +29,7 @@ import androidx.lifecycle.repeatOnLifecycle
import androidx.recyclerview.widget.LinearLayoutManager
import foundation.e.advancedprivacy.R
import foundation.e.advancedprivacy.common.NavToolbarFragment
import foundation.e.advancedprivacy.common.setInsetAsBottomPadding
import foundation.e.advancedprivacy.common.setToolTipForAsterisk
import foundation.e.advancedprivacy.databinding.FragmentInternetActivityPolicyBinding
import foundation.e.advancedprivacy.domain.entities.FeatureState
@@ -52,6 +53,8 @@ class InternetPrivacyFragment : NavToolbarFragment(R.layout.fragment_internet_ac
        super.onViewCreated(view, savedInstanceState)
        _binding = FragmentInternetActivityPolicyBinding.bind(view)

        setInsetAsBottomPadding(binding.container)

        binding.apps.apply {
            layoutManager = LinearLayoutManager(requireContext())
            setHasFixedSize(true)
+4 −1
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 - 2025 E FOUNDATION
 * Copyright (C) 2023 MURENA SAS
 * Copyright (C) 2021 - 2024 E FOUNDATION
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
@@ -40,6 +40,7 @@ import com.google.android.material.textfield.TextInputLayout.END_ICON_CUSTOM
import com.google.android.material.textfield.TextInputLayout.END_ICON_NONE
import foundation.e.advancedprivacy.R
import foundation.e.advancedprivacy.common.NavToolbarFragment
import foundation.e.advancedprivacy.common.setInsetAsBottomPadding
import foundation.e.advancedprivacy.common.setToolTipForAsterisk
import foundation.e.advancedprivacy.databinding.FragmentFakeLocationBinding
import foundation.e.advancedprivacy.domain.entities.LocationMode
@@ -107,6 +108,8 @@ class FakeLocationFragment : NavToolbarFragment(R.layout.fragment_fake_location)
        super.onViewCreated(view, savedInstanceState)
        _binding = FragmentFakeLocationBinding.bind(view)

        setInsetAsBottomPadding(binding.container)

        binding.mapView.setup(savedInstanceState) { mapLibreMap ->
            this.mapLibreMap = mapLibreMap
            mapLibreMap.uiSettings.isRotateGesturesEnabled = false
Loading