Example usage for android.content Context LAYOUT_INFLATER_SERVICE

List of usage examples for android.content Context LAYOUT_INFLATER_SERVICE

Introduction

In this page you can find the example usage for android.content Context LAYOUT_INFLATER_SERVICE.

Prototype

String LAYOUT_INFLATER_SERVICE

To view the source code for android.content Context LAYOUT_INFLATER_SERVICE.

Click Source Link

Document

Use with #getSystemService(String) to retrieve a android.view.LayoutInflater for inflating layout resources in this context.

Usage

From source file:com.spoiledmilk.ibikecph.favorites.FavoritesAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    final View view = inflater.inflate(getListRowLayout(), parent, false);
    TextView tv = (TextView) view.findViewById(R.id.textFavoriteName);
    String name = getItem(position).getName();
    if (name.length() > 19)
        name = name.substring(0, 19) + "...";
    tv.setText(name);/*ww  w  .ja v a2s.  co  m*/
    tv.setTypeface(IbikeApplication.getNormalFont());
    tv.setTextColor(getTextColor());
    ImageButton btnEdit = (ImageButton) view.findViewById(R.id.btnEdit);
    final FavoritesData fd = getItem(position);
    tv.setPadding(getPadding(fd), 0, 0, 0);
    btnEdit.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            fragment.onEditFavorite(fd);
        }

    });

    final ImageView imgIcon = ((ImageView) view.findViewById(R.id.icon));

    if (!isEditMode) {
        imgIcon.setImageResource(getIconResourceId(getItem(position)));
        btnEdit.setVisibility(View.GONE);
    } else {
        imgIcon.setImageResource(R.drawable.fav_reorder);
        btnEdit.setVisibility(View.VISIBLE);
    }

    return view;
}

From source file:ca.rmen.android.scrumchatter.member.list.MembersCursorAdapter.java

@Override
public View newView(Context context, Cursor cursor, ViewGroup viewGroup) {
    LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = layoutInflater.inflate(R.layout.member_list_item, null);
    return view;/*from   ww w  .  ja v a  2  s .c  o m*/
}

From source file:com.hybris.mobile.adapter.CartAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    Object cartItem = items.get(position);
    View rowView = null;/*from   w w  w . jav a 2 s.c  o m*/

    if (cartItem instanceof CartEntry) {
        CartEntry cartEntry = (CartEntry) cartItem;

        rowView = inflater.inflate(R.layout.cart_row, parent, false);

        TextView lblProductTitle = (TextView) rowView.findViewById(R.id.lbl_product_title);
        TextView lblProductPrice = (TextView) rowView.findViewById(R.id.lbl_price_quantity);
        TextView lblManufacturer = (TextView) rowView.findViewById(R.id.lbl_productManufacturer);
        TextView lblTotal = (TextView) rowView.findViewById(R.id.lbl_total);
        ImageView productImage = (ImageView) rowView.findViewById(R.id.img_product);

        if (StringUtils.isEmpty(cartEntry.getProduct().getManufacturer())) {
            lblManufacturer.setHeight(0);
        } else {
            lblManufacturer.setText(cartEntry.getProduct().getManufacturer());
        }
        lblProductTitle.setText(cartEntry.getProduct().getName());
        lblProductPrice.setText(cartEntry.getBasePrice().getFormattedValue() + " - "
                + this.getContext().getString(R.string.cartentry_quantity_placeholder)
                + cartEntry.getQuantity().toString());
        lblManufacturer.setText(cartEntry.getProduct().getManufacturer());

        lblTotal.setText(cartEntry.getTotalPrice().getFormattedValue());
        UrlImageViewHelper.setUrlDrawable(productImage, cartEntry.getProduct().getThumbnail(),
                R.drawable.loading_drawable);
    }
    // Promotions
    else if (cartItem instanceof CartPromotion) {
        CartPromotion cartPromotion = (CartPromotion) cartItem;

        rowView = inflater.inflate(R.layout.promotion_row, parent, false);

        // Update promotions section
        TextView promotionsTextView = (TextView) rowView.findViewById(R.id.textView);
        promotionsTextView.setMovementMethod(LinkMovementMethod.getInstance());

        promotionsTextView.setText(Html.fromHtml(Cart.generatePromotionString(cartPromotion)));
        StringUtil.removeUnderlines((Spannable) promotionsTextView.getText());
    }

    return rowView;
}

From source file:com.granita.tasks.utils.TasksListCursorAdapter.java

