use of org.holoeverywhere.LayoutInflater in project HoloEverywhere by Prototik.
the class SwitchScreenPreference method onCreateOptionsMenu.
@Override
boolean onCreateOptionsMenu(Menu menu) {
final MenuItem item = menu.add(Menu.NONE, android.R.id.button1, Menu.NONE, "");
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
int theme = ThemeManager.getThemeType(getDialog().getContext());
if (theme != ThemeManager.LIGHT) {
theme = ThemeManager.DARK;
}
LayoutInflater inflater = LayoutInflater.from(getDialog().getContext(), theme | PreferenceInit.THEME_FLAG);
View actionView = inflater.inflate(R.layout.preference_widget_switch_screen_bar);
Switch switchView = (Switch) actionView.findViewById(R.id.switchWidget);
switchView.setChecked(mChecked);
switchView.setTextOn(mSwitchOn);
switchView.setTextOff(mSwitchOff);
switchView.setOnCheckedChangeListener(mListener);
MenuItemCompat.setActionView(item, actionView);
return true;
}
use of org.holoeverywhere.LayoutInflater in project HoloEverywhere by Prototik.
the class ActionBarContextView method initTitle.
private void initTitle() {
if (mTitleLayout == null) {
LayoutInflater inflater = LayoutInflater.from(getContext());
inflater.inflate(R.layout.abc_action_bar_title_item, this);
mTitleLayout = (LinearLayout) getChildAt(getChildCount() - 1);
mTitleView = (TextView) mTitleLayout.findViewById(R.id.action_bar_title);
mSubtitleView = (TextView) mTitleLayout.findViewById(R.id.action_bar_subtitle);
if (mTitleStyleRes != 0) {
mTitleView.setTextAppearance(getContext(), mTitleStyleRes);
}
if (mSubtitleStyleRes != 0) {
mSubtitleView.setTextAppearance(getContext(), 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);
}
}
use of org.holoeverywhere.LayoutInflater in project HoloEverywhere by Prototik.
the class ActionBarContextView method initForMode.
public void initForMode(final ActionMode mode) {
if (mClose == null) {
LayoutInflater inflater = LayoutInflater.from(getContext());
mClose = inflater.inflate(R.layout.abc_action_mode_close_item, this, false);
addView(mClose);
} else if (mClose.getParent() == null) {
addView(mClose);
}
View closeButton = mClose.findViewById(R.id.action_mode_close_button);
closeButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
mode.finish();
}
});
final MenuBuilder menu = (MenuBuilder) mode.getMenu();
if (mActionMenuPresenter != null) {
mActionMenuPresenter.dismissPopupMenus();
}
mActionMenuPresenter = new ActionMenuPresenter(getContext());
mActionMenuPresenter.setReserveOverflow(true);
final ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.FILL_PARENT);
if (!mSplitActionBar) {
menu.addMenuPresenter(mActionMenuPresenter);
mMenuView = (ActionMenuView) mActionMenuPresenter.getMenuView(this);
mMenuView.setBackgroundDrawable(null);
addView(mMenuView, layoutParams);
} else {
// Allow full screen width in split mode.
mActionMenuPresenter.setWidthLimit(getContext().getResources().getDisplayMetrics().widthPixels, true);
// No limit to the item count; use whatever will fit.
mActionMenuPresenter.setItemLimit(Integer.MAX_VALUE);
// Span the whole width
layoutParams.width = ViewGroup.LayoutParams.FILL_PARENT;
layoutParams.height = mContentHeight;
menu.addMenuPresenter(mActionMenuPresenter);
mMenuView = (ActionMenuView) mActionMenuPresenter.getMenuView(this);
mMenuView.setBackgroundDrawable(mSplitBackground);
mSplitView.addView(mMenuView, layoutParams);
}
}
use of org.holoeverywhere.LayoutInflater in project little-bear-dictionary by daimajia.
the class HoloListMenuItemView method insertCheckBox.
private void insertCheckBox() {
LayoutInflater inflater = getInflater();
mCheckBox = (CheckBox) inflater.inflate(R.layout.list_menu_item_checkbox, this, false);
addView(mCheckBox);
}
use of org.holoeverywhere.LayoutInflater in project little-bear-dictionary by daimajia.
the class ColorPickerDialog method setUp.
private void setUp(int color) {
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.dialog_color_picker, null);
setContentView(layout);
setTitle(R.string.dialog_color_picker);
mColorPicker = (ColorPickerView) layout.findViewById(R.id.color_picker_view);
mOldColor = (ColorPickerPanelView) layout.findViewById(R.id.old_color_panel);
mNewColor = (ColorPickerPanelView) layout.findViewById(R.id.new_color_panel);
((LinearLayout) mOldColor.getParent()).setPadding(Math.round(mColorPicker.getDrawingOffset()), 0, Math.round(mColorPicker.getDrawingOffset()), 0);
mOldColor.setOnClickListener(this);
mNewColor.setOnClickListener(this);
mColorPicker.setOnColorChangedListener(this);
mOldColor.setColor(color);
mColorPicker.setColor(color, true);
}
Aggregations