Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Support for the Android 11 WindowInsets types #86

Merged
merged 9 commits into from
Jan 12, 2021
Merged

Conversation

chrisbanes
Copy link
Owner

@chrisbanes chrisbanes commented Jan 7, 2021

The new API:

// kotlin
Insetter.builder()
    // This will apply the navigation + status bar insets as padding to
    // all sides of the view
    .padding(windowInsetTypesOf(navigationBars = true, statusBars = true))
    // There's also paddingLeft(), paddingTop(), etc for specific sides
    
    // This will apply the navigation bar insets as bottom margin on the view
    .marginBottom(windowInsetTypesOf(navigationBars = true))
    // Similarly, there's also margin(), marginLeft(), etc
    
    // Applies this to the view
    .applyToView(view)
// java
Insetter.builder()
    // This will apply the navigation + status bar insets as padding to
    // all sides of the view.
    .padding(WindowInsetsCompat.Type.navigationBars()
        | WindowInsetsCompat.Type.statusBars())
    // There's also paddingLeft(), paddingTop(), etc for specific sides
    
    // This will apply the navigation bar insets as bottom margin on the view
    .marginBottom(WindowInsetsCompat.Type.navigationBars())
    // Similarly, there's also margin(), marginLeft(), etc
    
    // Applies this to the view
    .applyToView(view);

Breaking changes

  • DBX: app:consumeSystemWindowInsets has been renamed to app:consumeWindowInsets
  • Widgets: app:consumeSystemWindowInsets has been renamed to app:consumeWindowInsets

@chrisbanes chrisbanes marked this pull request as ready for review January 12, 2021 11:26
@chrisbanes chrisbanes merged commit 05310d4 into main Jan 12, 2021
@chrisbanes chrisbanes deleted the cb/android-11 branch January 12, 2021 11:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants