Search in sources :

Example 1 with LayoutInflater

use of org.holoeverywhere.LayoutInflater in project HoloEverywhere by Prototik.

the class ActionBarActivityDelegateBase method setContentView.

@Override
public void setContentView(int resId) {
    ensureSubDecor();
    if (mHasActionBar) {
        final ViewGroup contentParent = (ViewGroup) mActivity.findViewById(R.id.action_bar_activity_content);
        contentParent.removeAllViews();
        final LayoutInflater inflater = LayoutInflater.from(mActivity);
        inflater.inflate(resId, contentParent);
    } else {
        mActivity.superSetContentView(resId);
    }
}
Also used : ViewGroup(android.view.ViewGroup) LayoutInflater(org.holoeverywhere.LayoutInflater)

Example 2 with LayoutInflater

use of org.holoeverywhere.LayoutInflater in project HoloEverywhere by Prototik.

the class Preference method onCreateView.

protected View onCreateView(ViewGroup parent) {
    final LayoutInflater layoutInflater = LayoutInflater.from(mContext);
    final View layout = layoutInflater.inflate(mLayoutResId, parent, false);
    final ViewGroup widgetFrame = (ViewGroup) layout.findViewById(R.id.widget_frame);
    if (widgetFrame != null) {
        if (mWidgetLayoutResId != 0) {
            layoutInflater.inflate(mWidgetLayoutResId, widgetFrame);
        } else {
            widgetFrame.setVisibility(View.GONE);
        }
    }
    return layout;
}
Also used : ViewGroup(android.view.ViewGroup) LayoutInflater(org.holoeverywhere.LayoutInflater) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View)

Example 3 with LayoutInflater

use of org.holoeverywhere.LayoutInflater in project HoloEverywhere by Prototik.

the class ActionBarView method initTitle.

private void initTitle() {
    if (mTitleLayout == null) {
        LayoutInflater inflater = LayoutInflater.from(getContext());
        mTitleLayout = (LinearLayout) inflater.inflate(R.layout.abc_action_bar_title_item, this, false);
        mTitleView = (TextView) mTitleLayout.findViewById(R.id.action_bar_title);
        mSubtitleView = (TextView) mTitleLayout.findViewById(R.id.action_bar_subtitle);
        mTitleUpView = (View) mTitleLayout.findViewById(R.id.up);
        mTitleLayout.setOnClickListener(mUpClickListener);
        if (mTitleStyleRes != 0) {
            mTitleView.setTextAppearance(mContext, mTitleStyleRes);
        }
        if (mTitle != null) {
            mTitleView.setText(mTitle);
        }
        if (mSubtitleStyleRes != 0) {
            mSubtitleView.setTextAppearance(mContext, mSubtitleStyleRes);
        }
        if (mSubtitle != null) {
            mSubtitleView.setText(mSubtitle);
            mSubtitleView.setVisibility(VISIBLE);
        }
        final boolean homeAsUp = (mDisplayOptions & ActionBar.DISPLAY_HOME_AS_UP) != 0;
        final boolean showHome = (mDisplayOptions & ActionBar.DISPLAY_SHOW_HOME) != 0;
        mTitleUpView.setVisibility(!showHome ? (homeAsUp ? VISIBLE : INVISIBLE) : GONE);
        mTitleLayout.setEnabled(homeAsUp && !showHome);
    }
    addView(mTitleLayout);
    if (mExpandedActionView != null || (TextUtils.isEmpty(mTitle) && TextUtils.isEmpty(mSubtitle))) {
        // Don't show while in expanded mode or with empty text
        mTitleLayout.setVisibility(GONE);
    }
}
Also used : LayoutInflater(org.holoeverywhere.LayoutInflater)

Example 4 with LayoutInflater

use of org.holoeverywhere.LayoutInflater in project mobile-android by photo.

the class ImageFlowUtils method getSingleImageView.

protected View getSingleImageView(View convertView, T value, int imageHeight, int extraWidth, int layoutId, int imageViewId, Context context) {
    View view;
    ViewHolder viewHolder;
    if (convertView == null) {
        // if it's not recycled, instantiate and
        // initialize
        CommonUtils.debug(TAG, "Creating new view for child");
        final LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        view = layoutInflater.inflate(layoutId, null);
        viewHolder = creatViewHolder(view);
        viewHolder.mImageView = (ImageView) view.findViewById(imageViewId);
        view.setTag(viewHolder);
    } else {
        // Otherwise re-use the converted view
        view = convertView;
        viewHolder = (ViewHolder) view.getTag();
    }
    float ratio = getRatio(value);
    int height = imageHeight;
    int width = (int) (ratio * height) + extraWidth;
    CommonUtils.debug(TAG, "getSingleImageView: processing image: " + value + "; Width: " + getWidth(value) + "; Height: " + getHeight(value) + "; Extra width: " + extraWidth + "; Req Width: " + width + "; Req Height: " + height);
    width = width + 2 * borderSize;
    height = height + 2 * borderSize;
    LinearLayout.LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
    if (layoutParams == null || layoutParams.width != width || layoutParams.height != height) {
        layoutParams = new LinearLayout.LayoutParams(width, height);
        view.setLayoutParams(layoutParams);
    }
    additionalSingleImageViewInit(view, value);
    ImageView imageView = viewHolder.mImageView;
    // Finally load the image asynchronously into the ImageView, this
    // also takes care of
    // setting a placeholder image while the background thread runs
    loadImage(value, imageView);
    return view;
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) LayoutParams(android.widget.LinearLayout.LayoutParams) LayoutInflater(org.holoeverywhere.LayoutInflater) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) View(android.view.View) LinearLayout(org.holoeverywhere.widget.LinearLayout)

Example 5 with LayoutInflater

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

the class HoloListMenuItemView method insertIconView.

private void insertIconView() {
    LayoutInflater inflater = getInflater();
    mIconView = (ImageView) inflater.inflate(R.layout.list_menu_item_icon, this, false);
    addView(mIconView, 0);
}
Also used : LayoutInflater(org.holoeverywhere.LayoutInflater)

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