package d.f.a.s2;

import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import com.ifpdos.debugmenu.R;

/* JADX INFO: compiled from: ContainerDialog.java */
/* JADX INFO: loaded from: classes.dex */
public class b {
    public Dialog a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public WindowManager.LayoutParams f3396b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public float f3397c;

    public b(Context context) {
        Dialog dialog = new Dialog(context.getApplicationContext(), R.style.dialog);
        this.a = dialog;
        WindowManager.LayoutParams attributes = dialog.getWindow().getAttributes();
        this.f3396b = attributes;
        attributes.format = 1;
        attributes.gravity = 17;
        attributes.type = 2003;
        this.a.getWindow().setAttributes(this.f3396b);
        this.f3397c = context.getResources().getDisplayMetrics().density * (-433.3f);
    }

    public boolean a() {
        Dialog dialog = this.a;
        return dialog != null && dialog.isShowing();
    }

    public void b(View view) {
        if (this.a == null) {
            return;
        }
        if (view.getParent() instanceof ViewGroup) {
            ((ViewGroup) view.getParent()).removeView(view);
        }
        this.a.show();
        this.a.getWindow().setContentView(view);
    }

    public void c(View view) {
        b(view);
        WindowManager.LayoutParams attributes = this.a.getWindow().getAttributes();
        this.f3396b = attributes;
        attributes.width = -2;
        attributes.x = (int) this.f3397c;
        this.a.getWindow().setAttributes(this.f3396b);
    }
}
