package com.adealink.weparty.commonui.viewstub;

import android.view.View;

/**
 * Created by XiaoDongLin.
 * Date: 2025/3/5
 */

public class ViewStubUtil {

    public static ViewStubProxy getInflatedViewStub(View container, ViewStubProxy currProxy, int resId) {
        ViewStubProxy proxy = currProxy == null
                ? findViewStubById(container, resId)
                : currProxy;
        if (!proxy.isInflated()) {
            proxy.getViewStub().inflate();
        }
        return proxy;
    }

    public static ViewStubProxy findViewStubById(View container, int id) {
        return new ViewStubProxy(container.findViewById(id));
    }
}
