Search in sources :

Example 11 with LayoutInflater

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;
}
Also used : Switch(org.holoeverywhere.widget.Switch) LayoutInflater(org.holoeverywhere.LayoutInflater) MenuItem(android.view.MenuItem) ActionBarView(android.support.v7.internal.widget.ActionBarView) TextView(android.widget.TextView) View(android.view.View) SuppressLint(android.annotation.SuppressLint)

Example 12 with LayoutInflater

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);
    }
}
Also used : LayoutInflater(org.holoeverywhere.LayoutInflater)

Example 13 with LayoutInflater

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);
    }
}
Also used : ViewGroup(android.view.ViewGroup) LayoutInflater(org.holoeverywhere.LayoutInflater) ActionMenuView(android.support.v7.internal.view.menu.ActionMenuView) TextView(org.holoeverywhere.widget.TextView) View(android.view.View) MenuBuilder(android.support.v7.internal.view.menu.MenuBuilder) ActionMenuPresenter(android.support.v7.internal.view.menu.ActionMenuPresenter)

Example 14 with LayoutInflater

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);
}
Also used : LayoutInflater(org.holoeverywhere.LayoutInflater)

Example 15 with LayoutInflater

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);
}
Also used : LayoutInflater(org.holoeverywhere.LayoutInflater) View(android.view.View) LinearLayout(org.holoeverywhere.widget.LinearLayout)

Aggregations

LayoutInflater (org.holoeverywhere.LayoutInflater)15 View (android.view.View)8 ViewGroup (android.view.ViewGroup)6 ImageView (android.widget.ImageView)3 TextView (android.widget.TextView)3 SuppressLint (android.annotation.SuppressLint)2 LinearLayout (org.holoeverywhere.widget.LinearLayout)2 Context (android.content.Context)1 ActionMenuPresenter (android.support.v7.internal.view.menu.ActionMenuPresenter)1 ActionMenuView (android.support.v7.internal.view.menu.ActionMenuView)1 MenuBuilder (android.support.v7.internal.view.menu.MenuBuilder)1 ActionBarView (android.support.v7.internal.widget.ActionBarView)1 MenuItem (android.view.MenuItem)1 ViewParent (android.view.ViewParent)1 AdapterView (android.widget.AdapterView)1 LayoutParams (android.widget.LinearLayout.LayoutParams)1 ActionBarView (com.actionbarsherlock.internal.widget.ActionBarView)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Dialog (org.holoeverywhere.app.Dialog)1