Skip to content

Commit d1d2ad3

Browse files
feat: adds transparent caption bar snippet for DesktopWindowing
* Adds `TransparentActionBar` snippet region to demonstrate configuring transparent caption bar backgrounds via `WindowInsetsController`.
1 parent dace497 commit d1d2ad3

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

compose/snippets/src/main/java/com/example/compose/snippets/adaptivelayouts/DesktopWindowing.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import android.content.ClipData
2222
import android.content.ClipDescription
2323
import android.content.Intent
2424
import android.view.View
25+
import android.view.WindowInsetsController
2526
import androidx.compose.foundation.background
2627
import androidx.compose.foundation.draganddrop.dragAndDropSource
2728
import androidx.compose.foundation.draganddrop.dragAndDropTarget
@@ -74,6 +75,20 @@ fun CaptionBar() {
7475
}
7576
// [END android_compose_desktop_window_insets_title]
7677

78+
/**
79+
* Transparent System Caption Bar
80+
*/
81+
fun TransparentActionBar(activity: Activity) {
82+
with(activity) {
83+
// [START android_compose_desktop_window_transparent_caption]
84+
window.insetsController?.setSystemBarsAppearance(
85+
WindowInsetsController.APPEARANCE_TRANSPARENT_CAPTION_BAR_BACKGROUND,
86+
WindowInsetsController.APPEARANCE_TRANSPARENT_CAPTION_BAR_BACKGROUND
87+
)
88+
// [END android_compose_desktop_window_transparent_caption]
89+
}
90+
}
91+
7792
/**
7893
* Simple drag source for plain text data.
7994
*/

0 commit comments

Comments
 (0)