Merge pull request #222 from TouchInstinct/change_switcher

add hideAllChildren() in Switcher ViewGroup
This commit is contained in:
Grigorii 2021-09-15 12:29:59 +03:00 committed by GitHub
commit 1964aae248
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -67,6 +67,13 @@ public class Switcher extends FrameLayout {
}
}
public void hideAllChildren() {
for (int index = 0; index < getChildCount(); index++) {
final View child = getChildAt(index);
setVisibilityWithAnimation(child, View.GONE);
}
}
private void setVisibilityWithAnimation(@NonNull final View view, final int targetVisibility) {
final Animation animation = targetVisibility == View.VISIBLE ? inAnimation : outAnimation;
if (view.getVisibility() != targetVisibility) {