Last active
August 25, 2020 18:04
-
-
Save ricknout/9610e27aa1e1e48d3560289aa4e2534d to your computer and use it in GitHub Desktop.
MDC-Android ShapeAppearanceModel instantiation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copyright 2020 Google LLC. | |
SPDX-License-Identifier: Apache-2.0 */ | |
// Default builder | |
val sam = ShapeAppearanceModel.builder() | |
.setAllCorners(CornerFamily.CUT, cornerSize) | |
// Also setTopRightCorner, setAllEdges, etc. | |
.build() | |
// Style/attr resources builder (reads shapeAppearance and shapeAppearanceOverlay) | |
val samFromStyles = ShapeAppearanceModel.builder(context, attrs, defStyleAttr, defStyleRes) | |
.build() | |
// Build from existing ShapeAppearanceModel | |
val samFromExisting = sam.toBuilder() | |
... | |
.build() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment