Search in sources :

Example 1 with LinearLayout

use of org.holoeverywhere.widget.LinearLayout in project HoloEverywhere by Prototik.

the class ActionBarView method setNavigationMode.

public void setNavigationMode(int mode) {
    final int oldMode = mNavigationMode;
    if (mode != oldMode) {
        switch(oldMode) {
            case ActionBar.NAVIGATION_MODE_LIST:
                if (mListNavLayout != null) {
                    removeView(mListNavLayout);
                }
                break;
            case ActionBar.NAVIGATION_MODE_TABS:
                if (mTabScrollView != null && mIncludeTabs) {
                    removeView(mTabScrollView);
                }
        }
        switch(mode) {
            case ActionBar.NAVIGATION_MODE_LIST:
                if (mSpinner == null) {
                    mSpinner = new Spinner(mContext, null, R.attr.actionDropDownStyle);
                    mListNavLayout = (LinearLayout) LayoutInflater.from(mContext).inflate(R.layout.abc_action_bar_view_list_nav_layout, null);
                    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT);
                    params.gravity = Gravity.CENTER;
                    mListNavLayout.addView(mSpinner, params);
                }
                if (mSpinner.getAdapter() != mSpinnerAdapter) {
                    mSpinner.setAdapter(mSpinnerAdapter);
                }
                mSpinner.setOnItemSelectedListener(mNavItemSelectedListener);
                addView(mListNavLayout);
                break;
            case ActionBar.NAVIGATION_MODE_TABS:
                if (mTabScrollView != null && mIncludeTabs) {
                    addView(mTabScrollView);
                }
                break;
        }
        mNavigationMode = mode;
        requestLayout();
    }
}
Also used : Spinner(org.holoeverywhere.widget.Spinner) LinearLayout(org.holoeverywhere.widget.LinearLayout)

Example 2 with LinearLayout

use of org.holoeverywhere.widget.LinearLayout in project little-bear-dictionary by daimajia.

the class AlertController method setupView.

private void setupView() {
    LinearLayout contentPanel = (LinearLayout) mWindow.findViewById(R.id.contentPanel);
    setupContent(contentPanel);
    boolean hasButtons = setupButtons();
    LinearLayout topPanel = (LinearLayout) mWindow.findViewById(R.id.topPanel);
    TypedArray a = mContext.obtainStyledAttributes(null, R.styleable.AlertDialog, R.attr.alertDialogStyle, R.style.Holo_AlertDialog);
    boolean hasTitle = setupTitle(topPanel);
    View buttonPanel = mWindow.findViewById(R.id.buttonPanel);
    if (!hasButtons) {
        buttonPanel.setVisibility(View.GONE);
    // mWindow.setCloseOnTouchOutsideIfNotSet(true);
    }
    FrameLayout customPanel = null;
    if (mView != null) {
        customPanel = (FrameLayout) mWindow.findViewById(R.id.customPanel);
        FrameLayout custom = (FrameLayout) mWindow.findViewById(R.id.custom);
        custom.addView(mView, new LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT));
        if (mViewSpacingSpecified) {
            custom.setPadding(mViewSpacingLeft, mViewSpacingTop, mViewSpacingRight, mViewSpacingBottom);
        }
        if (mListView != null) {
            ((LinearLayout.LayoutParams) customPanel.getLayoutParams()).weight = 0;
        }
    } else {
        mWindow.findViewById(R.id.customPanel).setVisibility(View.GONE);
    }
    if (hasTitle) {
        View divider = null;
        if (mMessage != null || mView != null || mListView != null) {
            divider = mWindow.findViewById(R.id.titleDivider);
        } else {
            divider = mWindow.findViewById(R.id.titleDividerTop);
        }
        if (divider != null) {
            divider.setVisibility(View.VISIBLE);
        }
    }
    setBackground(topPanel, contentPanel, customPanel, hasButtons, a, hasTitle, buttonPanel);
    a.recycle();
}
Also used : LayoutParams(android.widget.FrameLayout.LayoutParams) TypedArray(android.content.res.TypedArray) FrameLayout(android.widget.FrameLayout) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(org.holoeverywhere.widget.ListView) AbsListView(android.widget.AbsListView) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) CheckedTextView(android.widget.CheckedTextView) LinearLayout(org.holoeverywhere.widget.LinearLayout)

Example 3 with LinearLayout

use of org.holoeverywhere.widget.LinearLayout in project little-bear-dictionary by daimajia.

the class AlertController method setupTitle.

private boolean setupTitle(LinearLayout topPanel) {
    boolean hasTitle = true;
    if (mCustomTitleView != null) {
        LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        topPanel.addView(mCustomTitleView, 0, lp);
        View titleTemplate = mWindow.findViewById(R.id.title_template);
        titleTemplate.setVisibility(View.GONE);
    } else {
        final boolean hasTextTitle = !TextUtils.isEmpty(mTitle);
        mIconView = (ImageView) mWindow.findViewById(R.id.icon);
        if (hasTextTitle) {
            mTitleView = (TextView) mWindow.findViewById(R.id.alertTitle);
            mTitleView.setText(mTitle);
            if (mIconId > 0) {
                mIconView.setImageResource(mIconId);
            } else if (mIcon != null) {
                mIconView.setImageDrawable(mIcon);
            } else if (mIconId == 0) {
                mTitleView.setPadding(mIconView.getPaddingLeft(), mIconView.getPaddingTop(), mIconView.getPaddingRight(), mIconView.getPaddingBottom());
                mIconView.setVisibility(View.GONE);
            }
        } else {
            View titleTemplate = mWindow.findViewById(R.id.title_template);
            titleTemplate.setVisibility(View.GONE);
            mIconView.setVisibility(View.GONE);
            topPanel.setVisibility(View.GONE);
            hasTitle = false;
        }
    }
    return hasTitle;
}
Also used : LayoutParams(android.widget.FrameLayout.LayoutParams) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(org.holoeverywhere.widget.ListView) AbsListView(android.widget.AbsListView) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) CheckedTextView(android.widget.CheckedTextView) LinearLayout(org.holoeverywhere.widget.LinearLayout)

Example 4 with LinearLayout

use of org.holoeverywhere.widget.LinearLayout 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

LinearLayout (org.holoeverywhere.widget.LinearLayout)4 View (android.view.View)3 AbsListView (android.widget.AbsListView)2 AdapterView (android.widget.AdapterView)2 CheckedTextView (android.widget.CheckedTextView)2 LayoutParams (android.widget.FrameLayout.LayoutParams)2 ImageView (android.widget.ImageView)2 ScrollView (android.widget.ScrollView)2 TextView (android.widget.TextView)2 ListView (org.holoeverywhere.widget.ListView)2 TypedArray (android.content.res.TypedArray)1 FrameLayout (android.widget.FrameLayout)1 LayoutInflater (org.holoeverywhere.LayoutInflater)1 Spinner (org.holoeverywhere.widget.Spinner)1