Search in sources :

Example 81 with TypedValue

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;
}
Also used : Context(android.content.Context) ContextThemeWrapper(android.view.ContextThemeWrapper) Resources(android.content.res.Resources) MenuBuilder(com.smartandroid.sa.sherlock.internal.view.menu.MenuBuilder) TypedValue(android.util.TypedValue)

Example 82 with TypedValue

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;
}
Also used : Context(android.content.Context) ContextThemeWrapper(android.view.ContextThemeWrapper) TypedValue(android.util.TypedValue)

Example 83 with TypedValue

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;
}
Also used : TypedValue(android.util.TypedValue)

Example 84 with TypedValue

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);
}
Also used : ContactPictureLoader(com.fsck.k9.activity.misc.ContactPictureLoader) TypedValue(android.util.TypedValue)

Example 85 with TypedValue

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;
}
Also used : DisplayMetrics(android.util.DisplayMetrics) Point(android.graphics.Point) SuppressLint(android.annotation.SuppressLint) TypedValue(android.util.TypedValue)

Aggregations

TypedValue (android.util.TypedValue)836 TypedArray (android.content.res.TypedArray)185 Resources (android.content.res.Resources)92 ContextThemeWrapper (android.view.ContextThemeWrapper)52 Context (android.content.Context)49 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)40 AttributeSet (android.util.AttributeSet)34 XmlResourceParser (android.content.res.XmlResourceParser)29 View (android.view.View)27 ResourceValue (com.android.ide.common.rendering.api.ResourceValue)26 Point (android.graphics.Point)25 ColorStateList (android.content.res.ColorStateList)23 DisplayMetrics (android.util.DisplayMetrics)23 LinearLayout (android.widget.LinearLayout)20 SpannableString (android.text.SpannableString)19 Bundle (android.os.Bundle)18