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

Commit 088ae231 authored by Ibrahim Yilmaz's avatar Ibrahim Yilmaz Committed by Android (Google) Code Review
Browse files

Merge "[RON-AOD] Fix NotificationToplineView Margin in Skeleton" into main

parents 569f672c 36cc93d8
Loading
Loading
Loading
Loading
+23 −5
Original line number Diff line number Diff line
@@ -302,7 +302,7 @@ private class AODPromotedNotificationViewUpdater(root: View) {
            if (!skeletonLargeIcon.isNullOrEmpty()) {
                imageEndMarginPx
            } else {
                0
                endMarginPx
            }

    private data class SmallIconSavedState(val background: Drawable?, val padding: Rect)
@@ -326,10 +326,12 @@ private class AODPromotedNotificationViewUpdater(root: View) {
            ?.mutate()
            ?.setColorFilter(SecondaryText.colorInt, PorterDuff.Mode.SRC_IN)

        (rightIcon?.layoutParams as? MarginLayoutParams)?.let {
            it.marginEnd = endMarginPx
            rightIcon.layoutParams = it
        }
        rightIcon?.setRightIconState(
            width = largeIconSizePx,
            height = largeIconSizePx,
            marginEnd = endMarginPx,
        )

        bigText?.setImageEndMargin(largeIconSizePx + endMarginPx)
        text?.setImageEndMargin(largeIconSizePx + endMarginPx)

@@ -706,6 +708,22 @@ private fun TextView.appendFontFeatureSetting(newSetting: String) {
    fontFeatureSettings = (fontFeatureSettings?.let { "$it," } ?: "") + newSetting
}

private fun ImageView.setRightIconState(width: Int, height: Int, marginEnd: Int) {

    val lp = (layoutParams as? MarginLayoutParams) ?: return
    lp.width = width
    lp.height = height
    lp.marginEnd = marginEnd

    layoutParams = lp
}

private fun NotificationTopLineView.setEndMargin(marginEnd: Int) {
    val lp = (layoutParams as? MarginLayoutParams) ?: return
    lp.marginEnd = marginEnd
    layoutParams = lp
}

private enum class AodPromotedNotificationColor(val colorInt: Int) {
    Background(android.graphics.Color.BLACK),
    PrimaryText(android.graphics.Color.WHITE),