Context getTheme - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Context getTheme method.

This code example shows how to use the following methods:getResources, getTheme
7
CodeRank
This code example shows how to use the following methods:getResources, getTheme
		return ret;
	} 
 
	public static int getEditTextColor(Context ctx) {
		TypedValue tv = new TypedValue();
		boolean found = ctx.getTheme().resolveAttribute(android.R.attr.editTextColor, tv, true);
		if (found) {
			// SDK 11+ 
			return ctx.getResources().getColor(tv.resourceId);
		} else { 
			// SDK < 11 
			return ctx.getResources().getColor(android.R.color.primary_text_light);
		} 
	} 
} 
7
CodeRank
This code example shows how to use the following methods:getTheme
        } 
    } 
 
    protected int getActionBarSize(Context context) {
        int[] attrs = {android.R.attr.actionBarSize};
        TypedArray values = context.getTheme().obtainStyledAttributes(attrs);
        try { 
            return values.getDimensionPixelSize(0, 0);
        } finally { 
            values.recycle();
        } 
    } 
 
    protected int getActionBarTitleStyle(Context context) {
        int[] android_styleable_ActionBar = {android.R.attr.titleTextStyle};
 
        // Need to get resource id of style pointed to from actionBarStyle 
        TypedValue outValue = new TypedValue();
        context.getTheme().resolveAttribute(android.R.attr.actionBarStyle, outValue, true);
        // Now get action bar style values... 
7
CodeRank
This code example shows how to use the following methods:getResources, getTheme
7
CodeRank
This code example shows how to use the following methods:getTheme
		return ThemeUtils.getActionBarBackground(context);
	} 
 
	protected int getActionBarSize(final Context context) {
		final int[] attrs = { android.R.attr.actionBarSize };
		final TypedArray values = context.getTheme().obtainStyledAttributes(attrs);
		try { 
			return values.getDimensionPixelSize(0, 0);
		} finally { 
			values.recycle();
		} 
	} 
 
	protected int getActionBarTitleStyle(final Context context) {
		final int[] android_styleable_ActionBar = { android.R.attr.titleTextStyle };
 
		// Need to get resource id of style pointed to from actionBarStyle 
		final TypedValue outValue = new TypedValue();
		context.getTheme().resolveAttribute(android.R.attr.actionBarStyle, outValue, true);
		// Now get action bar style values... 
6
CodeRank
This code example shows how to use the following methods:getTheme
 
    /** 
     * Delegate to overlay:  set the View that it will use as its alpha-layer. 
     * If none is set, the overlay will use its own alpha layer.  Only 
     * necessary to set this if some child views need to appear above the 
     * alpha-layer. 
     */ 
    protected void setAlphaLayer(View layer) {
        mOverlay.setAlphaLayer(layer);
    } 
 
    /** Delegate to overlay: set the alpha value on the alpha layer. */ 
    public void setAlphaLayerValue(float alpha) {
        mOverlay.setAlphaLayerValue(alpha);
    } 
 
    /** Delegate to overlay. */ 
    public void setOverlayOnClickListener(OnClickListener listener) {
        mOverlay.setOverlayOnClickListener(listener);
    } 
6
CodeRank
This code example shows how to use the following methods:getTheme
 
    public AlphaTouchInterceptorOverlay(Context context) {
        super(context);
 
        mInterceptorLayer = new View(context);
        final int resId = ThemeUtils.getSelectableItemBackground(context.getTheme());
        mInterceptorLayer.setBackgroundResource(resId);
        addView(mInterceptorLayer);
 
        mAlphaLayer = this;
    } 
 
    /** 
     * Set the View that the overlay will use as its alpha-layer.  If 
     * none is set it will use itself.  Only necessary to set this if 
     * some child views need to appear above the alpha-layer but below 
     * the touch-interceptor. 
     */ 
    public void setAlphaLayer(View alphaLayer) {
        if (mAlphaLayer == alphaLayer) return;
6
CodeRank
This code example shows how to use the following methods:getTheme
This code example shows how to use the following methods:getTheme
This code example shows how to use the following methods:getTheme
    protected Drawable getActionBarBackground(Context context) {
        int[] android_styleable_ActionBar = { android.R.attr.background };
 
        // Need to get resource id of style pointed to from actionBarStyle 
        TypedValue outValue = new TypedValue();
        context.getTheme().resolveAttribute(android.R.attr.actionBarStyle, outValue, true);
        // Now get action bar style values... 
        TypedArray abStyle = context.getTheme().obtainStyledAttributes(outValue.resourceId,
                android_styleable_ActionBar);
        try { 
            // background is the first attr in the array above so it's index is 0. 
            return abStyle.getDrawable(0);
        } finally { 
            abStyle.recycle();
        } 
    } 
 
    protected int getActionBarSize(Context context) {
        int[] attrs = { android.R.attr.actionBarSize };
        TypedArray values = context.getTheme().obtainStyledAttributes(attrs);
5
CodeRank

Related Context getTheme Questions & Answers:

getTheme Method Overview
Return the Theme object associated with this Context.
See Code Examples for other Android Context Methods: