Example usage for android.app Activity obtainStyledAttributes

List of usage examples for android.app Activity obtainStyledAttributes

Introduction

In this page you can find the example usage for android.app Activity obtainStyledAttributes.

Prototype

public final TypedArray obtainStyledAttributes(AttributeSet set, @StyleableRes int[] attrs,
        @AttrRes int defStyleAttr, @StyleRes int defStyleRes) 

Source Link

Document

Retrieve styled attribute information in this Context's theme.

Usage

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

public static void overrideNormalActivityCloseAnimation(final Activity activity) {
    final TypedArray a = activity.obtainStyledAttributes(null, ANIM_CLOSE_STYLE_ATTRS, 0,
            android.R.style.Animation_Activity);
    final int activityCloseEnterAnimation = a.getResourceId(0, 0);
    final int activityCloseExitAnimation = a.getResourceId(1, 0);
    a.recycle();/*from w w w.ja v  a  2  s. c om*/
    activity.overridePendingTransition(activityCloseEnterAnimation, activityCloseExitAnimation);
}

From source file:org.mariotaku.twidere.util.ThemeUtils.java

public static void overrideNormalActivityCloseAnimation(final Activity activity) {
    @SuppressWarnings("ConstantConditions")
    final TypedArray a = activity.obtainStyledAttributes(null, ANIM_CLOSE_STYLE_ATTRS, 0,
            android.R.style.Animation_Activity);
    final int activityCloseEnterAnimation = a.getResourceId(0, 0);
    final int activityCloseExitAnimation = a.getResourceId(1, 0);
    a.recycle();//from  w  w  w  .j a  v a 2s.  c om
    activity.overridePendingTransition(activityCloseEnterAnimation, activityCloseExitAnimation);
}

From source file:com.chrismorais.android.sunshine.app.ForecastFragment.java

@Override
public void onInflate(Activity activity, AttributeSet attrs, Bundle savedInstanceState) {
    super.onInflate(activity, attrs, savedInstanceState);
    TypedArray a = activity.obtainStyledAttributes(attrs, R.styleable.ForecastFragment, 0, 0);
    mChoiceMode = a.getInt(R.styleable.ForecastFragment_android_choiceMode, AbsListView.CHOICE_MODE_NONE);
    mAutoSelectView = a.getBoolean(R.styleable.ForecastFragment_autoSelectView, false);
    a.recycle();//from   ww  w . ja  v  a  2 s.c  om
}

From source file:com.alboteanu.android.sunshine.app.ForecastFragment.java

@Override
public void onInflate(Activity activity, AttributeSet attrs, Bundle savedInstanceState) {
    super.onInflate(activity, attrs, savedInstanceState);
    TypedArray a = activity.obtainStyledAttributes(attrs, R.styleable.ForecastFragment, 0, 0);
    mChoiceMode = a.getInt(R.styleable.ForecastFragment_android_choiceMode, AbsListView.CHOICE_MODE_NONE);
    mAutoSelectView = a.getBoolean(R.styleable.ForecastFragment_autoSelectView, false);
    mHoldForTransition = a.getBoolean(R.styleable.ForecastFragment_sharedElementTransitions, false);
    a.recycle();//  w  w  w.  j a  v  a  2  s. c  o m
}