use of android.util.TypedValue in project SmartAndroidSource by jaychou2012.
the class ActionBarSherlockCompat method initializePanelMenu.
private boolean initializePanelMenu() {
// getContext();
Context context = mActivity;
// for it.
if (wActionBar != null) {
TypedValue outValue = new TypedValue();
Resources.Theme currentTheme = context.getTheme();
currentTheme.resolveAttribute(android.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 SmartAndroidSource by jaychou2012.
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 Klyph by jonathangerbaud.
the class ProfileActivity method getActionBarHeight.
public int getActionBarHeight() {
if (mActionBarHeight != 0) {
return mActionBarHeight;
}
TypedValue mTypedValue = new TypedValue();
getTheme().resolveAttribute(android.R.attr.actionBarSize, mTypedValue, true);
mActionBarHeight = TypedValue.complexToDimensionPixelSize(mTypedValue.data, getResources().getDisplayMetrics());
return mActionBarHeight;
}
use of android.util.TypedValue in project k-9 by k9mail.
the class ContactPicture method getContactPictureLoader.
public static ContactPictureLoader getContactPictureLoader(Context context) {
final int defaultBgColor;
if (!K9.isColorizeMissingContactPictures()) {
TypedValue outValue = new TypedValue();
context.getTheme().resolveAttribute(R.attr.contactPictureFallbackDefaultBackgroundColor, outValue, true);
defaultBgColor = outValue.data;
} else {
defaultBgColor = 0;
}
return new ContactPictureLoader(context, defaultBgColor);
}
use of android.util.TypedValue in project packer-ng-plugin by mcxiaoke.
the class ViewUtils method getActionBarHeight.
public static int getActionBarHeight(Context context) {
int actionBarHeight = 0;
TypedValue tv = new TypedValue();
final DisplayMetrics dm = context.getResources().getDisplayMetrics();
if (Build.VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB) {
if (context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true))
actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, dm);
} else {
tv.data = 48;
actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, dm);
}
return actionBarHeight;
}
Aggregations