commit 8898eb88313e8bdde1e2e7f7230c3dd12ea5e511 parent 3563d70aaf22c5ed15917da4302414bbc41de734 Author: Ryan VanderMeulen <rvandermeulen@mozilla.com> Date: Sat, 6 Dec 2025 16:45:09 +0000 Bug 2003775 - Fix parameter-list-wrapping errors. r=android-reviewers,mcarare Differential Revision: https://phabricator.services.mozilla.com/D274971 Diffstat:
70 files changed, 359 insertions(+), 114 deletions(-)
diff --git a/mobile/android/android-components/components/browser/icons/src/main/java/mozilla/components/browser/icons/IconRequest.kt b/mobile/android/android-components/components/browser/icons/src/main/java/mozilla/components/browser/icons/IconRequest.kt @@ -33,7 +33,9 @@ data class IconRequest( * * We are trying to limit the supported sizes in order to optimize our caching strategy. */ - enum class Size(@param:DimenRes val dimen: Int) { + enum class Size( + @param:DimenRes val dimen: Int, + ) { DEFAULT(R.dimen.mozac_browser_icons_size_default), LAUNCHER(R.dimen.mozac_browser_icons_size_launcher), LAUNCHER_ADAPTIVE(R.dimen.mozac_browser_icons_size_launcher_adaptive), diff --git a/mobile/android/android-components/components/browser/menu/src/main/java/mozilla/components/browser/menu/item/BrowserMenuImageText.kt b/mobile/android/android-components/components/browser/menu/src/main/java/mozilla/components/browser/menu/item/BrowserMenuImageText.kt @@ -24,13 +24,17 @@ import mozilla.components.concept.menu.candidate.TextStyle internal const val NO_ID = -1 -internal fun ImageView.setTintResource(@ColorRes tintColorResource: Int) { +internal fun ImageView.setTintResource( + @ColorRes tintColorResource: Int, +) { if (tintColorResource != NO_ID) { imageTintList = AppCompatResources.getColorStateList(context, tintColorResource) } } -internal fun TextView.setColorResource(@ColorRes textColorResource: Int) { +internal fun TextView.setColorResource( + @ColorRes textColorResource: Int, +) { if (textColorResource != NO_ID) { setTextColor(getColor(context, textColorResource)) } diff --git a/mobile/android/android-components/components/browser/menu/src/main/java/mozilla/components/browser/menu/view/MenuButton.kt b/mobile/android/android-components/components/browser/menu/src/main/java/mozilla/components/browser/menu/view/MenuButton.kt @@ -237,7 +237,9 @@ class MenuButton @JvmOverloads constructor( /** * Sets the tint of the 3-dot menu icon. */ - override fun setColorFilter(@ColorInt color: Int) { + override fun setColorFilter( + @ColorInt color: Int, + ) { menuIcon.setColorFilter(color) } diff --git a/mobile/android/android-components/components/browser/menu2/src/main/java/mozilla/components/browser/menu2/adapter/icons/MenuIconViewHolder.kt b/mobile/android/android-components/components/browser/menu2/src/main/java/mozilla/components/browser/menu2/adapter/icons/MenuIconViewHolder.kt @@ -40,7 +40,9 @@ internal abstract class MenuIconViewHolder<T : MenuIcon>( /** * Inflates the layout resource and adds it to the parent layout. */ - protected fun inflate(@LayoutRes layoutResource: Int): View { + protected fun inflate( + @LayoutRes layoutResource: Int, + ): View { val view = inflater.inflate(layoutResource, parent, false) parent.addView(view) return view diff --git a/mobile/android/android-components/components/browser/menu2/src/main/java/mozilla/components/browser/menu2/view/MenuButton2.kt b/mobile/android/android-components/components/browser/menu2/src/main/java/mozilla/components/browser/menu2/view/MenuButton2.kt @@ -114,5 +114,7 @@ class MenuButton2 @JvmOverloads constructor( /** * Sets the tint of the 3-dot menu icon. */ - override fun setColorFilter(@ColorInt color: Int) = menuIcon.setColorFilter(color) + override fun setColorFilter( + @ColorInt color: Int, + ) = menuIcon.setColorFilter(color) } diff --git a/mobile/android/android-components/components/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/BrowserToolbar.kt b/mobile/android/android-components/components/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/BrowserToolbar.kt @@ -40,7 +40,9 @@ import mozilla.components.ui.autocomplete.OnFilterListener import mozilla.components.ui.widgets.behavior.EngineViewScrollingBehavior import kotlin.coroutines.CoroutineContext -internal fun ImageView.setTintResource(@ColorRes tintColorResource: Int) { +internal fun ImageView.setTintResource( + @ColorRes tintColorResource: Int, +) { if (tintColorResource != NO_ID) { imageTintList = AppCompatResources.getColorStateList(context, tintColorResource) } diff --git a/mobile/android/android-components/components/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/display/MenuButton.kt b/mobile/android/android-components/components/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/display/MenuButton.kt @@ -94,7 +94,9 @@ internal class MenuButton( impl.onDismiss = onDismiss } - fun setColorFilter(@ColorInt color: Int) = impl.setColorFilter(color) + fun setColorFilter( + @ColorInt color: Int, + ) = impl.setColorFilter(color) /** * Hides the menu button. diff --git a/mobile/android/android-components/components/compose/base/src/main/java/mozilla/components/compose/base/text/Text.kt b/mobile/android/android-components/components/compose/base/src/main/java/mozilla/components/compose/base/text/Text.kt @@ -29,7 +29,9 @@ sealed interface Text { * * @property value The [Int] resource value. */ - data class Resource(@param:StringRes val value: Int) : Text + data class Resource( + @param:StringRes val value: Int, + ) : Text } /** diff --git a/mobile/android/android-components/components/compose/base/src/main/java/mozilla/components/compose/base/utils/Utils.kt b/mobile/android/android-components/components/compose/base/src/main/java/mozilla/components/compose/base/utils/Utils.kt @@ -26,7 +26,9 @@ val inComposePreview: Boolean * @param attrId The attribute resource ID (e.g. R.attr.image) */ @Composable -fun getResolvedAttrResId(@AttrRes attrId: Int): Int { +fun getResolvedAttrResId( + @AttrRes attrId: Int, +): Int { val typedArray = LocalContext.current.obtainStyledAttributes(intArrayOf(attrId)) val newResId = typedArray.getResourceId(0, 0) typedArray.recycle() diff --git a/mobile/android/android-components/components/compose/browser-toolbar/src/main/java/mozilla/components/compose/browser/toolbar/concept/Action.kt b/mobile/android/android-components/components/compose/browser-toolbar/src/main/java/mozilla/components/compose/browser/toolbar/concept/Action.kt @@ -102,7 +102,9 @@ sealed class Action { * The [DrawableRes] as icon for this button. */ @JvmInline - value class DrawableResIcon(@param:DrawableRes val resourceId: Int) : Icon + value class DrawableResIcon( + @param:DrawableRes val resourceId: Int, + ) : Icon } /** @@ -119,7 +121,9 @@ sealed class Action { * The [StringRes] to display as text in this button. */ @JvmInline - value class StringResText(@param:StringRes val resourceId: Int) : Text + value class StringResText( + @param:StringRes val resourceId: Int, + ) : Text } /** @@ -136,7 +140,9 @@ sealed class Action { * The [StringRes] to use as content description of this button. */ @JvmInline - value class StringResContentDescription(@param:StringRes val resourceId: Int) : ContentDescription + value class StringResContentDescription( + @param:StringRes val resourceId: Int, + ) : ContentDescription } } diff --git a/mobile/android/android-components/components/compose/browser-toolbar/src/main/java/mozilla/components/compose/browser/toolbar/store/BrowserToolbarAction.kt b/mobile/android/android-components/components/compose/browser-toolbar/src/main/java/mozilla/components/compose/browser/toolbar/store/BrowserToolbarAction.kt @@ -160,5 +160,7 @@ sealed class BrowserEditToolbarAction : BrowserToolbarAction { /** * Update the placeholder hint resource ID in edit mode. */ - data class HintUpdated(@param:StringRes val hint: Int) : BrowserEditToolbarAction() + data class HintUpdated( + @param:StringRes val hint: Int, + ) : BrowserEditToolbarAction() } diff --git a/mobile/android/android-components/components/compose/browser-toolbar/src/main/java/mozilla/components/compose/browser/toolbar/store/BrowserToolbarInteraction.kt b/mobile/android/android-components/components/compose/browser-toolbar/src/main/java/mozilla/components/compose/browser/toolbar/store/BrowserToolbarInteraction.kt @@ -117,7 +117,9 @@ sealed class BrowserToolbarMenuItem { * The [DrawableRes] as icon for this menu item. */ @JvmInline - value class DrawableResIcon(@param:DrawableRes val resourceId: Int) : Icon + value class DrawableResIcon( + @param:DrawableRes val resourceId: Int, + ) : Icon } /** @@ -134,7 +136,9 @@ sealed class BrowserToolbarMenuItem { * The [StringRes] to display as text in this menu item. */ @JvmInline - value class StringResText(@param:StringRes val resourceId: Int) : Text + value class StringResText( + @param:StringRes val resourceId: Int, + ) : Text } /** @@ -151,7 +155,9 @@ sealed class BrowserToolbarMenuItem { * The [StringRes] to use as content description of this menu item. */ @JvmInline - value class StringResContentDescription(@param:StringRes val resourceId: Int) : ContentDescription + value class StringResContentDescription( + @param:StringRes val resourceId: Int, + ) : ContentDescription } } diff --git a/mobile/android/android-components/components/concept/engine/src/main/java/mozilla/components/concept/engine/preferences/BrowserPreferencesRuntime.kt b/mobile/android/android-components/components/concept/engine/src/main/java/mozilla/components/concept/engine/preferences/BrowserPreferencesRuntime.kt @@ -46,7 +46,8 @@ interface BrowserPreferencesRuntime { * Method for removing a specific browser preference for observation on the observer delegate. */ fun unregisterPrefForObservation( - pref: String, onSuccess: () -> Unit, + pref: String, + onSuccess: () -> Unit, onError: (Throwable) -> Unit, ) = onError(UnsupportedOperationException(UNSUPPORTED_ERROR)) diff --git a/mobile/android/android-components/components/concept/menu/src/main/java/mozilla/components/concept/menu/MenuButton.kt b/mobile/android/android-components/components/concept/menu/src/main/java/mozilla/components/concept/menu/MenuButton.kt @@ -28,7 +28,9 @@ interface MenuButton : Observable<MenuButton.Observer> { /** * Sets the tint of the 3-dot menu icon. */ - fun setColorFilter(@ColorInt color: Int) + fun setColorFilter( + @ColorInt color: Int, + ) /** * Observer for the menu button. diff --git a/mobile/android/android-components/components/concept/toolbar/src/main/java/mozilla/components/concept/toolbar/Toolbar.kt b/mobile/android/android-components/components/concept/toolbar/src/main/java/mozilla/components/concept/toolbar/Toolbar.kt @@ -556,10 +556,14 @@ interface Toolbar : ScrollableToolbar { * * This simple class extension is used so that we can filter for it elsewhere. */ - class RegistrableDomainColorSpan(@ColorInt color: Int) : ForegroundColorSpan(color) + class RegistrableDomainColorSpan( + @ColorInt color: Int, + ) : ForegroundColorSpan(color) } -private fun AppCompatImageButton.setTintResource(@ColorRes tintColorResource: Int) { +private fun AppCompatImageButton.setTintResource( + @ColorRes tintColorResource: Int, +) { if (tintColorResource != NO_ID) { imageTintList = AppCompatResources.getColorStateList(context, tintColorResource) } diff --git a/mobile/android/android-components/components/feature/addons/src/main/java/mozilla/components/feature/addons/ui/AddonPermissionsAdapter.kt b/mobile/android/android-components/components/feature/addons/src/main/java/mozilla/components/feature/addons/ui/AddonPermissionsAdapter.kt @@ -62,7 +62,9 @@ class AddonPermissionsAdapter( /** * Allows to customize how permission items should look like. */ - data class Style(@param:ColorRes val itemsTextColor: Int? = null) { + data class Style( + @param:ColorRes val itemsTextColor: Int? = null, + ) { internal fun maybeSetItemTextColor(textView: TextView) { itemsTextColor?.let { val color = ContextCompat.getColor(textView.context, it) diff --git a/mobile/android/android-components/components/feature/addons/src/main/java/mozilla/components/feature/addons/ui/AddonsManagerAdapter.kt b/mobile/android/android-components/components/feature/addons/src/main/java/mozilla/components/feature/addons/ui/AddonsManagerAdapter.kt @@ -409,10 +409,15 @@ class AddonsManagerAdapter( } @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) - internal data class Section(@param:StringRes val title: Int, val visibleDivider: Boolean = true) + internal data class Section( + @param:StringRes val title: Int, + val visibleDivider: Boolean = true, + ) @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) - internal data class NotYetSupportedSection(@param:StringRes val title: Int) + internal data class NotYetSupportedSection( + @param:StringRes val title: Int, + ) @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) internal object FooterSection diff --git a/mobile/android/android-components/components/feature/customtabs/src/main/java/mozilla/components/feature/customtabs/CustomTabConfigHelper.kt b/mobile/android/android-components/components/feature/customtabs/src/main/java/mozilla/components/feature/customtabs/CustomTabConfigHelper.kt @@ -279,7 +279,10 @@ private fun getDarkColorSchemeParams(safeIntent: SafeIntent) = * * @see [CustomTabsIntent.Builder.setColorSchemeParams]. */ -private fun getColorSchemeParams(safeIntent: SafeIntent, @ColorScheme colorScheme: Int): ColorSchemeParams? { +private fun getColorSchemeParams( + safeIntent: SafeIntent, + @ColorScheme colorScheme: Int, +): ColorSchemeParams? { val bundle = safeIntent.getColorSchemeParamsBundle()?.get(colorScheme) val toolbarColor = bundle?.getNullableSafeValue(EXTRA_TOOLBAR_COLOR) diff --git a/mobile/android/android-components/components/feature/customtabs/src/main/java/mozilla/components/feature/customtabs/CustomTabsToolbarFeature.kt b/mobile/android/android-components/components/feature/customtabs/src/main/java/mozilla/components/feature/customtabs/CustomTabsToolbarFeature.kt @@ -232,7 +232,10 @@ class CustomTabsToolbarFeature( * When clicked, it calls [closeListener]. */ @VisibleForTesting - internal fun addCloseButton(@ColorInt readableColor: Int, bitmap: Bitmap?) { + internal fun addCloseButton( + @ColorInt readableColor: Int, + bitmap: Bitmap?, + ) { val drawableIcon = bitmap?.toDrawable(context.resources) ?: getDrawable(context, iconsR.drawable.mozac_ic_cross_24)!!.mutate() @@ -294,7 +297,9 @@ class CustomTabsToolbarFeature( * When clicked, it activates [CustomTabsToolbarListeners.refreshListener]. */ @VisibleForTesting - internal fun addRefreshButton(@ColorInt readableColor: Int) { + internal fun addRefreshButton( + @ColorInt readableColor: Int, + ) { val drawableIcon = getDrawable(context, iconsR.drawable.mozac_ic_arrow_clockwise_24) drawableIcon?.setTint(readableColor) @@ -315,7 +320,9 @@ class CustomTabsToolbarFeature( * and defaults to the [share] KTX helper. */ @VisibleForTesting - internal fun addShareButton(@ColorInt readableColor: Int) { + internal fun addShareButton( + @ColorInt readableColor: Int, + ) { val drawableIcon = getDrawable(context, iconsR.drawable.mozac_ic_share_android_24)!! drawableIcon.setTint(readableColor) diff --git a/mobile/android/android-components/components/feature/customtabs/src/main/java/mozilla/components/feature/customtabs/feature/OriginVerifierFeature.kt b/mobile/android/android-components/components/feature/customtabs/src/main/java/mozilla/components/feature/customtabs/feature/OriginVerifierFeature.kt @@ -52,7 +52,10 @@ class OriginVerifierFeature( } @VisibleForTesting - internal fun getVerifier(packageName: String, @Relation relation: Int): OriginVerifier { + internal fun getVerifier( + packageName: String, + @Relation relation: Int, + ): OriginVerifier { cachedVerifier?.let { val (cachedPackage, cachedRelation, verifier) = it if (cachedPackage == packageName && cachedRelation == relation) { diff --git a/mobile/android/android-components/components/feature/downloads/src/main/java/mozilla/components/feature/downloads/ui/DownloadCancelDialogFragment.kt b/mobile/android/android-components/components/feature/downloads/src/main/java/mozilla/components/feature/downloads/ui/DownloadCancelDialogFragment.kt @@ -145,7 +145,10 @@ class DownloadCancelDialogFragment : AppCompatDialogFragment() { } @VisibleForTesting - internal fun buildWarningText(downloadCount: Int, @StringRes stringId: Int) = String.format( + internal fun buildWarningText( + downloadCount: Int, + @StringRes stringId: Int, + ) = String.format( getString(stringId), downloadCount, ) diff --git a/mobile/android/android-components/components/feature/prompts/src/main/java/mozilla/components/feature/prompts/PromptContainer.kt b/mobile/android/android-components/components/feature/prompts/src/main/java/mozilla/components/feature/prompts/PromptContainer.kt @@ -27,7 +27,10 @@ internal sealed class PromptContainer { /** * Returns a localized string. */ - abstract fun getString(@StringRes res: Int, vararg objects: Any): String + abstract fun getString( + @StringRes res: Int, + vararg objects: Any, + ): String internal class Activity( private val activity: android.app.Activity, diff --git a/mobile/android/android-components/components/feature/prompts/src/main/java/mozilla/components/feature/prompts/widget/LoginPanelTextInputLayout.kt b/mobile/android/android-components/components/feature/prompts/src/main/java/mozilla/components/feature/prompts/widget/LoginPanelTextInputLayout.kt @@ -46,7 +46,9 @@ internal class LoginPanelTextInputLayout( } } - private fun TypedArray.getColorOrNull(@StyleableRes styleableRes: Int): Int? { + private fun TypedArray.getColorOrNull( + @StyleableRes styleableRes: Int, + ): Int? { val resourceId = this.getResourceId(styleableRes, 0) return if (resourceId > 0) ContextCompat.getColor(context, resourceId) else null } diff --git a/mobile/android/android-components/components/feature/qr/src/main/java/mozilla/components/feature/qr/views/CustomViewFinder.kt b/mobile/android/android-components/components/feature/qr/src/main/java/mozilla/components/feature/qr/views/CustomViewFinder.kt @@ -188,7 +188,9 @@ class CustomViewFinder @JvmOverloads constructor( * Creates a Static Layout used to show a message below the viewfinder */ @Suppress("Deprecation") - private fun showMessage(@StringRes scanMessageId: Int?) { + private fun showMessage( + @StringRes scanMessageId: Int?, + ) { val scanMessage = if (scanMessageId != null) { HtmlCompat.fromHtml( context.getString(scanMessageId), @@ -227,7 +229,9 @@ class CustomViewFinder @JvmOverloads constructor( } /** Sets the color for the Overlay. */ - private fun setOverlayColor(@ColorInt color: Int) { + private fun setOverlayColor( + @ColorInt color: Int, + ) { overlayPaint.color = color if (isLaidOut) { invalidate() @@ -235,7 +239,9 @@ class CustomViewFinder @JvmOverloads constructor( } /** Sets the stroke color for the ViewFinder. */ - fun setViewFinderColor(@ColorInt color: Int) { + fun setViewFinderColor( + @ColorInt color: Int, + ) { viewFinderPaint.color = color if (isLaidOut) { invalidate() @@ -243,7 +249,9 @@ class CustomViewFinder @JvmOverloads constructor( } /** Sets the stroke width for the ViewFinder. */ - private fun setViewFinderStroke(@Px stroke: Float) { + private fun setViewFinderStroke( + @Px stroke: Float, + ) { viewFinderPaint.strokeWidth = stroke if (isLaidOut) { invalidate() @@ -251,7 +259,9 @@ class CustomViewFinder @JvmOverloads constructor( } /** Sets the corner size for the ViewFinder. */ - private fun setViewFinderCornerSize(@Px size: Float) { + private fun setViewFinderCornerSize( + @Px size: Float, + ) { viewFinderCornersSize = size if (isLaidOut) { invalidate() @@ -259,7 +269,9 @@ class CustomViewFinder @JvmOverloads constructor( } /** Sets the corner radius for the ViewFinder. */ - private fun setViewFinderCornerRadius(@Px radius: Float) { + private fun setViewFinderCornerRadius( + @Px radius: Float, + ) { viewFinderCornersRadius = radius if (isLaidOut) { invalidate() diff --git a/mobile/android/android-components/components/feature/readerview/src/main/java/mozilla/components/feature/readerview/view/ReaderViewControlsBar.kt b/mobile/android/android-components/components/feature/readerview/src/main/java/mozilla/components/feature/readerview/view/ReaderViewControlsBar.kt @@ -159,13 +159,19 @@ class ReaderViewControlsBar @JvmOverloads constructor( } } - private inline fun applyClickListener(@IdRes id: Int, crossinline block: () -> Unit): AppCompatButton { + private inline fun applyClickListener( + @IdRes id: Int, + crossinline block: () -> Unit, + ): AppCompatButton { return findViewById<AppCompatButton>(id).apply { setOnClickListener { block() } } } - private inline fun applyCheckedListener(@IdRes id: Int, crossinline block: (Int) -> Unit): RadioGroup { + private inline fun applyCheckedListener( + @IdRes id: Int, + crossinline block: (Int) -> Unit, + ): RadioGroup { return findViewById<RadioGroup>(id).apply { setOnCheckedChangeListener { _, checkedId -> block(checkedId) } } diff --git a/mobile/android/android-components/components/feature/search/src/main/java/mozilla/components/feature/search/widget/AppSearchWidgetProvider.kt b/mobile/android/android-components/components/feature/search/src/main/java/mozilla/components/feature/search/widget/AppSearchWidgetProvider.kt @@ -239,7 +239,9 @@ abstract class AppSearchWidgetProvider : AppWidgetProvider() { } @VisibleForTesting - internal fun getLayoutSize(@Dimension(unit = DP) dp: Int) = when { + internal fun getLayoutSize( + @Dimension(unit = DP) dp: Int, + ) = when { dp >= DP_LARGE -> SearchWidgetProviderSize.LARGE dp >= DP_MEDIUM -> SearchWidgetProviderSize.MEDIUM dp >= DP_SMALL -> SearchWidgetProviderSize.SMALL diff --git a/mobile/android/android-components/components/lib/jexl/src/main/java/mozilla/components/lib/jexl/parser/StateMachine.kt b/mobile/android/android-components/components/lib/jexl/src/main/java/mozilla/components/lib/jexl/parser/StateMachine.kt @@ -197,7 +197,10 @@ internal val stateMachine: Map<State, StateMap> = mapOf( ), ) -private fun objectStart(parser: Parser, @Suppress("UNUSED_PARAMETER") token: Token) { +private fun objectStart( + parser: Parser, + @Suppress("UNUSED_PARAMETER") token: Token, +) { val node = ObjectLiteral( properties = mutableMapOf(), ) @@ -208,7 +211,10 @@ private fun objectKey(parser: Parser, token: Token) { parser.currentObjectKey = token.value.toString() } -private fun arrayStart(parser: Parser, @Suppress("UNUSED_PARAMETER") token: Token) { +private fun arrayStart( + parser: Parser, + @Suppress("UNUSED_PARAMETER") token: Token, +) { val node = ArrayLiteral() parser.placeAtCursor(node) } @@ -221,7 +227,10 @@ private fun transform(parser: Parser, token: Token) { parser.placeBeforeCursor(node) } -private fun ternaryStart(parser: Parser, @Suppress("UNUSED_PARAMETER") token: Token) { +private fun ternaryStart( + parser: Parser, + @Suppress("UNUSED_PARAMETER") token: Token, +) { val node = ConditionalExpression( test = parser.tree, ) diff --git a/mobile/android/android-components/components/support/ktx/src/main/java/mozilla/components/support/ktx/android/content/Context.kt b/mobile/android/android-components/components/support/ktx/src/main/java/mozilla/components/support/ktx/android/content/Context.kt @@ -373,7 +373,9 @@ inline fun Context.runOnlyInMainProcess(block: () -> Unit) { * Returns the color int corresponding to the attribute. */ @ColorInt -fun Context.getColorFromAttr(@AttrRes attr: Int) = +fun Context.getColorFromAttr( + @AttrRes attr: Int, +) = ContextCompat.getColor(this, theme.resolveAttribute(attr)) /** @@ -393,7 +395,10 @@ fun Context.getStatusBarColor() = * @param resId ID of the drawable to load. * @param tint Tint color int to apply to the drawable. */ -fun Context.getDrawableWithTint(@DrawableRes resId: Int, @ColorInt tint: Int) = +fun Context.getDrawableWithTint( + @DrawableRes resId: Int, + @ColorInt tint: Int, +) = AppCompatResources.getDrawable(this, resId)?.apply { mutate() setTint(tint) diff --git a/mobile/android/android-components/components/support/ktx/src/main/java/mozilla/components/support/ktx/android/content/res/Theme.kt b/mobile/android/android-components/components/support/ktx/src/main/java/mozilla/components/support/ktx/android/content/res/Theme.kt @@ -16,7 +16,9 @@ import androidx.annotation.AttrRes * context.theme.resolveAttribute(R.attr.textColor) == R.color.light_text_color */ @AnyRes -fun Resources.Theme.resolveAttribute(@AttrRes attribute: Int): Int { +fun Resources.Theme.resolveAttribute( + @AttrRes attribute: Int, +): Int { val outValue = TypedValue() resolveAttribute(attribute, outValue, true) return outValue.resourceId diff --git a/mobile/android/android-components/components/support/ktx/src/main/java/mozilla/components/support/ktx/android/notification/Notification.kt b/mobile/android/android-components/components/support/ktx/src/main/java/mozilla/components/support/ktx/android/notification/Notification.kt @@ -43,4 +43,8 @@ fun ensureNotificationChannelExists( /** * Wraps the data of a NotificationChannel as this class is available after API 26. */ -class ChannelData(val id: String, @param:StringRes val name: Int, val importance: Int) +class ChannelData( + val id: String, + @param:StringRes val name: Int, + val importance: Int, +) diff --git a/mobile/android/android-components/components/support/ktx/src/main/java/mozilla/components/support/ktx/android/view/Window.kt b/mobile/android/android-components/components/support/ktx/src/main/java/mozilla/components/support/ktx/android/view/Window.kt @@ -35,7 +35,9 @@ import mozilla.components.support.utils.ext.top * Sets the status bar background color. If the color is light enough, a light navigation bar with * dark icons will be used. */ -fun Window.setStatusBarTheme(@ColorInt color: Int) { +fun Window.setStatusBarTheme( + @ColorInt color: Int, +) { createWindowInsetsController().isAppearanceLightStatusBars = !isDark(color) setStatusBarColorCompat(color) } @@ -68,7 +70,9 @@ fun Window.createWindowInsetsController(): WindowInsetsControllerCompat { * @param color The color to set as the status bar color. * Note that if edge-to-edge behavior is enabled, the color will be transparent and cannot be changed. */ -fun Window.setStatusBarColorCompat(@ColorInt color: Int) { +fun Window.setStatusBarColorCompat( + @ColorInt color: Int, +) { if (context.isEdgeToEdgeDisabled()) { @Suppress("DEPRECATION") statusBarColor = color @@ -83,7 +87,9 @@ fun Window.setStatusBarColorCompat(@ColorInt color: Int) { * @param color The color to set as the navigation bar color. * Note that if edge-to-edge behavior is enabled, the color will be transparent and cannot be changed. */ -fun Window.setNavigationBarColorCompat(@ColorInt color: Int) { +fun Window.setNavigationBarColorCompat( + @ColorInt color: Int, +) { if (context.isEdgeToEdgeDisabled()) { @Suppress("DEPRECATION") navigationBarColor = color @@ -98,7 +104,9 @@ fun Window.setNavigationBarColorCompat(@ColorInt color: Int) { * @param color The color to set as the navigation bar divider color. * Note that if edge-to-edge behavior is enabled, the color will be transparent and cannot be changed. */ -fun Window.setNavigationBarDividerColorCompat(@ColorInt color: Int?) { +fun Window.setNavigationBarDividerColorCompat( + @ColorInt color: Int?, +) { if (SDK_INT >= VERSION_CODES.P && context.isEdgeToEdgeDisabled()) { @Suppress("DEPRECATION") navigationBarDividerColor = color ?: 0 diff --git a/mobile/android/android-components/components/support/utils/src/main/java/mozilla/components/support/utils/ColorUtils.kt b/mobile/android/android-components/components/support/utils/src/main/java/mozilla/components/support/utils/ColorUtils.kt @@ -25,7 +25,9 @@ object ColorUtils { * Get text color (white or black) that is readable on top of the provided background color. */ @JvmStatic - @ColorInt fun getReadableTextColor(@ColorInt backgroundColor: Int): Int { + @ColorInt fun getReadableTextColor( + @ColorInt backgroundColor: Int, + ): Int { return if (isDark(backgroundColor)) Color.WHITE else Color.BLACK } @@ -33,7 +35,9 @@ object ColorUtils { * Get secondary color (light or dark) that is readable on top of the provided background color. */ @JvmStatic - @ColorInt fun getSecondaryReadableTextColor(@ColorInt backgroundColor: Int): Int { + @ColorInt fun getSecondaryReadableTextColor( + @ColorInt backgroundColor: Int, + ): Int { val primaryTextColor = getReadableTextColor(backgroundColor) return ColorUtils.blendARGB(primaryTextColor, backgroundColor, SECONDARY_COLOR_BACKGROUND_BLEND_RATIO) } @@ -42,7 +46,9 @@ object ColorUtils { * Get disabled text color (light gray or dark gray) that is readable on top of the provided background color. */ @JvmStatic - @ColorInt fun getDisabledReadableTextColor(@ColorInt backgroundColor: Int): Int { + @ColorInt fun getDisabledReadableTextColor( + @ColorInt backgroundColor: Int, + ): Int { return if (isDark(backgroundColor)) { LIGHT_GRAY_HEX.toColorInt() } else { @@ -55,7 +61,9 @@ object ColorUtils { */ @JvmStatic @SuppressWarnings("MagicNumber") - fun isDark(@ColorInt color: Int): Boolean { + fun isDark( + @ColorInt color: Int, + ): Boolean { if (color == Color.TRANSPARENT || ColorUtils.calculateLuminance(color) >= 0.5) { return false } @@ -66,7 +74,9 @@ object ColorUtils { } @SuppressWarnings("MagicNumber") - @ColorInt private fun grayscaleFromRGB(@ColorInt color: Int): Int { + @ColorInt private fun grayscaleFromRGB( + @ColorInt color: Int, + ): Int { val red = Color.red(color) val green = Color.green(color) val blue = Color.blue(color) @@ -93,7 +103,9 @@ object ColorUtils { * @param factor How much lighter the new color should be. * A higher value will produce a lighter color. */ - fun ComposeColor.lighten(@FloatRange(from = 0.0, to = 1.0) factor: Float) = + fun ComposeColor.lighten( + @FloatRange(from = 0.0, to = 1.0) factor: Float, + ) = lerp(this, ComposeColor.White, factor) /** @@ -102,6 +114,8 @@ object ColorUtils { * @param factor How much darken the new color should be. * A higher value will produce a darker color. */ - fun ComposeColor.darken(@FloatRange(from = 0.0, to = 1.0) factor: Float) = + fun ComposeColor.darken( + @FloatRange(from = 0.0, to = 1.0) factor: Float, + ) = lerp(this, ComposeColor.Black, factor) } diff --git a/mobile/android/android-components/components/ui/widgets/src/main/java/mozilla/components/ui/widgets/behavior/EngineViewScrollingDataBehavior.kt b/mobile/android/android-components/components/ui/widgets/src/main/java/mozilla/components/ui/widgets/behavior/EngineViewScrollingDataBehavior.kt @@ -54,7 +54,10 @@ class EngineViewScrollingDataBehavior( } override fun onStopNestedScroll( - coordinatorLayout: CoordinatorLayout, child: View, target: View, type: Int, + coordinatorLayout: CoordinatorLayout, + child: View, + target: View, + type: Int, ) { scrollUpdatesJob?.cancel() diff --git a/mobile/android/android-components/samples/browser/src/main/java/org/mozilla/samples/browser/addons/InstalledAddonDetailsActivity.kt b/mobile/android/android-components/samples/browser/src/main/java/org/mozilla/samples/browser/addons/InstalledAddonDetailsActivity.kt @@ -182,7 +182,10 @@ class InstalledAddonDetailsActivity : AppCompatActivity() { } } - private fun showAddonToast(@StringRes textId: Int, addon: Addon) { + private fun showAddonToast( + @StringRes textId: Int, + addon: Addon, + ) { Toast.makeText( this, getString(textId, addon.translateName(context = this)), diff --git a/mobile/android/android-components/samples/toolbar/src/main/java/org/mozilla/samples/toolbar/ToolbarActivity.kt b/mobile/android/android-components/samples/toolbar/src/main/java/org/mozilla/samples/toolbar/ToolbarActivity.kt @@ -641,7 +641,9 @@ class ToolbarActivity : AppCompatActivity() { binding.toolbar.invalidateActions() } - private fun Resources.getThemedDrawable(@DrawableRes resId: Int) = ResourcesCompat.getDrawable(this, resId, theme) + private fun Resources.getThemedDrawable( + @DrawableRes resId: Int, + ) = ResourcesCompat.getDrawable(this, resId, theme) companion object { private val PROGRESS_RANGE = 0..100 diff --git a/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SearchRobot.kt b/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SearchRobot.kt @@ -378,7 +378,8 @@ class SearchRobot { } fun verifySearchBarPlaceholderWithComposableToolbar( - composeTestRule: ComposeTestRule, searchHint: String, + composeTestRule: ComposeTestRule, + searchHint: String, ) { Log.i(TAG, "verifySearchBarPlaceholderWithComposableToolbar: Verify hint is $searchHint") composeTestRule @@ -559,7 +560,9 @@ class SearchRobot { ) fun verifyTypedToolbarTextWithComposableToolbar( - composeTestRule: ComposeTestRule, expectedText: String, exists: Boolean, + composeTestRule: ComposeTestRule, + expectedText: String, + exists: Boolean, ) { Log.i(TAG, "verifyTypedToolbarTextWithComposableToolbar: Verifying that text '$expectedText' exists?: $exists") @@ -658,7 +661,8 @@ class SearchRobot { fun submitQueryWithComposableToolbar( composeTestRule: ComposeTestRule, - query: String, interact: BrowserRobot.() -> Unit, + query: String, + interact: BrowserRobot.() -> Unit, ): BrowserRobot.Transition { Log.i(TAG, "submitQueryWithComposableToolbar: Trying to set toolbar text to: $query and pressing IME action") diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/BrowserDirection.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/BrowserDirection.kt @@ -13,7 +13,9 @@ import androidx.annotation.IdRes * @property fragmentId ID of the fragment opening the browser in the navigation graph. * An ID of `0` indicates a global action with no corresponding opening fragment. */ -enum class BrowserDirection(@param:IdRes val fragmentId: Int) { +enum class BrowserDirection( + @param:IdRes val fragmentId: Int, +) { FromGlobal(0), FromHome(R.id.homeFragment), FromWallpaper(R.id.wallpaperSettingsFragment), diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/SecureFragment.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/SecureFragment.kt @@ -16,7 +16,9 @@ import org.mozilla.fenix.ext.secure * * Fragments displaying such screens should extend [SecureFragment] instead of [Fragment] class. */ -open class SecureFragment(@LayoutRes contentLayoutId: Int) : Fragment(contentLayoutId) { +open class SecureFragment( + @LayoutRes contentLayoutId: Int, +) : Fragment(contentLayoutId) { constructor() : this(0) { Fragment() diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/appstate/setup/checklist/ChecklistItem.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/appstate/setup/checklist/ChecklistItem.kt @@ -16,7 +16,9 @@ import mozilla.components.ui.icons.R as iconsR * * @property title the string resource for the checklist item title. */ -sealed class ChecklistItem(@param:StringRes open val title: Int) { +sealed class ChecklistItem( + @param:StringRes open val title: Int, +) { /** * A data class representing an individual task in the checklist. * diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/debugsettings/navigation/DebugDrawerRoute.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/debugsettings/navigation/DebugDrawerRoute.kt @@ -35,7 +35,10 @@ import org.mozilla.fenix.debugsettings.tabs.TabTools as TabToolsScreen * optional parameters for arguments or deep linking. * @property title The string ID of the destination's title. */ -enum class DebugDrawerRoute(val route: String, @param:StringRes val title: Int) { +enum class DebugDrawerRoute( + val route: String, + @param:StringRes val title: Int, +) { /** * The navigation route for [TabToolsScreen]. */ diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/ext/Context.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/ext/Context.kt @@ -50,7 +50,9 @@ val Context.metrics: MetricController fun Context.asActivity() = (this as? ContextThemeWrapper)?.baseContext as? Activity ?: this as? Activity -fun Context.getPreferenceKey(@StringRes resourceId: Int): String = +fun Context.getPreferenceKey( + @StringRes resourceId: Int, +): String = resources.getString(resourceId) /** @@ -69,7 +71,10 @@ fun Context.settings() = components.settings * * @return the formatted string in locale language or English as a fallback */ -fun Context.getStringWithArgSafe(@StringRes resId: Int, formatArg: String): String { +fun Context.getStringWithArgSafe( + @StringRes resId: Int, + formatArg: String, +): String { return try { format(getString(resId), formatArg) } catch (e: IllegalArgumentException) { @@ -214,4 +219,6 @@ fun Context.isToolbarAtBottom() = * @param resId Resource ID of the dimension. * @return The pixel size corresponding to the given dimension resource. */ -fun Context.pixelSizeFor(@DimenRes resId: Int) = resources.getDimensionPixelSize(resId) +fun Context.pixelSizeFor( + @DimenRes resId: Int, +) = resources.getDimensionPixelSize(resId) diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/ext/Fragment.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/ext/Fragment.kt @@ -66,7 +66,9 @@ fun Fragment.nav( navController.nav(id, directions, options) } -fun Fragment.getPreferenceKey(@StringRes resourceId: Int): String = getString(resourceId) +fun Fragment.getPreferenceKey( + @StringRes resourceId: Int, +): String = getString(resourceId) /** * Displays the activity toolbar with the given [title]. @@ -348,4 +350,6 @@ fun Fragment.updateMicrosurveyPromptForConfigurationChange( * @param resId Resource ID of the dimension. * @return The pixel size corresponding to the given dimension resource. */ -fun Fragment.pixelSizeFor(@DimenRes resId: Int) = resources.getDimensionPixelSize(resId) +fun Fragment.pixelSizeFor( + @DimenRes resId: Int, +) = resources.getDimensionPixelSize(resId) diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/ext/NavController.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/ext/NavController.kt @@ -18,7 +18,11 @@ import org.mozilla.fenix.R * Navigate from the fragment with [id] using the given [directions]. * If the id doesn't match the current destination, an error is recorded. */ -fun NavController.nav(@IdRes id: Int?, directions: NavDirections, navOptions: NavOptions? = null) { +fun NavController.nav( + @IdRes id: Int?, + directions: NavDirections, + navOptions: NavOptions? = null, +) { if (id == null || this.currentDestination?.id == id) { this.navigate(directions, navOptions) } else { @@ -26,7 +30,9 @@ fun NavController.nav(@IdRes id: Int?, directions: NavDirections, navOptions: Na } } -fun NavController.alreadyOnDestination(@IdRes destId: Int?): Boolean { +fun NavController.alreadyOnDestination( + @IdRes destId: Int?, +): Boolean { return destId?.let { currentDestination?.id == it || popBackStack(it, false) } ?: false } diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/ext/SpannableString.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/ext/SpannableString.kt @@ -15,7 +15,10 @@ import androidx.annotation.Dimension.Companion.DP import mozilla.components.support.ktx.android.content.getColorFromAttr import mozilla.components.support.ktx.android.util.dpToPx -fun SpannableString.setTextSize(context: Context, @Dimension(unit = DP) textSize: Int) = +fun SpannableString.setTextSize( + context: Context, + @Dimension(unit = DP) textSize: Int, +) = this.setSpan( AbsoluteSizeSpan(textSize.dpToPx(context.resources.displayMetrics)), 0, @@ -23,7 +26,10 @@ fun SpannableString.setTextSize(context: Context, @Dimension(unit = DP) textSize Spannable.SPAN_EXCLUSIVE_EXCLUSIVE, ) -fun SpannableString.setTextColor(context: Context, @AttrRes colorResId: Int) = +fun SpannableString.setTextColor( + context: Context, + @AttrRes colorResId: Int, +) = this.setSpan( ForegroundColorSpan(context.getColorFromAttr(colorResId)), 0, diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/ext/Toolbar.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/ext/Toolbar.kt @@ -17,7 +17,10 @@ import androidx.core.view.forEach /** * Adjust the colors of the [Toolbar] on the top of the screen. */ -fun Toolbar.setToolbarColors(@ColorInt foreground: Int, @ColorInt background: Int) { +fun Toolbar.setToolbarColors( + @ColorInt foreground: Int, + @ColorInt background: Int, +) { apply { setBackgroundColor(background) setTitleTextColor(foreground) diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/ext/View.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/ext/View.kt @@ -23,7 +23,9 @@ import org.mozilla.fenix.components.Components */ fun View.settings() = context.components.settings -fun View.increaseTapArea(@Dimension(unit = DP) extraDps: Int) { +fun View.increaseTapArea( + @Dimension(unit = DP) extraDps: Int, +) { val extraPx = extraDps.dpToPx(resources.displayMetrics) increaseTapAreaInternal(extraPx) } @@ -44,7 +46,9 @@ internal fun View.increaseTapAreaInternal(extraPx: Int) { * * @param extraDps the extra dps that's wanted to be added on top and bottom of the view */ -fun View.increaseTapAreaVertically(@Dimension(unit = DP) extraDps: Int) { +fun View.increaseTapAreaVertically( + @Dimension(unit = DP) extraDps: Int, +) { val dips = extraDps.dpToPx(resources.displayMetrics) val parent = this.parent as View parent.post { @@ -144,4 +148,6 @@ internal fun getKeyboardHeight( * @param resId Resource ID of the dimension. * @return The pixel size corresponding to the given dimension resource. */ -fun View.pixelSizeFor(@DimenRes resId: Int) = resources.getDimensionPixelSize(resId) +fun View.pixelSizeFor( + @DimenRes resId: Int, +) = resources.getDimensionPixelSize(resId) diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt @@ -818,7 +818,11 @@ class HomeFragment : Fragment() { ) } - private fun updateToolbarViewUI(@DrawableRes id: Int, showDivider: Boolean, elevation: Float) { + private fun updateToolbarViewUI( + @DrawableRes id: Int, + showDivider: Boolean, + elevation: Float, + ) { (toolbarView as? HomeToolbarView)?.updateBackground(id) toolbarView.updateDividerVisibility(showDivider) toolbarView.layout.elevation = elevation diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/setup/store/SetupChecklistRepository.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/setup/store/SetupChecklistRepository.kt @@ -53,7 +53,9 @@ interface SetupChecklistRepository { * * @property preferenceKey The string resource key for the preference. */ -enum class SetupChecklistPreference(@param:StringRes val preferenceKey: Int) { +enum class SetupChecklistPreference( + @param:StringRes val preferenceKey: Int, +) { SetToDefault(R.string.pref_key_default_browser), SignIn(R.string.pref_key_fxa_signed_in), ThemeComplete(R.string.pref_key_setup_step_theme), diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/toolbar/HomeToolbarView.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/toolbar/HomeToolbarView.kt @@ -143,7 +143,9 @@ internal class HomeToolbarView( * * @param id The resource ID of the drawable to use as the background. */ - fun updateBackground(@DrawableRes id: Int) { + fun updateBackground( + @DrawableRes id: Int, + ) { toolbarBinding.toolbar.setBackgroundResource(id) } diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/topsites/TopSitesFavicon.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/topsites/TopSitesFavicon.kt @@ -25,7 +25,9 @@ sealed class TopSitesFavicon { * * @property drawableResId The drawable resource ID to use. */ - data class Drawable(@param:DrawableRes val drawableResId: Int) : TopSitesFavicon() + data class Drawable( + @param:DrawableRes val drawableResId: Int, + ) : TopSitesFavicon() } internal fun getTopSitesFavicon(topSite: TopSite): TopSitesFavicon { diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/iconpicker/AppIcon.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/iconpicker/AppIcon.kt @@ -181,12 +181,16 @@ sealed class IconBackground { * * @property colorResId The color resource ID to use. */ - data class Color(@param:ColorRes val colorResId: Int) : IconBackground() + data class Color( + @param:ColorRes val colorResId: Int, + ) : IconBackground() /** * A drawable background. * * @property drawableResId The drawable resource ID to use. */ - data class Drawable(@param:DrawableRes val drawableResId: Int) : IconBackground() + data class Drawable( + @param:DrawableRes val drawableResId: Int, + ) : IconBackground() } diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/iconpicker/IconGroupTitle.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/iconpicker/IconGroupTitle.kt @@ -11,4 +11,6 @@ import androidx.annotation.StringRes * * @property titleId A string resource describing the group title. */ -data class IconGroupTitle(@param:StringRes val titleId: Int) +data class IconGroupTitle( + @param:StringRes val titleId: Int, +) diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/onboarding/store/OnboardingPreferencesRepository.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/onboarding/store/OnboardingPreferencesRepository.kt @@ -27,7 +27,9 @@ interface OnboardingPreferencesRepository { /** * Enum for the onboarding preference keys. */ - enum class OnboardingPreference(@param:StringRes val preferenceKey: Int) { + enum class OnboardingPreference( + @param:StringRes val preferenceKey: Int, + ) { DeviceTheme(preferenceKey = R.string.pref_key_follow_device_theme), LightTheme(preferenceKey = R.string.pref_key_light_theme), DarkTheme(preferenceKey = R.string.pref_key_dark_theme), diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/perf/ProfilerViewModel.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/perf/ProfilerViewModel.kt @@ -52,7 +52,10 @@ sealed class ProfilerUiState { /** * A toast message should be displayed to the user. */ - data class ShowToast(@param:StringRes val messageResId: Int, val extra: String = "") : + data class ShowToast( + @param:StringRes val messageResId: Int, + val extra: String = "", + ) : ProfilerUiState() /** @@ -63,7 +66,10 @@ sealed class ProfilerUiState { /** * An error occurred during profiling. */ - data class Error(@param:StringRes val messageResId: Int, val errorDetails: String = "") : + data class Error( + @param:StringRes val messageResId: Int, + val errorDetails: String = "", + ) : ProfilerUiState() /** diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/search/awesomebar/SuggestionIconProvider.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/search/awesomebar/SuggestionIconProvider.kt @@ -94,7 +94,10 @@ interface SuggestionIconProvider { * @param tintWithPrimaryColor If true, the icon will be tinted with the primary text color. * @return A [Bitmap] of the icon, or null if it cannot be loaded/created. */ - fun getGenericIconBitmap(@DrawableRes drawableRes: Int, tintWithPrimaryColor: Boolean = false): Bitmap? + fun getGenericIconBitmap( + @DrawableRes drawableRes: Int, + tintWithPrimaryColor: Boolean = false, + ): Bitmap? /** * Provides a standard settings icon. @@ -166,7 +169,10 @@ class DefaultSuggestionIconProvider(private val context: Context) : SuggestionIc return AppCompatResources.getDrawable(context, R.drawable.ic_search_results_device_tablet) } - override fun getGenericIconBitmap(@DrawableRes drawableRes: Int, tintWithPrimaryColor: Boolean): Bitmap? { + override fun getGenericIconBitmap( + @DrawableRes drawableRes: Int, + tintWithPrimaryColor: Boolean, + ): Bitmap? { return AppCompatResources.getDrawable(context, drawableRes)?.apply { if (tintWithPrimaryColor) { colorFilter = createBlendModeColorFilterCompat( diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/Extensions.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/Extensions.kt @@ -87,5 +87,7 @@ inline fun <reified T> Preference.setOnPreferenceChangeListener( * Find a preference with the corresponding key and throw if it does not exist. * @param preferenceId Resource ID from preference_keys */ -fun <T : Preference> PreferenceFragmentCompat.requirePreference(@StringRes preferenceId: Int) = +fun <T : Preference> PreferenceFragmentCompat.requirePreference( + @StringRes preferenceId: Int, +) = requireNotNull(findPreference<T>(getPreferenceKey(preferenceId))) diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/ToolbarShortcutPreference.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/ToolbarShortcutPreference.kt @@ -150,7 +150,9 @@ internal abstract class ToolbarShortcutPreference @JvmOverloads constructor( return row } - private fun View.getMaterialColor(@AttrRes attr: Int): Int { + private fun View.getMaterialColor( + @AttrRes attr: Int, + ): Int { return MaterialColors.getColor(this, attr) } } diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/deletebrowsingdata/DeleteBrowsingDataOnQuitType.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/deletebrowsingdata/DeleteBrowsingDataOnQuitType.kt @@ -18,7 +18,9 @@ import org.mozilla.fenix.ext.getPreferenceKey * * @param prefKey The string resource ID for the preference key. */ -enum class DeleteBrowsingDataOnQuitType(@param:StringRes private val prefKey: Int) { +enum class DeleteBrowsingDataOnQuitType( + @param:StringRes private val prefKey: Int, +) { TABS(R.string.pref_key_delete_open_tabs_on_quit), HISTORY(R.string.pref_key_delete_browsing_history_on_quit), COOKIES(R.string.pref_key_delete_cookies_and_site_data_on_quit), diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/sitepermissions/SitePermissionsManageExceptionsPhoneFeatureFragment.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/sitepermissions/SitePermissionsManageExceptionsPhoneFeatureFragment.kt @@ -101,7 +101,10 @@ class SitePermissionsManageExceptionsPhoneFeatureFragment : Fragment() { } @VisibleForTesting - internal fun initAutoplayOption(@IdRes viewId: Int, value: AutoplayValue) { + internal fun initAutoplayOption( + @IdRes viewId: Int, + value: AutoplayValue, + ) { val radio = rootView.findViewById<RadioButton>(viewId) radio.isVisible = true radio.text = value.label diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/studies/StudiesAdapter.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/studies/StudiesAdapter.kt @@ -144,7 +144,10 @@ class StudiesAdapter( } @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) - internal data class Section(@param:StringRes val title: Int, val visibleDivider: Boolean = true) + internal data class Section( + @param:StringRes val title: Int, + val visibleDivider: Boolean = true, + ) /** * Removes the portion of the list that contains the provided [study]. diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/shopping/ui/ext/HeadingResource.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/shopping/ui/ext/HeadingResource.kt @@ -17,7 +17,9 @@ import org.mozilla.fenix.R */ @Composable @ReadOnlyComposable -fun headingResource(@StringRes id: Int): String { +fun headingResource( + @StringRes id: Int, +): String { return headingResource(text = stringResource(id = id)) } diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/webcompat/store/WebCompatReporterStore.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/webcompat/store/WebCompatReporterStore.kt @@ -39,7 +39,9 @@ data class WebCompatReporterState( * * @property displayStringId The string ID corresponding to the reason. */ - enum class BrokenSiteReason(@param:StringRes val displayStringId: Int) { + enum class BrokenSiteReason( + @param:StringRes val displayStringId: Int, + ) { Load( displayStringId = R.string.webcompat_reporter_reason_load, ), diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/gecko/search/SearchWidgetProvider.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/gecko/search/SearchWidgetProvider.kt @@ -209,7 +209,9 @@ class SearchWidgetProvider : AppWidgetProvider() { } @VisibleForTesting - internal fun getLayoutSize(@Dimension(unit = DP) dp: Int) = when { + internal fun getLayoutSize( + @Dimension(unit = DP) dp: Int, + ) = when { dp >= DP_LARGE -> SearchWidgetProviderSize.LARGE dp >= DP_MEDIUM -> SearchWidgetProviderSize.MEDIUM dp >= DP_SMALL -> SearchWidgetProviderSize.SMALL diff --git a/mobile/android/fenix/config/detekt-baseline.xml b/mobile/android/fenix/config/detekt-baseline.xml @@ -557,7 +557,7 @@ <ID>UndocumentedPublicFunction:CollectionCreationView.kt$CollectionCreationView$fun update(state: CollectionCreationState)</ID> <ID>UndocumentedPublicFunction:CollectionsListAdapter.kt$CollectionsListAdapter$fun getSelectedCollection()</ID> <ID>UndocumentedPublicFunction:Context.kt$fun Context.asActivity()</ID> - <ID>UndocumentedPublicFunction:Context.kt$fun Context.getPreferenceKey(@StringRes resourceId: Int): String</ID> + <ID>UndocumentedPublicFunction:Context.kt$fun Context.getPreferenceKey( @StringRes resourceId: Int, ): String</ID> <ID>UndocumentedPublicFunction:Context.kt$fun Context.settings()</ID> <ID>UndocumentedPublicFunction:CounterPreference.kt$CounterPreference$fun increment()</ID> <ID>UndocumentedPublicFunction:CounterPreference.kt$CounterPreference$fun underMaxCount()</ID> @@ -585,7 +585,7 @@ <ID>UndocumentedPublicFunction:FenixOnboarding.kt$FenixOnboarding$fun finish()</ID> <ID>UndocumentedPublicFunction:FenixOnboarding.kt$FenixOnboarding$fun userHasBeenOnboarded(): Boolean</ID> <ID>UndocumentedPublicFunction:Fragment.kt$fun Fragment.breadcrumb( message: String, data: Map<String, String> = emptyMap(), )</ID> - <ID>UndocumentedPublicFunction:Fragment.kt$fun Fragment.getPreferenceKey(@StringRes resourceId: Int): String</ID> + <ID>UndocumentedPublicFunction:Fragment.kt$fun Fragment.getPreferenceKey( @StringRes resourceId: Int, ): String</ID> <ID>UndocumentedPublicFunction:FxaServer.kt$FxaServer$fun config(context: Context): ServerConfig</ID> <ID>UndocumentedPublicFunction:GeckoProvider.kt$GeckoProvider$@Synchronized fun getOrCreateRuntime( context: Context, autofillStorage: Lazy<CreditCardsAddressesStorage>, loginStorage: Lazy<LoginsStorage>, trackingProtectionPolicy: TrackingProtectionPolicy, ): GeckoRuntime</ID> <ID>UndocumentedPublicFunction:GroupableRadioButton.kt$GroupableRadioButton$fun addToRadioGroup(radioButton: GroupableRadioButton)</ID> @@ -638,7 +638,7 @@ <ID>UndocumentedPublicFunction:MetricsService.kt$MetricsService$fun track(event: Event)</ID> <ID>UndocumentedPublicFunction:MozillaProductDetector.kt$MozillaProductDetector$fun getInstalledMozillaProducts(context: Context): List<String></ID> <ID>UndocumentedPublicFunction:MozillaProductDetector.kt$MozillaProductDetector$fun packageIsInstalled(context: Context, packageName: String): Boolean</ID> - <ID>UndocumentedPublicFunction:NavController.kt$fun NavController.alreadyOnDestination(@IdRes destId: Int?): Boolean</ID> + <ID>UndocumentedPublicFunction:NavController.kt$fun NavController.alreadyOnDestination( @IdRes destId: Int?, ): Boolean</ID> <ID>UndocumentedPublicFunction:NavController.kt$fun NavController.navigateSafe( @IdRes resId: Int, directions: NavDirections, )</ID> <ID>UndocumentedPublicFunction:NimbusBranchesView.kt$NimbusBranchesView$fun update(state: NimbusBranchesState)</ID> <ID>UndocumentedPublicFunction:PasswordRevealHelper.kt$fun togglePasswordReveal(passwordText: TextView, revealPasswordButton: ImageButton)</ID> @@ -744,8 +744,8 @@ <ID>UndocumentedPublicFunction:SitePermissionsManageExceptionsPhoneFeatureFragment.kt$SitePermissionsManageExceptionsPhoneFeatureFragment$fun initAutoplay(sitePermissions: SitePermissions? = null)</ID> <ID>UndocumentedPublicFunction:SitePermissionsManageExceptionsPhoneFeatureFragment.kt$SitePermissionsManageExceptionsPhoneFeatureFragment$fun initNormalFeature()</ID> <ID>UndocumentedPublicFunction:SortingStrategy.kt$SortingStrategy$abstract operator fun invoke(logins: List<SavedLogin>): List<SavedLogin></ID> - <ID>UndocumentedPublicFunction:SpannableString.kt$fun SpannableString.setTextColor(context: Context, @AttrRes colorResId: Int)</ID> - <ID>UndocumentedPublicFunction:SpannableString.kt$fun SpannableString.setTextSize(context: Context, @Dimension(unit = DP) textSize: Int)</ID> + <ID>UndocumentedPublicFunction:SpannableString.kt$fun SpannableString.setTextColor( context: Context, @AttrRes colorResId: Int, )</ID> + <ID>UndocumentedPublicFunction:SpannableString.kt$fun SpannableString.setTextSize( context: Context, @Dimension(unit = DP) textSize: Int, )</ID> <ID>UndocumentedPublicFunction:StartupActivityLog.kt$StartupActivityLog$@VisibleForTesting(otherwise = NONE) fun getObserversForTesting()</ID> <ID>UndocumentedPublicFunction:StartupActivityLog.kt$StartupActivityLog$@VisibleForTesting(otherwise = PRIVATE) fun logEntries(loggerArg: Logger = logger, logLevel: Log.Priority = Log.logLevel)</ID> <ID>UndocumentedPublicFunction:StartupActivityLog.kt$StartupActivityLog$fun registerInAppOnCreate( application: Application, processLifecycleOwner: LifecycleOwner = ProcessLifecycleOwner.get(), )</ID> @@ -781,7 +781,7 @@ <ID>UndocumentedPublicFunction:TrackingProtectionPanelView.kt$TrackingProtectionPanelView$fun onBackPressed(): Boolean</ID> <ID>UndocumentedPublicFunction:Utils.kt$fun BookmarkNode.flatNodeList(excludeSubtreeRoot: String?, depth: Int = 0): List<BookmarkNodeWithDepth></ID> <ID>UndocumentedPublicFunction:Utils.kt$fun rootTitles(context: Context, withMobileRoot: Boolean): Map<String, String></ID> - <ID>UndocumentedPublicFunction:View.kt$fun View.increaseTapArea(@Dimension(unit = DP) extraDps: Int)</ID> + <ID>UndocumentedPublicFunction:View.kt$fun View.increaseTapArea( @Dimension(unit = DP) extraDps: Int, )</ID> <ID>UndocumentedPublicFunction:View.kt$fun View.removeTouchDelegate()</ID> <ID>UndocumentedPublicFunction:WebPushEngineIntegration.kt$WebPushEngineIntegration$fun start()</ID> <ID>UndocumentedPublicFunction:WebPushEngineIntegration.kt$WebPushEngineIntegration$fun stop()</ID> diff --git a/mobile/android/focus-android/app/src/androidTest/java/org/mozilla/focus/helpers/EspressoHelper.kt b/mobile/android/focus-android/app/src/androidTest/java/org/mozilla/focus/helpers/EspressoHelper.kt @@ -50,7 +50,9 @@ object EspressoHelper { } @JvmStatic - fun assertToolbarMatchesText(@StringRes titleResource: Int) { + fun assertToolbarMatchesText( + @StringRes titleResource: Int, + ) { Espresso.onView( Matchers.allOf( ViewMatchers.withClassName(Matchers.endsWith("TextView")), diff --git a/mobile/android/focus-android/app/src/main/java/org/mozilla/focus/autocomplete/AutocompleteListFragment.kt b/mobile/android/focus-android/app/src/main/java/org/mozilla/focus/autocomplete/AutocompleteListFragment.kt @@ -255,7 +255,8 @@ open class AutocompleteListFragment : BaseSettingsLikeFragment() { internal suspend fun move( context: Context, - from: Int, to: Int, + from: Int, + to: Int, ioDispatcher: CoroutineDispatcher = Dispatchers.IO, ) { Collections.swap(domains, from, to) diff --git a/mobile/android/focus-android/app/src/main/java/org/mozilla/focus/ext/Fragment.kt b/mobile/android/focus-android/app/src/main/java/org/mozilla/focus/ext/Fragment.kt @@ -28,7 +28,9 @@ val Fragment.requireComponents: Components * Get the preference key. * @param preferenceId Resource ID from preference_keys */ -fun Fragment.getPreferenceKey(@StringRes preferenceId: Int): String = getString(preferenceId) +fun Fragment.getPreferenceKey( + @StringRes preferenceId: Int, +): String = getString(preferenceId) /** * Displays the toolbar with the given [title] if the parent activity diff --git a/mobile/android/focus-android/app/src/main/java/org/mozilla/focus/ext/PreferenceFragmentCompat.kt b/mobile/android/focus-android/app/src/main/java/org/mozilla/focus/ext/PreferenceFragmentCompat.kt @@ -12,5 +12,7 @@ import androidx.preference.PreferenceFragmentCompat * Find a preference with the corresponding key and throw if it does not exist. * @param preferenceId Resource ID from preference_keys */ -fun <T : Preference> PreferenceFragmentCompat.requirePreference(@StringRes preferenceId: Int) = +fun <T : Preference> PreferenceFragmentCompat.requirePreference( + @StringRes preferenceId: Int, +) = requireNotNull(findPreference<T>(getPreferenceKey(preferenceId))) diff --git a/mobile/android/focus-android/app/src/main/java/org/mozilla/focus/open/OpenWithFragment.kt b/mobile/android/focus-android/app/src/main/java/org/mozilla/focus/open/OpenWithFragment.kt @@ -89,7 +89,9 @@ class OpenWithFragment : AppCompatDialogFragment(), OnAppSelectedListener { contentView = view } - override fun setContentView(@LayoutRes layoutResID: Int) { + override fun setContentView( + @LayoutRes layoutResID: Int, + ) { throw IllegalStateException("CustomWidthBottomSheetDialog only supports setContentView(View)") } diff --git a/mobile/android/focus-android/app/src/main/java/org/mozilla/focus/utils/ViewUtils.kt b/mobile/android/focus-android/app/src/main/java/org/mozilla/focus/utils/ViewUtils.kt @@ -17,7 +17,11 @@ object ViewUtils { /** * Create a custom FocusSnackbar. */ - fun showBrandedSnackbar(view: View?, @StringRes resId: Int, delayMillis: Int) { + fun showBrandedSnackbar( + view: View?, + @StringRes resId: Int, + delayMillis: Int, + ) { val context = view!!.context val snackbar = FocusSnackbar.make(view, Snackbar.LENGTH_LONG) snackbar.setText(context.getString(resId))