add hideAllChildren() in Switcher ViewGroup

This commit is contained in:
grigorii 2021-09-15 09:24:20 +03:00
parent d9a9957cd4
commit e2d744c5d3
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) {