Example usage for android.util TypedValue TypedValue

List of usage examples for android.util TypedValue TypedValue

Introduction

In this page you can find the example usage for android.util TypedValue TypedValue.

Prototype

TypedValue

Source Link

Usage

From source file:com.dockerandroid.ui.fragment.BaseFragment.java

protected int getColorPrimary() {
    TypedValue typedValue = new TypedValue();
    getContext().getTheme().resolveAttribute(R.attr.colorPrimary, typedValue, true);
    return typedValue.data;
}

From source file:com.grarak.kerneladiutor.utils.ViewUtils.java

public static int getColorPrimaryColor(Context context) {
    TypedValue value = new TypedValue();
    context.getTheme().resolveAttribute(R.attr.colorPrimary, value, true);
    return value.data;
}

From source file:com.hellofyc.base.util.ViewUtils.java

/**
 * ?ActionBar/* w w w.  j  a  va  2 s  .  c  o  m*/
 */
public static int getActionBarHeight(Context context) {
    TypedValue tv = new TypedValue();
    if (context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
        return TypedValue.complexToDimensionPixelSize(tv.data, context.getResources().getDisplayMetrics());
    }
    return 0;
}

From source file:com.grarak.kerneladiutor.utils.ViewUtils.java

public static int getColorPrimaryDarkColor(Context context) {
    TypedValue value = new TypedValue();
    context.getTheme().resolveAttribute(R.attr.colorPrimaryDark, value, true);
    return value.data;
}

From source file:android.support.v7.internal.widget.AbsActionBarView.java

AbsActionBarView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final TypedValue tv = new TypedValue();
    if (context.getTheme().resolveAttribute(R.attr.actionBarPopupTheme, tv, true) && tv.resourceId != 0) {
        mPopupContext = new ContextThemeWrapper(context, tv.resourceId);
    } else {/*w ww.j  a  va  2s  .  co  m*/
        mPopupContext = context;
    }
}

From source file:com.andrada.sitracker.ui.PublicationDetailsActivity.java

private boolean shouldBeFloatingWindow() {
    Resources.Theme theme = getTheme();
    TypedValue floatingWindowFlag = new TypedValue();
    if (theme == null || !theme.resolveAttribute(R.attr.isFloatingWindow, floatingWindowFlag, true)) {
        // isFloatingWindow flag is not defined in theme
        return false;
    }//from  ww  w  . ja v  a  2s  .co  m
    return (floatingWindowFlag.data != 0);
}

From source file:com.example.jit.home.SlidingTabStrip.java

SlidingTabStrip(Context context, AttributeSet attrs) {
    super(context, attrs);
    setWillNotDraw(false);/*from  w  w w. j  a  va2s.  c  o m*/

    final float density = getResources().getDisplayMetrics().density;

    TypedValue outValue = new TypedValue();
    context.getTheme().resolveAttribute(R.attr.colorForeground, outValue, true);
    final int themeForegroundColor = outValue.data;

    mDefaultBottomBorderColor = setColorAlpha(themeForegroundColor, DEFAULT_BOTTOM_BORDER_COLOR_ALPHA);

    mDefaultTabColorizer = new SimpleTabColorizer();
    mDefaultTabColorizer.setIndicatorColors(DEFAULT_SELECTED_INDICATOR_COLOR);

    mBottomBorderThickness = (int) (DEFAULT_BOTTOM_BORDER_THICKNESS_DIPS * density);
    mBottomBorderPaint = new Paint();
    mBottomBorderPaint.setColor(mDefaultBottomBorderColor);

    mSelectedIndicatorThickness = (int) (SELECTED_INDICATOR_THICKNESS_DIPS * density);
    mSelectedIndicatorPaint = new Paint();
}

From source file:com.grarak.kerneladiutor.utils.ViewUtils.java

public static int getThemeAccentColor(Context context) {
    TypedValue value = new TypedValue();
    context.getTheme().resolveAttribute(R.attr.colorAccent, value, true);
    return value.data;
}

From source file:com.auth0.android.lock.internal.configuration.Theme.java

private String resolveStringResource(Context context, @StringRes int res, @AttrRes int attrName) {
    if (res > 0) {
        return context.getString(res);
    }//from  w  w  w. java 2s.co m

    TypedValue typedValue = new TypedValue();
    context.getTheme().resolveAttribute(attrName, typedValue, true);
    return context.getString(typedValue.resourceId);
}

From source file:com.jefftharris.passwdsafe.StorageFileListFragment.java

@Override
public void onAttach(Context ctx) {
    super.onAttach(ctx);
    itsListener = (Listener) ctx;//from   w  ww .  ja v  a  2 s.  c o m

    Resources.Theme theme = ctx.getTheme();
    TypedValue attr = new TypedValue();
    theme.resolveAttribute(R.attr.drawablePasswdsafe, attr, true);
    itsFileIcon = attr.resourceId;
}