package com.unity3d.player;

import android.content.Context;
import android.view.View;
import android.widget.FrameLayout;
import java.util.HashSet;
import java.util.Set;

/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: /storage/emulated/0/Documents/jadec/sources/com.UBI.A90.WW/dex-files/2.dex */
public final class t {
    public static t a;
    private final FrameLayout b;
    private Set c = new HashSet();
    private View d;
    private View e;

    /* JADX INFO: Access modifiers changed from: package-private */
    public t(FrameLayout frameLayout) {
        this.b = frameLayout;
        a = this;
    }

    private void f(View view) {
        this.b.addView(view, this.b.getChildCount());
    }

    private void g(View view) {
        this.b.removeView(view);
        this.b.requestLayout();
    }

    public final Context a() {
        return this.b.getContext();
    }

    public final void a(View view) {
        this.e = view;
        this.e.setVisibility(4);
        this.b.addView(this.e);
    }

    public final void b(View view) {
        this.c.add(view);
        if (this.d != null) {
            f(view);
        }
    }

    public final void c(View view) {
        this.c.remove(view);
        if (this.d != null) {
            g(view);
        }
    }

    public final void d(View view) {
        if (this.d != view) {
            this.d = view;
            this.b.addView(view);
            for (View view2 : this.c) {
                f(view2);
            }
            if (this.e != null) {
                this.e.setVisibility(4);
            }
        }
    }

    public final void e(View view) {
        if (this.d == view) {
            for (View view2 : this.c) {
                g(view2);
            }
            this.b.removeView(view);
            this.d = null;
            if (this.e != null) {
                this.e.setVisibility(0);
            }
        }
    }
}
