private void setTextAttributes()

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


    private void setTextAttributes(
            @NonNull Context context,
            @Nullable AttributeSet attrs,
            int defStyleAttr,
            int defStyleRes) {
        int attrsResources[] = {
                android.R.attr.textColor,
                android.R.attr.gravity,
                android.R.attr.textStyle,
                android.R.attr.text
        };
        TypedArray textAttributes = context.getTheme().obtainStyledAttributes(
                attrs,
                attrsResources,
                defStyleAttr,
                defStyleRes);
        try {
            setTextColor(textAttributes.getColor(0, Color.WHITE));
            setGravity(textAttributes.getInt(1, Gravity.CENTER));
            setTypeface(Typeface.defaultFromStyle(textAttributes.getInt(2, Typeface.NORMAL)));
            String text = textAttributes.getString(3);
            if (text != null) {
                setText(text);
            }
        } finally {
            textAttributes.recycle();
        }
    }