commit 0bcf09bf79d82b0628078a17c087e0c87128bd3d
parent d10c5774797bbf58e280edc2acec6b3c46513b6e
Author: pollymce <pmceldowney@mozilla.com>
Date: Fri, 28 Nov 2025 14:43:42 +0000
Bug 2002235: Make profiler settings scrollable r=android-reviewers,mcarare
Previously, it was not always possible to reach the "start profiler" and "cancel" buttons on smaller screen devices.
Differential Revision: https://phabricator.services.mozilla.com/D273985
Diffstat:
1 file changed, 43 insertions(+), 25 deletions(-)
diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/perf/ProfilerStartDialogFragment.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/perf/ProfilerStartDialogFragment.kt
@@ -11,9 +11,12 @@ import android.view.ViewGroup
import android.widget.Toast
import androidx.annotation.StringRes
import androidx.appcompat.app.AppCompatDialogFragment
+import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
@@ -26,6 +29,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.tooling.preview.PreviewLightDark
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.window.Dialog
@@ -136,32 +140,35 @@ class ProfilerStartDialogFragment : AppCompatDialogFragment() {
)
Spacer(modifier = Modifier.height(8.dp))
-
- ProfilerSettings.entries.forEach { setting ->
- val settingName = when (setting) {
- ProfilerSettings.Firefox -> stringResource(R.string.profiler_filter_firefox)
- ProfilerSettings.Graphics -> stringResource(R.string.profiler_filter_graphics)
- ProfilerSettings.Media -> stringResource(R.string.profiler_filter_media)
- ProfilerSettings.Networking -> stringResource(R.string.profiler_filter_networking)
- ProfilerSettings.Debug -> stringResource(R.string.profiler_filter_debug)
- ProfilerSettings.WebCompat -> stringResource(R.string.profiler_filter_web_compat)
- }
- val settingDesc = when (setting) {
- ProfilerSettings.Firefox -> stringResource(R.string.profiler_filter_firefox_explain)
- ProfilerSettings.Graphics -> stringResource(R.string.profiler_filter_graphics_explain)
- ProfilerSettings.Media -> stringResource(R.string.profiler_filter_media_explain)
- ProfilerSettings.Networking -> stringResource(R.string.profiler_filter_networking_explain)
- ProfilerSettings.Debug -> stringResource(R.string.profiler_filter_debug_explain)
- ProfilerSettings.WebCompat -> stringResource(R.string.profiler_filter_web_compat_explain)
+ Column(
+ modifier = Modifier.weight(1f, fill = false)
+ .verticalScroll(rememberScrollState()),
+ ) {
+ ProfilerSettings.entries.forEach { setting ->
+ val settingName = when (setting) {
+ ProfilerSettings.Firefox -> stringResource(R.string.profiler_filter_firefox)
+ ProfilerSettings.Graphics -> stringResource(R.string.profiler_filter_graphics)
+ ProfilerSettings.Media -> stringResource(R.string.profiler_filter_media)
+ ProfilerSettings.Networking -> stringResource(R.string.profiler_filter_networking)
+ ProfilerSettings.Debug -> stringResource(R.string.profiler_filter_debug)
+ ProfilerSettings.WebCompat -> stringResource(R.string.profiler_filter_web_compat)
+ }
+ val settingDesc = when (setting) {
+ ProfilerSettings.Firefox -> stringResource(R.string.profiler_filter_firefox_explain)
+ ProfilerSettings.Graphics -> stringResource(R.string.profiler_filter_graphics_explain)
+ ProfilerSettings.Media -> stringResource(R.string.profiler_filter_media_explain)
+ ProfilerSettings.Networking -> stringResource(R.string.profiler_filter_networking_explain)
+ ProfilerSettings.Debug -> stringResource(R.string.profiler_filter_debug_explain)
+ ProfilerSettings.WebCompat -> stringResource(R.string.profiler_filter_web_compat_explain)
+ }
+
+ ProfilerLabeledRadioButton(
+ text = settingName,
+ subText = settingDesc,
+ selected = selectedSetting == setting,
+ onClick = { selectedSetting = setting },
+ )
}
-
- ProfilerLabeledRadioButton(
- text = settingName,
- subText = settingDesc,
- selected = selectedSetting == setting,
- onClick = { selectedSetting = setting },
- )
-
Spacer(modifier = Modifier.height(8.dp))
}
}
@@ -179,4 +186,15 @@ class ProfilerStartDialogFragment : AppCompatDialogFragment() {
onDismiss = onDismiss,
)
}
+
+ @Composable
+ @PreviewLightDark
+ private fun StartCardPreview() {
+ FirefoxTheme {
+ StartCard(
+ {},
+ {},
+ )
+ }
+ }
}