use of android.view.LayoutInflater in project GreenDroid by cyrilmottier.
the class QuickActionBar method populateQuickActions.
@Override
protected void populateQuickActions(List<QuickAction> quickActions) {
mQuickActions = quickActions;
final LayoutInflater inflater = LayoutInflater.from(getContext());
for (QuickAction action : quickActions) {
TextView view = (TextView) inflater.inflate(R.layout.gd_quick_action_bar_item, mQuickActionItems, false);
view.setText(action.mTitle);
view.setCompoundDrawablesWithIntrinsicBounds(null, action.mDrawable, null, null);
view.setOnClickListener(mClickHandlerInternal);
mQuickActionItems.addView(view);
action.mView = new WeakReference<View>(view);
}
}
use of android.view.LayoutInflater in project GreenDroid by cyrilmottier.
the class QuickActionGrid method populateQuickActions.
@Override
protected void populateQuickActions(final List<QuickAction> quickActions) {
mGridView.setAdapter(new BaseAdapter() {
public View getView(int position, View view, ViewGroup parent) {
TextView textView = (TextView) view;
if (view == null) {
final LayoutInflater inflater = LayoutInflater.from(getContext());
textView = (TextView) inflater.inflate(R.layout.gd_quick_action_grid_item, mGridView, false);
}
QuickAction quickAction = quickActions.get(position);
textView.setText(quickAction.mTitle);
textView.setCompoundDrawablesWithIntrinsicBounds(null, quickAction.mDrawable, null, null);
return textView;
}
public long getItemId(int position) {
return position;
}
public Object getItem(int position) {
return null;
}
public int getCount() {
return quickActions.size();
}
});
mGridView.setOnItemClickListener(mInternalItemClickListener);
}
use of android.view.LayoutInflater in project GreenDroid by cyrilmottier.
the class SegmentedBar method addSegment.
/**
* Adds a segment to the SegmentBar. This method automatically adds a
* divider if needed.
*
* @param title The title of the segment to add.
*/
public void addSegment(String title) {
final Context context = getContext();
final LayoutInflater inflater = LayoutInflater.from(context);
/*
* First of all, we have to check whether or not we need to add a
* divider. A divider is added when there is at least one segment
*/
if (mDividerDrawable != null && getSegmentCount() > 0) {
ImageView divider = new ImageView(context);
final int width = (mDividerWidth > 0) ? mDividerWidth : mDividerDrawable.getIntrinsicWidth();
final LinearLayout.LayoutParams lp = new LayoutParams(width, LayoutParams.FILL_PARENT);
lp.setMargins(0, 0, 0, 0);
divider.setLayoutParams(lp);
divider.setBackgroundDrawable(mDividerDrawable);
addView(divider);
}
CheckBox segment = (CheckBox) inflater.inflate(R.layout.gd_segment, this, false);
segment.setText(title);
segment.setClickable(true);
segment.setFocusable(true);
segment.setOnFocusChangeListener(this);
segment.setOnCheckedChangeListener(new SegmentCheckedListener(getSegmentCount()));
segment.setOnClickListener(new SegmentClickedListener(getSegmentCount()));
addView(segment);
}
use of android.view.LayoutInflater in project FlexibleAdapter by davideas.
the class FastScroller method setViewsToUse.
/**
* Layout customization.<br/>
* Color for Selected State is the color defined inside the Drawables.
*
* @param layoutResId Main layout of Fast Scroller
* @param bubbleResId Drawable resource for Bubble containing the Text
* @param handleResId Drawable resource for the Handle
*/
public void setViewsToUse(@LayoutRes int layoutResId, @IdRes int bubbleResId, @IdRes int handleResId) {
//Already inflated
if (bubble != null)
return;
LayoutInflater inflater = LayoutInflater.from(getContext());
inflater.inflate(layoutResId, this, true);
bubble = (TextView) findViewById(bubbleResId);
if (bubble != null)
bubble.setVisibility(INVISIBLE);
handle = (ImageView) findViewById(handleResId);
}
use of android.view.LayoutInflater in project Libraries-for-Android-Developers by eoecn.
the class ActionBarContextView method initTitle.
private void initTitle() {
if (mTitleLayout == null) {
LayoutInflater inflater = LayoutInflater.from(getContext());
inflater.inflate(R.layout.abs__action_bar_title_item, this);
mTitleLayout = (LinearLayout) getChildAt(getChildCount() - 1);
mTitleView = (TextView) mTitleLayout.findViewById(R.id.abs__action_bar_title);
mSubtitleView = (TextView) mTitleLayout.findViewById(R.id.abs__action_bar_subtitle);
if (mTitleStyleRes != 0) {
mTitleView.setTextAppearance(mContext, mTitleStyleRes);
}
if (mSubtitleStyleRes != 0) {
mSubtitleView.setTextAppearance(mContext, mSubtitleStyleRes);
}
}
mTitleView.setText(mTitle);
mSubtitleView.setText(mSubtitle);
final boolean hasTitle = !TextUtils.isEmpty(mTitle);
final boolean hasSubtitle = !TextUtils.isEmpty(mSubtitle);
mSubtitleView.setVisibility(hasSubtitle ? VISIBLE : GONE);
mTitleLayout.setVisibility(hasTitle || hasSubtitle ? VISIBLE : GONE);
if (mTitleLayout.getParent() == null) {
addView(mTitleLayout);
}
}
Aggregations