commit 0a08e3bb618913238d48035d03325910202fe8c1
parent e9aefad31a1151c65fa6ee6b76c4becd81105b4f
Author: mcarare <48995920+mcarare@users.noreply.github.com>
Date: Wed, 1 Oct 2025 07:33:10 +0000
Bug 1991659 - Update Site Permissions dialog styling r=android-reviewers,avirvara
This patch updates the styling of the site permission prompts.
The changes include:
- Centering the prompt on the screen.
- Updating the background and text colors of the positive button for better contrast and visibility.
- Defining a new outlined button style and setting a default window background color in the main theme.
Differential Revision: https://phabricator.services.mozilla.com/D266876
Diffstat:
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/mobile/android/focus-android/app/src/main/java/org/mozilla/focus/fragment/BrowserFragment.kt b/mobile/android/focus-android/app/src/main/java/org/mozilla/focus/fragment/BrowserFragment.kt
@@ -536,6 +536,11 @@ class BrowserFragment :
feature = SitePermissionsFeature(
context = requireContext(),
fragmentManager = parentFragmentManager,
+ promptsStyling = SitePermissionsFeature.PromptsStyling(
+ gravity = Gravity.CENTER,
+ positiveButtonBackgroundColor = R.color.contrastColor,
+ positiveButtonTextColor = R.color.colorPrimary,
+ ),
onNeedToRequestPermissions = { permissions ->
if (SitePermissionOptionsStorage(requireContext()).isSitePermissionNotBlocked(permissions)) {
requestPermissionLauncher.launch(permissions)
diff --git a/mobile/android/focus-android/app/src/main/res/values/styles.xml b/mobile/android/focus-android/app/src/main/res/values/styles.xml
@@ -2,11 +2,13 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-<resources xmlns:tools="http://schemas.android.com/tools">
+<resources>
<style name="AppTheme" parent="Theme.Material3.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<!-- This is the default color for activated controls(buttons) -->
<item name="colorAccent">@color/accentBright</item>
+ <item name="android:windowBackground">@color/modal_background</item>
+ <item name="materialButtonOutlinedStyle">@style/Widget.App.Button.OutlinedButton</item>
<item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item>
<item name="android:windowContentTransitions">true</item>
@@ -40,6 +42,10 @@
<style name="Theme.CrashActivityTheme" parent="Theme.AppCompat.NoActionBar">
</style>
+ <style name="Widget.App.Button.OutlinedButton" parent="Widget.Material3.Button.OutlinedButton">
+ <item name="android:textColor">@color/contrastColor</item>
+ </style>
+
<!-- Fade animation for theme switching -->
<style name="WindowAnimationTransition">
<item name="android:windowEnterAnimation">@anim/fade_in</item>