Search in sources :

Example 11 with TypedValue

use of android.util.TypedValue in project FlexibleAdapter by davideas.

the class DrawableUtils method getSelectableBackground.

/**
	 * Helper to get the default Selectable Background. Returns the resourceId of the
	 * {@code R.attr.selectableItemBackground} attribute of the overridden style.
	 *
	 * @param context the context
	 * @return Default selectable background resId
	 * @since 5.0.0-b7
	 * @deprecated Use {@link #getSelectableItemBackground(Context)} instead.
	 */
@Deprecated
public static int getSelectableBackground(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.selectableItemBackground, outValue, true);
    return outValue.resourceId;
}
Also used : TypedValue(android.util.TypedValue)

Example 12 with TypedValue

use of android.util.TypedValue in project Libraries-for-Android-Developers by eoecn.

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

Example 13 with TypedValue

use of android.util.TypedValue in project Libraries-for-Android-Developers by eoecn.

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 14 with TypedValue

use of android.util.TypedValue in project Libraries-for-Android-Developers by eoecn.

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

Example 15 with TypedValue

use of android.util.TypedValue in project Libraries-for-Android-Developers by eoecn.

the class SearchView method getSearchIconId.

/**
     * For a given suggestion and a given cursor row, get the action message. If
     * not provided by the specific row/column, also check for a single
     * definition (for the action key).
     *
     * @param c The cursor providing suggestions
     * @param actionKey The actionkey record being examined
     *
     * @return Returns a string, or null if no action key message for this
     *         suggestion
     */
// TODO private static String getActionKeyMessage(Cursor c, SearchableInfo.ActionKeyInfo actionKey) {
// TODO     String result = null;
// TODO     // check first in the cursor data, for a suggestion-specific message
// TODO     final String column = actionKey.getSuggestActionMsgColumn();
// TODO     if (column != null) {
// TODO         result = SuggestionsAdapter.getColumnString(c, column);
// TODO     }
// TODO     // If the cursor didn't give us a message, see if there's a single
// TODO     // message defined
// TODO     // for the actionkey (for all suggestions)
// TODO     if (result == null) {
// TODO         result = actionKey.getSuggestActionMsg();
// TODO     }
// TODO     return result;
// TODO }
private int getSearchIconId() {
    TypedValue outValue = new TypedValue();
    getContext().getTheme().resolveAttribute(R.attr.searchViewSearchIcon, outValue, true);
    return outValue.resourceId;
}
Also used : 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