package com.ss.android.ugc.aweme.commercialize.utils;

import X.M12;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import com.bytedance.covode.number.Covode;
import java.util.Objects;

public final class ViewWrapper {
    public final View view;

    static {
        Covode.recordClassIndex(59706);
    }

    public final View getView() {
        return this.view;
    }

    public final int getHeight() {
        return this.view.getLayoutParams().height;
    }

    public final int getWidth() {
        return this.view.getLayoutParams().width;
    }

    public final ViewGroup.MarginLayoutParams getMarginLayoutParams() {
        Object layoutParams;
        if (this.view.getParent() instanceof FrameLayout) {
            ViewGroup.LayoutParams layoutParams2 = this.view.getLayoutParams();
            Objects.requireNonNull(layoutParams2, "null cannot be cast to non-null type android.widget.FrameLayout.LayoutParams");
            layoutParams = (FrameLayout.LayoutParams) layoutParams2;
        } else {
            layoutParams = this.view.getLayoutParams();
            Objects.requireNonNull(layoutParams, "null cannot be cast to non-null type android.view.ViewGroup.MarginLayoutParams");
        }
        return (ViewGroup.MarginLayoutParams) layoutParams;
    }

    public ViewWrapper(View view2) {
        M12.LIZ((Object) view2);
        this.view = view2;
    }

    public final void setHeight(int i) {
        this.view.getLayoutParams().height = i;
        this.view.requestLayout();
    }

    public final void setWidth(int i) {
        this.view.getLayoutParams().width = i;
        this.view.requestLayout();
    }
}
