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);
}
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);
}
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);
}
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();
}
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);
}
Aggregations