diff options
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/view/InsetsState.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/java/android/view/InsetsState.java b/core/java/android/view/InsetsState.java index b740c58ec15f..e4aa41074221 100644 --- a/core/java/android/view/InsetsState.java +++ b/core/java/android/view/InsetsState.java @@ -342,6 +342,20 @@ public class InsetsState implements Parcelable { } } + /** + * A shortcut for setting the visibility of the source. + * + * @param type The {@link InternalInsetsType} of the source to set the visibility + * @param referenceState The {@link InsetsState} for reference + */ + public void setSourceVisible(@InternalInsetsType int type, InsetsState referenceState) { + InsetsSource source = mSources.get(type); + InsetsSource referenceSource = referenceState.mSources.get(type); + if (source != null && referenceSource != null) { + source.setVisible(referenceSource.isVisible()); + } + } + public void set(InsetsState other) { set(other, false /* copySources */); } |
