List of usage examples for android.util TypedValue getFloat
public final float getFloat()
From source file:Main.java
public static float getFloatConstant(final Resources res, final int constant) { TypedValue outValue = new TypedValue(); res.getValue(constant, outValue, true); return outValue.getFloat(); }
From source file:Main.java
/** * gets float from resource values/*from ww w.j a v a2 s .c o m*/ * * @param context context of calling activity * @param dimen resource id * @return float */ public static float getFloat(Context context, @DimenRes int dimen) { TypedValue outValue = new TypedValue(); context.getResources().getValue(dimen, outValue, true); return outValue.getFloat(); }
From source file:net.yanzm.actionbarprogress.ThemeUtils.java
public static int getDisabledThemeAttrColor(@NonNull Context context, int attr) { TypedValue typedValue = new TypedValue(); context.getTheme().resolveAttribute(android.R.attr.disabledAlpha, typedValue, true); final float disabledAlpha = typedValue.getFloat(); return getThemeAttrColor(context, attr, disabledAlpha); }
From source file:android.support.v7.app.MediaRouterThemeHelper.java
public static float getDisabledAlpha(Context context) { TypedValue value = new TypedValue(); return context.getTheme().resolveAttribute(android.R.attr.disabledAlpha, value, true) ? value.getFloat() : 0.5f;// w ww.j a v a2 s . com }
From source file:com.tr4android.support.extension.picker.PickerThemeUtils.java
public static float getDisabledAlpha(Context context) { final TypedValue outValue = new TypedValue(); context.getTheme().resolveAttribute(android.R.attr.disabledAlpha, outValue, true); return outValue.getFloat(); }
From source file:android.support.v7.internal.widget.ThemeUtils.java
static int getDisabledThemeAttrColor(Context context, int attr) { final ColorStateList csl = getThemeAttrColorStateList(context, attr); if (csl != null && csl.isStateful()) { // If the CSL is stateful, we'll assume it has a disabled state and use it return csl.getColorForState(DISABLED_STATE_SET, csl.getDefaultColor()); } else {//from w w w . java 2 s. co m // Else, we'll generate the color using disabledAlpha from the theme final TypedValue tv = getTypedValue(); // Now retrieve the disabledAlpha value from the theme context.getTheme().resolveAttribute(android.R.attr.disabledAlpha, tv, true); final float disabledAlpha = tv.getFloat(); return getThemeAttrColor(context, attr, disabledAlpha); } }
From source file:android.support.v7.widget.ThemeUtils.java
public static int getDisabledThemeAttrColor(Context context, int attr) { final ColorStateList csl = getThemeAttrColorStateList(context, attr); if (csl != null && csl.isStateful()) { // If the CSL is stateful, we'll assume it has a disabled state and use it return csl.getColorForState(DISABLED_STATE_SET, csl.getDefaultColor()); } else {//from w ww .java 2 s .co m // Else, we'll generate the color using disabledAlpha from the theme final TypedValue tv = getTypedValue(); // Now retrieve the disabledAlpha value from the theme context.getTheme().resolveAttribute(android.R.attr.disabledAlpha, tv, true); final float disabledAlpha = tv.getFloat(); return getThemeAttrColor(context, attr, disabledAlpha); } }
From source file:com.kaliturin.blacklist.utils.Utils.java
/** * Scales passed view with passed dimension on Tablets only *//* www . ja va 2 s . c om*/ public static void scaleViewOnTablet(Context context, View view, @DimenRes int dimenRes) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { boolean isTablet = context.getResources().getBoolean(R.bool.isTablet); if (isTablet) { TypedValue outValue = new TypedValue(); context.getResources().getValue(dimenRes, outValue, true); float scale = outValue.getFloat(); view.setScaleX(scale); view.setScaleY(scale); } } }
From source file:me.henrytao.mdcore.core.MdCompat.java
public static float getFloatFromAttribute(Context context, int attrId) { if (attrId == 0) { return 0; }//from ww w .j a va 2 s. c om TypedValue a = new TypedValue(); context.getTheme().resolveAttribute(attrId, a, true); return a.getFloat(); }
From source file:com.bilibili.magicasakura.utils.ThemeUtils.java
public static int getDisabledThemeAttrColor(Context context, @AttrRes int attr) { final ColorStateList csl = getThemeAttrColorStateList(context, attr); if (csl != null && csl.isStateful()) { // If the CSL is stateful, we'll assume it has a disabled state and use it return csl.getColorForState(DISABLED_STATE_SET, csl.getDefaultColor()); } else {/*from www . ja v a2 s . c o m*/ // Else, we'll generate the color using disabledAlpha from the theme final TypedValue tv = getTypedValue(); // Now retrieve the disabledAlpha value from the theme context.getTheme().resolveAttribute(android.R.attr.disabledAlpha, tv, true); final float disabledAlpha = tv.getFloat(); return getThemeAttrColor(context, attr, disabledAlpha); } }