Search in sources :

Example 31 with TypedArray

use of android.content.res.TypedArray in project boilerplate by koush.

the class GridRecyclerView method init.

@Override
void init(Context context, AttributeSet attrs, int defStyleAttr) {
    super.init(context, attrs, defStyleAttr);
    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.GridRecyclerView, defStyleAttr, 0);
    int numColumns = a.getInt(R.styleable.GridRecyclerView_numColumns, 1);
    setNumColumns(context, numColumns);
}
Also used : TypedArray(android.content.res.TypedArray)

Example 32 with TypedArray

use of android.content.res.TypedArray in project Shuttle by timusus.

the class MainActivity method onPrepareOptionsMenu.

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    PlaylistUtils.isFavorite(this, MusicUtils.getSong()).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(isFavorite -> {
        if (isFavorite) {
            final MenuItem favItem = menu.findItem(R.id.menu_favorite);
            int[] attrs = new int[] { R.attr.btn_fav_pressed };
            TypedArray ta = obtainStyledAttributes(attrs);
            if (ta != null) {
                Drawable drawableFromTheme = ta.getDrawable(0);
                ta.recycle();
                if (favItem != null) {
                    favItem.setIcon(drawableFromTheme);
                }
            }
        }
    });
    MenuItem whiteListItem = menu.findItem(R.id.whitelist);
    MenuItem sortingItem = menu.findItem(R.id.sort);
    MenuItem viewAsItem = menu.findItem(R.id.view_as);
    if (mSlidingUpPanelLayout == null || !mIsSlidingEnabled || mSlidingUpPanelLayout.getPanelState() != SlidingUpPanelLayout.PanelState.EXPANDED) {
        if (whiteListItem != null) {
            whiteListItem.setVisible(true);
        }
        if (sortingItem != null) {
            sortingItem.setVisible(true);
        }
        if (viewAsItem != null) {
            viewAsItem.setVisible(true);
        }
    } else {
        if (whiteListItem != null) {
            whiteListItem.setVisible(false);
        }
        if (sortingItem != null) {
            sortingItem.setVisible(false);
        }
        if (viewAsItem != null) {
            viewAsItem.setVisible(false);
        }
    }
    if (getCurrentFragment() instanceof DetailFragment) {
        if (sortingItem != null) {
            sortingItem.setVisible(false);
        }
    }
    return super.onPrepareOptionsMenu(menu);
}
Also used : TypedArray(android.content.res.TypedArray) Drawable(android.graphics.drawable.Drawable) MenuItem(android.view.MenuItem) DetailFragment(com.simplecity.amp_library.ui.fragments.DetailFragment)

Example 33 with TypedArray

use of android.content.res.TypedArray in project enroscar by stanfy.

the class ScrollView method init.

private void init(final Context context, final AttributeSet attrs) {
    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.enroscar_ui_ScrollView);
    final boolean frozeSPos = a.getBoolean(enroscar_ui_ScrollView_enroscar_ui_frozeScrollPosition, true);
    a.recycle();
    setFrozeScrollPosition(frozeSPos);
}
Also used : TypedArray(android.content.res.TypedArray)

Example 34 with TypedArray

use of android.content.res.TypedArray in project enroscar by stanfy.

the class CheckableRelativeLayout method init.

private void init(final Context context, final AttributeSet attrs) {
    final TypedArray a = context.obtainStyledAttributes(attrs, CHECKED_ATTRS);
    setChecked(a.getBoolean(0, false));
    a.recycle();
}
Also used : TypedArray(android.content.res.TypedArray)

Example 35 with TypedArray

use of android.content.res.TypedArray in project enroscar by stanfy.

the class HorizontalScrollView method init.

private void init(final Context context, final AttributeSet attrs) {
    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.enroscar_ui_ScrollView);
    final boolean frozeSPos = a.getBoolean(enroscar_ui_HorizontalScrollView_enroscar_ui_frozeScrollPosition, true);
    a.recycle();
    setFrozeScrollPosition(frozeSPos);
}
Also used : TypedArray(android.content.res.TypedArray)

Aggregations

TypedArray (android.content.res.TypedArray)2031 Paint (android.graphics.Paint)193 TypedValue (android.util.TypedValue)190 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)162 Drawable (android.graphics.drawable.Drawable)119 Resources (android.content.res.Resources)118 View (android.view.View)117 Context (android.content.Context)80 XmlResourceParser (android.content.res.XmlResourceParser)80 ColorStateList (android.content.res.ColorStateList)78 AttributeSet (android.util.AttributeSet)78 IOException (java.io.IOException)77 SuppressLint (android.annotation.SuppressLint)66 TextPaint (android.text.TextPaint)63 TextView (android.widget.TextView)63 ViewGroup (android.view.ViewGroup)59 Bundle (android.os.Bundle)48 Point (android.graphics.Point)43 LayoutInflater (android.view.LayoutInflater)42 ImageView (android.widget.ImageView)40