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:de.vanita5.twittnuker.util.ThemeUtils.java

public static int getColorBackgroundCacheHint(final Context context) {
    final TypedArray a = context.obtainStyledAttributes(new int[] { android.R.attr.colorBackgroundCacheHint });
    final int color = a.getColor(0, Color.TRANSPARENT);
    a.recycle();
    return color;
}

From source file:cn.ieclipse.af.view.ViewPagerV4.java

private void init(Context context, AttributeSet attrs) {
    if (attrs != null) {
        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ViewPagerV4);
        disableWipe = a.getBoolean(R.styleable.ViewPagerV4_disableWipe, false);

        a.recycle();
    }/*w ww  .j a  va2s .  c o  m*/

}

From source file:com.ahamed.multiviewadapter.util.SimpleDividerDecoration.java

public SimpleDividerDecoration(Context context, int orientation) {
    final TypedArray a = context.obtainStyledAttributes(ATTRS);
    mDivider = a.getDrawable(0);//w  w w . j a v a2  s  . c o m
    a.recycle();
    setOrientation(orientation);
}

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

public CapitalizingTextView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    TypedArray a = context.obtainStyledAttributes(attrs, R_styleable_TextView, defStyle, 0);
    mAllCaps = a.getBoolean(R_styleable_TextView_textAllCaps, true);
    a.recycle();
}

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

public static void overrideActivityCloseAnimation(final Activity activity) {
    TypedArray a = activity.obtainStyledAttributes(new int[] { android.R.attr.windowAnimationStyle });
    final int windowAnimationStyleResId = a.getResourceId(0, 0);
    a.recycle();
    // Now retrieve the resource ids of the actual animations used in the
    // animation style pointed to by
    // the window animation resource id.
    a = activity.obtainStyledAttributes(windowAnimationStyleResId, ANIM_CLOSE_STYLE_ATTRS);
    final int activityCloseEnterAnimation = a.getResourceId(0, 0);
    final int activityCloseExitAnimation = a.getResourceId(1, 0);
    a.recycle();//  w  w w.  j  a  va 2  s  .c o m
    activity.overridePendingTransition(activityCloseEnterAnimation, activityCloseExitAnimation);
}

From source file:android.tumb.com.tumb.Misc.DividerItemDecoration.java

public DividerItemDecoration(Context context) {
    final TypedArray styledAttributes = context.obtainStyledAttributes(ATTRS);
    mDivider = ContextCompat.getDrawable(context, R.drawable.question_recycler_decorator);
    styledAttributes.recycle();
}

From source file:cc.solart.turbo.decoration.LinearDividerItemDecoration.java

private void resolveDivider(Context context) {
    final TypedArray a = context.obtainStyledAttributes(ATTRS);
    mDivider = a.getDrawable(0);/*from  w ww.  j  a v  a2  s  .co m*/
    a.recycle();
}

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

public static int getThemeBackgroundColor(final Context context) {
    final TypedArray a = context.obtainStyledAttributes(new int[] { android.R.attr.colorBackground });
    try {//w  w  w.j  a  va2 s .  c o  m
        return a.getColor(0, 0);
    } finally {
        a.recycle();
    }
}

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

public static void overrideActivityOpenAnimation(final Activity activity) {

    TypedArray a = activity.obtainStyledAttributes(new int[] { android.R.attr.windowAnimationStyle });
    final int windowAnimationStyleResId = a.getResourceId(0, 0);
    a.recycle();
    // Now retrieve the resource ids of the actual animations used in the
    // animation style pointed to by
    // the window animation resource id.
    a = activity.obtainStyledAttributes(windowAnimationStyleResId, ANIM_OPEN_STYLE_ATTRS);
    final int activityOpenEnterAnimation = a.getResourceId(0, 0);
    final int activityOpenExitAnimation = a.getResourceId(1, 0);
    a.recycle();/*from  w  w  w .java2s  .com*/
    activity.overridePendingTransition(activityOpenEnterAnimation, activityOpenExitAnimation);
}

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

public static int getThemeForegroundColor(final Context context, int theme) {
    final Context wrapped = theme != 0 ? new ContextThemeWrapper(context, theme) : context;
    final TypedArray a = wrapped.obtainStyledAttributes(new int[] { android.R.attr.colorForeground });
    try {//from  w ww. j  av  a2  s  .com
        return a.getColor(0, 0);
    } finally {
        a.recycle();
    }
}