use of android.util.TypedValue in project cw-omnibus by commonsguy.
the class ActionBarSherlockCompat method initializePanelMenu.
private boolean initializePanelMenu() {
//getContext();
Context context = mActivity;
// If we have an action bar, initialize the menu with a context themed for it.
if (wActionBar != null) {
TypedValue outValue = new TypedValue();
Resources.Theme currentTheme = context.getTheme();
currentTheme.resolveAttribute(R.attr.actionBarWidgetTheme, outValue, true);
final int targetThemeRes = outValue.resourceId;
if (targetThemeRes != 0) /*&& context.getThemeResId() != targetThemeRes*/
{
context = new ContextThemeWrapper(context, targetThemeRes);
}
}
mMenu = new MenuBuilder(context);
mMenu.setCallback(this);
return true;
}
use of android.util.TypedValue in project cw-omnibus by commonsguy.
the class ActionBarSherlockNative method getThemedContext.
@Override
protected Context getThemedContext() {
Context context = mActivity;
TypedValue outValue = new TypedValue();
mActivity.getTheme().resolveAttribute(android.R.attr.actionBarWidgetTheme, outValue, true);
if (outValue.resourceId != 0) {
//We are unable to test if this is the same as our current theme
//so we just wrap it and hope that if the attribute was specified
//then the user is intentionally specifying an alternate theme.
context = new ContextThemeWrapper(context, outValue.resourceId);
}
return context;
}
use of android.util.TypedValue in project cw-omnibus by commonsguy.
the class ActionBarImpl method getThemedContext.
public Context getThemedContext() {
if (mThemedContext == null) {
TypedValue outValue = new TypedValue();
Resources.Theme currentTheme = mContext.getTheme();
currentTheme.resolveAttribute(R.attr.actionBarWidgetTheme, outValue, true);
final int targetThemeRes = outValue.resourceId;
if (targetThemeRes != 0) {
//XXX && mContext.getThemeResId() != targetThemeRes) {
mThemedContext = new ContextThemeWrapper(mContext, targetThemeRes);
} else {
mThemedContext = mContext;
}
}
return mThemedContext;
}
use of android.util.TypedValue in project UltimateRecyclerView by cymcsg.
the class BaseActivity method getActionBarSize.
protected int getActionBarSize() {
TypedValue typedValue = new TypedValue();
int[] textSizeAttr = new int[] { R.attr.actionBarSize };
int indexOfAttrTextSize = 0;
TypedArray a = obtainStyledAttributes(typedValue.data, textSizeAttr);
int actionBarSize = a.getDimensionPixelSize(indexOfAttrTextSize, -1);
a.recycle();
return actionBarSize;
}
use of android.util.TypedValue in project FlexibleAdapter by davideas.
the class DrawableUtils method getColorControlHighlight.
/**
* Helper to get the system default Color Control Highlight. Returns the color of the
* {@code R.attr.colorControlHighlight} attribute in the overridden style.
*
* @param context the context
* @return Default Color Control Highlight
* @since 5.0.0-b7 Created, returns the resourceId
* <br/> 5.0.0-rc1 Now returns the real color (not the resourceId)
*/
@ColorInt
public static int getColorControlHighlight(Context context) {
TypedValue outValue = new TypedValue();
// It's important to not use the android.R because this wouldn't add the overridden drawable
context.getTheme().resolveAttribute(R.attr.colorControlHighlight, outValue, true);
if (Utils.hasMarshmallow())
return context.getColor(outValue.resourceId);
else
return context.getResources().getColor(outValue.resourceId);
}
Aggregations