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.callrecorder.android.RecordingsAdapter.java

@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    View rowView = convertView;// ww w.j  av  a  2  s.co  m
    if (rowView == null) {
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        rowView = inflater.inflate(R.layout.record_row, parent, false);
    }
    final TextView titleView = (TextView) rowView.findViewById(R.id.recording_title);
    final TextView dateView = (TextView) rowView.findViewById(R.id.recording_date);
    final TextView numberView = (TextView) rowView.findViewById(R.id.recording_number);
    Recording entry = list.get(position);

    String phoneNumber = entry.getPhoneNumber();
    if (phoneNumber.matches("^[\\d]+$")) {
        //noinspection deprecation
        phoneNumber = PhoneNumberUtils.formatNumber(phoneNumber);
    } else {
        phoneNumber = context.getString(R.string.withheld_number);
    }

    dateView.setText(DateFormat.getDateTimeInstance().format(entry.getDate()));
    titleView.setText(entry.getUserName());
    numberView.setText(phoneNumber);

    return rowView;
}

From source file:com.kogitune.launcher3.LauncherAppWidgetHostView.java

public LauncherAppWidgetHostView(Context context) {
    super(context);
    mContext = context;//  w  ww.  j  ava 2s.  c  o m
    mLongPressHelper = new CheckLongPressHelper(this);
    mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    mDragLayer = ((Launcher) context).getDragLayer();
}

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

@Override
public View getView(int position, View convertView, ViewGroup parent) {

    View rowView;/*from   www  . j a v  a 2  s. c  o  m*/

    if (convertView == null) {
        LayoutInflater inflater = (LayoutInflater) getContext()
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        rowView = inflater.inflate(R.layout.item_order_history, parent, false);
        rowView.setTag(new OrderHistoryViewHolder(rowView, position));
    } else {
        rowView = convertView;
    }

    OrderHistoryViewHolder orderHistoryViewHolder = (OrderHistoryViewHolder) rowView.getTag();

    final OrderHistory order = getItem(position);

    if (order != null) {
        // Order Code
        if (StringUtils.isNotBlank(order.getCode())) {
            orderHistoryViewHolder.orderNumberTextView.setText(order.getCode());
        }

        // Date placed / created
        if (order.getPlaced() != null) {
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat(Constants.DATE_FORMAT_COMPLETE,
                    SimpleDateFormat.getAvailableLocales()[0]);

            orderHistoryViewHolder.orderDatePlacedTextView.setText(simpleDateFormat.format(order.getPlaced()));
        }

        // Status

        if (StringUtils.isNotBlank(order.getStatusDisplay())) {
            orderHistoryViewHolder.orderStatusTextView.setText(order.getStatusDisplay());
        }

        // Total price
        if (order.getTotal() != null) {
            orderHistoryViewHolder.orderTotalTextView.setText(order.getTotal().getFormattedValue());
        }

        // Redirecting to the order detail page when clicking on the item
        orderHistoryViewHolder.orderHistoryLayout.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intentOrderDetail = new Intent(getContext(), OrderDetailActivity.class);
                intentOrderDetail.putExtra(IntentConstants.ORDER_CODE, order.getCode());
                getContext().startActivity(intentOrderDetail);
            }
        });

    }
    return rowView;
}

From source file:com.cloudkick.monitoring.Check.java

@Override
public View getItemView(Context context, View convertView, ViewGroup parent) {
    RelativeLayout checkView;/*w  ww .  j  a v  a  2 s  .  c  om*/

    String inflater = Context.LAYOUT_INFLATER_SERVICE;
    LayoutInflater li = (LayoutInflater) context.getSystemService(inflater);

    if (convertView == null) {
        checkView = new RelativeLayout(context);
        li.inflate(R.layout.node_detail, checkView, true);
    }

    else {
        checkView = (RelativeLayout) convertView;
    }

    ((TextView) checkView.findViewById(R.id.detail_label)).setText(summary);
    ((TextView) checkView.findViewById(R.id.detail_symbol)).setTextColor(latestState.stateColor);
    ((TextView) checkView.findViewById(R.id.detail_symbol)).setText(latestState.stateSymbol);
    ((TextView) checkView.findViewById(R.id.detail_value)).setText(latestState.status);

    return checkView;
}

From source file:com.example.testtab.fragment.GalleryPageFragment.java

/**
 * Factory method for this fragment class. Constructs a new fragment for the given page number.
 *///w  w w.  j a  v a 2 s  . c  o m
