Search in sources :

Example 51 with TypedValue

use of android.util.TypedValue in project XobotOS by xamarin.

the class AlertController method shouldCenterSingleButton.

private static boolean shouldCenterSingleButton(Context context) {
    TypedValue outValue = new TypedValue();
    context.getTheme().resolveAttribute(com.android.internal.R.attr.alertDialogCenterButtons, outValue, true);
    return outValue.data != 0;
}
Also used : TypedValue(android.util.TypedValue)

Example 52 with TypedValue

use of android.util.TypedValue in project ZI by yixia.

the class UIUtils method getAttrValue.

public static TypedValue getAttrValue(Activity activity, int attrId) {
    TypedValue typedValue = new TypedValue();
    activity.getTheme().resolveAttribute(attrId, typedValue, true);
    return typedValue;
}
Also used : TypedValue(android.util.TypedValue)

Example 53 with TypedValue

use of android.util.TypedValue in project Android-skin-support by ximsfei.

the class SkinMaterialBottomNavigationView method createDefaultColorStateList.

private ColorStateList createDefaultColorStateList(int baseColorThemeAttr) {
    final TypedValue value = new TypedValue();
    if (!getContext().getTheme().resolveAttribute(baseColorThemeAttr, value, true)) {
        return null;
    }
    ColorStateList baseColor = AppCompatResources.getColorStateList(getContext(), value.resourceId);
    int colorPrimary = SkinCompatResources.getInstance().getColor(mDefaultTintResId);
    int defaultColor = baseColor.getDefaultColor();
    return new ColorStateList(new int[][] { DISABLED_STATE_SET, CHECKED_STATE_SET, EMPTY_STATE_SET }, new int[] { baseColor.getColorForState(DISABLED_STATE_SET, defaultColor), colorPrimary, defaultColor });
}
Also used : ColorStateList(android.content.res.ColorStateList) TypedValue(android.util.TypedValue)

Example 54 with TypedValue

use of android.util.TypedValue in project ViewInspector by xfumihiro.

the class BaseDialog method getDialogTheme.

public static int getDialogTheme(Context context) {
    TypedValue outValue = new TypedValue();
    context.getTheme().resolveAttribute(R.attr.isLightTheme, outValue, true);
    return outValue.data != 0 ? R.style.DialogThemeLight : R.style.DialogTheme;
}
Also used : TypedValue(android.util.TypedValue)

Example 55 with TypedValue

use of android.util.TypedValue in project LookLook by xinghongfei.

the class ViewUtils method getActionBarSize.

public static int getActionBarSize(Context context) {
    if (actionBarSize < 0) {
        TypedValue value = new TypedValue();
        context.getTheme().resolveAttribute(android.R.attr.actionBarSize, value, true);
        actionBarSize = TypedValue.complexToDimensionPixelSize(value.data, context.getResources().getDisplayMetrics());
    }
    return actionBarSize;
}
Also used : TypedValue(android.util.TypedValue)

Aggregations

TypedValue (android.util.TypedValue)844 TypedArray (android.content.res.TypedArray)190 Resources (android.content.res.Resources)92 ContextThemeWrapper (android.view.ContextThemeWrapper)52 Context (android.content.Context)50 Drawable (android.graphics.drawable.Drawable)49 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)46 TextView (android.widget.TextView)44 Paint (android.graphics.Paint)41 IOException (java.io.IOException)39 AttributeSet (android.util.AttributeSet)34 View (android.view.View)30 XmlResourceParser (android.content.res.XmlResourceParser)29 Point (android.graphics.Point)26 ResourceValue (com.android.ide.common.rendering.api.ResourceValue)26 ColorStateList (android.content.res.ColorStateList)23 DisplayMetrics (android.util.DisplayMetrics)23 LinearLayout (android.widget.LinearLayout)20 Bundle (android.os.Bundle)19 SpannableString (android.text.SpannableString)19