Example usage for android.content.res TypedArray recycle

List of usage examples for android.content.res TypedArray recycle

Introduction

In this page you can find the example usage for android.content.res TypedArray recycle.

Prototype

public void recycle() 

Source Link

Document

Recycles the TypedArray, to be re-used by a later caller.

Usage

From source file:by.vshkl.localweather.ui.DividerItemDecoration.java

public DividerItemDecoration(Context context) {
    final TypedArray a = context.obtainStyledAttributes(ATTRS);
    mDivider = a.getDrawable(0);
    a.recycle();
}

From source file:android.percent.support.PercentLayoutHelper.java

/**
 * Constructs a PercentLayoutInfo from attributes associated with a View. Call this method from
 * {@code LayoutParams(Context c, AttributeSet attrs)} constructor.
 *///w  w  w. j a v a 2s  .  c  o m
public static PercentLayoutInfo getPercentLayoutInfo(Context context, AttributeSet attrs) {
    PercentLayoutInfo info = null;
    TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.PercentLayout_Layout);

    info = setWidthAndHeightVal(array, info);

    info = setMarginRelatedVal(array, info);

    info = setTextSizeSupportVal(array, info);

    info = setMinMaxWidthHeightRelatedVal(array, info);

    info = setPaddingRelatedVal(array, info);

    array.recycle();

    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, "constructed: " + info);
    }
    return info;
}

From source file:br.com.oficinatablet.chats.decoration.DividerItemDecoration.java

/**
 * Divider padro ser usado//from w  w w  .ja va2  s . c o  m
 */
public DividerItemDecoration(Context context) {
    final TypedArray styledAttributes = context.obtainStyledAttributes(ATTRS);
    mDivider = styledAttributes.getDrawable(0);
    styledAttributes.recycle();
}

From source file:ciriti.retrofitmockserver.widget.DividerItemDecoration.java

public DividerItemDecoration(Context context, int orientation) {
    final TypedArray a = context.obtainStyledAttributes(ATTRS);
    mDivider = a.getDrawable(0);/* ww w.  j  a  v  a 2s  .  co  m*/
    a.recycle();
    setOrientation(orientation);
}

From source file:de.vanita5.twittnuker.util.ThemeUtils.java

public static Drawable getWindowBackground(final Context context) {
    final TypedArray a = context.obtainStyledAttributes(new int[] { android.R.attr.windowBackground });
    final Drawable d = a.getDrawable(0);
    a.recycle();
    if (isTransparentBackground(context)) {
        applyThemeBackgroundAlphaToDrawable(context, d);
    }//from www  . j  a  v  a  2s .  c  om
    return d;
}

From source file:ca.co.rufus.androidboilerplate.ui.misc.DividerItemDecoration.java

public DividerItemDecoration(Context context, int orientation, float paddingStart, boolean rtl) {
    this.rtl = rtl;

    final TypedArray a = context.obtainStyledAttributes(ATTRS);
    divider = a.getDrawable(0);//from   w  w  w  .  j a  v a  2s . c  o  m
    a.recycle();
    setOrientation(orientation);
    setPaddingStart(paddingStart);
}

From source file:de.vanita5.twittnuker.util.ThemeUtils.java

public static Drawable getWindowContentOverlay(final Context context) {
    final TypedArray a = context.obtainStyledAttributes(new int[] { android.R.attr.windowContentOverlay });
    final Drawable d = a.getDrawable(0);
    a.recycle();
    return d;/*from   www .  j  av a2  s.co  m*/
}

From source file:com.actionbarsherlock.internal.widget.CapitalizingButton.java

public CapitalizingButton(Context context, AttributeSet attrs) {
    super(context, attrs);

    TypedArray a = context.obtainStyledAttributes(attrs, R_styleable_Button);
    mAllCaps = a.getBoolean(R_styleable_Button_textAllCaps, true);
    a.recycle();
}

From source file:de.vanita5.twittnuker.util.ThemeUtils.java

public static boolean isFloatingWindow(final Context context) {

    final TypedArray a = context.obtainStyledAttributes(new int[] { android.R.attr.windowIsFloating });
    final boolean b = a.getBoolean(0, false);
    a.recycle();
    return b;// w w w.  ja  va 2 s.  c o  m
}

From source file:de.vanita5.twittnuker.util.ThemeUtils.java

public static int getCardBackgroundColor(final Context context) {
    final TypedArray a = context.obtainStyledAttributes(new int[] { R.attr.cardItemBackgroundColor });
    final int color = a.getColor(0, Color.TRANSPARENT);
    a.recycle();
    final int themeAlpha = getThemeAlpha(context);
    return themeAlpha << 24 | (0x00FFFFFF & color);
}