Skip to content

Commit bc5fc25

Browse files
committed
add in an alpha gradient
1 parent 46ec959 commit bc5fc25

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

views/src/main/java/insets/SystemBarProtectionSnippet.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package insets
1818

19+
import android.graphics.Color
1920
import android.os.Bundle
2021
import android.view.View
2122
import androidx.activity.enableEdgeToEdge
@@ -51,11 +52,17 @@ class SystemBarProtectionSnippet : AppCompatActivity() {
5152
}
5253

5354
// [START android_system_bar_protection_kotlin]
55+
val red = 52
56+
val green = 168
57+
val blue = 83
5458
findViewById<ProtectionLayout>(R.id.list_protection)
5559
.setProtections(
5660
listOf(
5761
GradientProtection(
58-
WindowInsetsCompat.Side.TOP
62+
WindowInsetsCompat.Side.TOP,
63+
// Ideally, this is the pane's background color
64+
// alpha = 204 for an 80% gradient
65+
Color.argb(204, red, green, blue)
5966
)
6067
)
6168
)

0 commit comments

Comments
 (0)