private void setBackgroundAttributes()

in core-android/src/main/java/com/uber/sdk/android/core/UberButton.java [153:180]


    private void setBackgroundAttributes(
            @NonNull Context context,
            @Nullable AttributeSet attrs,
            int defStyleAttr,
            int defStyleRes) {
        int attrsResources[] = {
                android.R.attr.background,
        };
        @SuppressLint("ResourceType") TypedArray backgroundAttributes = context.getTheme().obtainStyledAttributes(
                attrs,
                attrsResources,
                defStyleAttr,
                defStyleRes);
        try {
            if (backgroundAttributes.hasValue(0)) {
                int backgroundResource = backgroundAttributes.getResourceId(0, 0);
                if (backgroundResource != 0) {
                    setBackgroundResource(backgroundResource);
                } else {
                    setBackgroundColor(backgroundAttributes.getColor(0, Color.BLACK));
                }
            } else {
                setBackgroundColor(backgroundAttributes.getColor(0, Color.BLACK));
            }
        } finally {
            backgroundAttributes.recycle();
        }
    }