public TasksListCursorAdapter(Context context) {
    super(context, null, 0 /* don't register a content observer to avoid a context leak! */);
    mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}

From source file:at.wada811.android.library.demos.loader.LoaderListAdapter.java

public LoaderListAdapter(Context context, LoaderManager loaderManager) {
    super(context, android.R.layout.simple_list_item_1);
    mContext = context;// w  w w .  ja v a  2 s . c om
    mLayoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    mLoaderManager = loaderManager;
    mHandler = new Handler();
    mLoaderIds = new SparseIntArray();
}

From source file:com.hybris.mobile.app.commerce.adapter.ProductItemsAdapterBase.java

public ProductItemsAdapterBase(Context context, Cursor c, int flags,
        ContentServiceHelper contentServiceHelper) {
    super(context, c, flags, contentServiceHelper);
    mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}

From source file:net.olejon.mdapp.LvhCategoriesAdapter.java

public LvhCategoriesAdapter(Context context, JSONArray jsonArray, String color, String icon) {
    mContext = context;// ww w  .  j a  v  a 2s .  com

    mLayoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    mCategories = jsonArray;

    mColor = color;
    mIcon = icon;
}

From source file:com.linkedin.android.eventsapp.AttendeeAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View rowView = inflater.inflate(R.layout.attendee_list_item, parent, false);
    TextView attendeeNameView = (TextView) rowView.findViewById(R.id.attendeeName);
    final TextView attendeeHeadlineView = (TextView) rowView.findViewById(R.id.attendeeHeadline);
    final ImageView attendeeImageView = (ImageView) rowView.findViewById(R.id.attendeeImage);

    Person attendee = attendees[position];
    attendeeNameView.setText(attendee.getFirstName() + " " + attendee.getLastName());

    boolean isAccessTokenValid = LISessionManager.getInstance(context).getSession().isValid();
    if (isAccessTokenValid) {
        String url = Constants.personByIdBaseUrl + attendee.getLinkedinId() + Constants.personProjection;
        //LISession liSession = LISessionManager.getInstance(context).getSession()
        APIHelper.getInstance(context).getRequest(context, url, new ApiListener() {
            @Override/*from www .j  a  v  a  2  s. c  o m*/
            public void onApiSuccess(ApiResponse apiResponse) {
                try {
                    JSONObject dataAsJson = apiResponse.getResponseDataAsJson();
                    String headline = dataAsJson.has("headline") ? dataAsJson.getString("headline") : "";
                    String pictureUrl = dataAsJson.has("pictureUrl") ? dataAsJson.getString("pictureUrl")
                            : null;
                    JSONObject location = dataAsJson.getJSONObject("location");

                    attendeeHeadlineView.setText(headline);
                    if (pictureUrl != null) {
                        new com.linkedin.android.eventsapp.FetchImageTask(attendeeImageView)
                                .execute(pictureUrl);
                    } else {
                        attendeeImageView.setImageResource(R.drawable.ghost_person);
                    }
                } catch (JSONException e) {

                }

            }

            @Override
            public void onApiError(LIApiError apiError) {

            }
        });
    } else {
        attendeeImageView.setImageResource(R.drawable.ghost_person);
    }

    return rowView;
}

From source file:com.github.michalbednarski.intentslab.ReceiveBroadcastDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Context context = getActivity();
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    View view = ((LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE))
            .inflate(R.layout.dialog_receive_broadcast, null);
    mActionTextView = (AutoCompleteTextView) view.findViewById(R.id.action);
    mMultipleCheckBox = (CheckBox) view.findViewById(R.id.receive_multiple_broadcasts);
    mActionTextView.setText(/*from w  ww  . ja v  a 2 s.c  o  m*/
            PreferenceManager.getDefaultSharedPreferences(context).getString("lastcatchbroadcastaction", ""));
    mActionTextView.setAdapter(new NameAutocompleteAdapter(context, R.raw.broadcast_actions));
    builder.setView(view);
    builder.setTitle(R.string.receive_broadcast);
    builder.setPositiveButton(R.string.register_receiver, this);
    if (ReceiveBroadcastService.sIsRunning) {
        builder.setNegativeButton(R.string.unregister_receiver, this);
    }
    builder.setOnCancelListener(this);
    return builder.create();
}

From source file:de.devmil.common.ui.color.HistorySelectorView.java

private void init() {
    LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View content = inflater.inflate(R.layout.color_historyview, null);
    addView(content, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.FILL_PARENT));

    readColors();//  w ww . j  a  v  a 2 s . com

    makeColorList();
}