public static GalleryPageFragment create(int pageNumber, Context context) {
    // Gallery ------------------------------------ //
    mContext = context;

    mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    GalleryPageFragment fragment = new GalleryPageFragment();
    Bundle args = new Bundle();
    args.putInt(ARG_PAGE, pageNumber);
    fragment.setArguments(args);
    return fragment;
}

From source file:com.timecontents.smartnotice.animate.AnimatedListViewAdapter.java

public AnimatedListViewAdapter(Context context, int resourceId, List<JSONObject> objects,
        AnimatedListViewObjectMapper objectMapper) {
    super(context, resourceId, objects);

    this._inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    this._resourceId = resourceId;
    this._objects = objects;
    this._objectMapper = objectMapper;

    _jsonArray = (ArrayList<JSONObject>) objects;
}

From source file:biz.easymenu.easymenung.ConfirmDialog.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    li = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}

From source file:com.kyakujin.android.tagnotepad.ui.TagListAdapter.java

@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    View rowView = inflater.inflate(R.layout.list_item_tag, null, true);

    ViewHolder holder = new ViewHolder();

    holder.textView = (TextView) rowView.findViewById(R.id.tag_item);
    holder.imageView = (ImageView) rowView.findViewById(R.id.icon_tag_list);

    rowView.setTag(holder);//from   ww  w. j a  v  a  2s . c o m

    return rowView;
}

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

@Override
public View getView(int position, View convertView, ViewGroup parent) {

    View rowView;/* w  w  w  .j  av  a2  s.  c o  m*/

    if (convertView == null) {
        LayoutInflater inflater = (LayoutInflater) getContext()
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        rowView = inflater.inflate(R.layout.item_order_product, parent, false);
        rowView.setTag(new OrderViewHolder(rowView, position));
    } else {
        rowView = convertView;
    }

    final OrderViewHolder orderViewHolder = (OrderViewHolder) rowView.getTag();

    final OrderEntry orderProduct = mProducts.get(position);
    if (orderProduct != null) {
        // Name
        orderViewHolder.productNameTextView.setText(orderProduct.getProduct().getName());

        // Price
        if (orderProduct.getBasePrice() != null) {
            orderViewHolder.productPrice.setText(orderProduct.getBasePrice().getFormattedValue());
        }

        // Promotion
        if (orderProduct.getPromotionResult() != null) {
            if (StringUtils.isNotBlank(orderProduct.getPromotionResult().getDescription())) {
                orderViewHolder.productPromotion.setText(orderProduct.getPromotionResult().getDescription());
            }

            orderViewHolder.productPromotion.setVisibility(View.VISIBLE);
        } else {
            orderViewHolder.productPromotion.setVisibility(View.GONE);

        }

        // Variants
        if (orderProduct.getProduct().getBaseOptions() != null
                && !orderProduct.getProduct().getBaseOptions().isEmpty()) {
            orderViewHolder.linearLayoutVariants.setVisibility(View.VISIBLE);
            orderViewHolder.linearLayoutVariants.removeAllViews();
        }

        // Redirecting to the product detail page when clicking on the image
        orderViewHolder.orderItemClickableLyout.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {

                ProductHelper.redirectToProductDetail(getContext(), orderProduct.getProduct().getCode());
            }
        });

        // Loading the product image
        if (StringUtils.isNotBlank(orderProduct.getProduct().getImageThumbnailUrl())) {
            CommerceApplication.getContentServiceHelper().loadImage(
                    orderProduct.getProduct().getImageThumbnailUrl(), null, orderViewHolder.productImageView, 0,
                    0, true, null, true);
        }

        // Quantity
        orderViewHolder.quantityTextView
                .setText(getContext().getString(R.string.order_confirmation_qty, orderProduct.getQuantity()));

        // Total price
        if (orderProduct.getTotalPrice() != null) {
            orderViewHolder.productTotalPrice.setText(orderProduct.getTotalPrice().getFormattedValue());
        }

    }
    return rowView;
}

From source file:com.abid_mujtaba.fetchheaders.AccountsActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.accounts);//from  ww w  .  j a v a  2  s  .  c o m

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);

    LinearLayout accountList = (LinearLayout) findViewById(R.id.account_list);

    LayoutInflater li = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    for (int ii = 0; ii < Account.numberOfAccounts(); ii++) {
        TextView tv = (TextView) li.inflate(R.layout.account_setting_name, null);
        tv.setText(Account.get(ii).name());
        tv.setId(ii); // Store the account_id as the view id
        tv.setOnCreateContextMenuListener(onCreateContextMenuListener);
        tv.setOnTouchListener(onTouchListener);

        tv.setOnClickListener(listener);

        accountList.addView(tv);
    }
}