List of usage examples for android.content Context LAYOUT_INFLATER_SERVICE
String LAYOUT_INFLATER_SERVICE
To view the source code for android.content Context LAYOUT_INFLATER_SERVICE.
Click Source Link
From source file:com.granita.tasks.utils.TasksListCursorSpinnerAdapter.java
/** * Create a new {@link TasksListCursorSpinnerAdapter} with custom views. * /* w w w . j a va 2 s . com*/ * @param context * A {@link Context}. * @param view * The layout id of the view of the collapsed spinner. * @param dropDownView * The layout id of the view for items in the drop down list. */ public TasksListCursorSpinnerAdapter(Context context, int view, int dropDownView) { super(context, null, 0 /* don't register a content observer to avoid a context leak! */); mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mView = view; mDropDownView = dropDownView; }
From source file:com.abcvoipsip.utils.contacts.ContactsSearchAdapter.java
@Override public View newView(Context context, Cursor cursor, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); return inflater.inflate(R.layout.search_contact_list_item, parent, false); }
From source file:com.battlelancer.seriesguide.adapters.ActivitySlowAdapter.java
public ActivitySlowAdapter(Context context, Cursor c, int flags) { super(context, c, flags); mLayoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mCalendar = Calendar.getInstance(); }
From source file:com.example.android.justforus.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Set activity_main.xml to be the layout for this activity setContentView(R.layout.activity_main); // Fetch the {@link LayoutInflater} service so that new views can be created LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); // Find the {@link GridView} that was already defined in the XML layout GridView gridView = (GridView) findViewById(R.id.grid); // Initialize the adapter with all the coupons. Set the adapter on the {@link GridView}. gridView.setAdapter(new CouponAdapter(inflater, createAllCoupons())); // Set a click listener for each coupon in the grid gridView.setOnItemClickListener(this); }
From source file:it.crs4.most.ehrlib.widgets.DvQuantityWidget.java
/** * Instantiates a new {@link DvQuantityWidget} * * @param provider the widget provider/*from w w w . j a v a 2 s . c om*/ * @param name the name of this widget * @param path the path of the {@link DvQuantity} mapped on this widget * @param attributes the attributes of the {@link DvQuantity} mapped on this widget * @param parentIndex the parent index */ public DvQuantityWidget(WidgetProvider provider, String name, String path, JSONObject attributes, int parentIndex) { super(provider, name, new DvQuantity(path, attributes), parentIndex); LayoutInflater inflater = (LayoutInflater) _context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.dv_quantity, null); _root_view = view; _labUnity = (TextView) _root_view.findViewById(R.id.txt_units); _title = (TextView) _root_view.findViewById(R.id.txt_title); _txtvalidity = (TextView) _root_view.findViewById(R.id.txt_validity); _input = (EditText) _root_view.findViewById(R.id.txt_magnitude); this.updateLabelsContent(); _help = (ImageView) _root_view.findViewById(R.id.image_help); toolTipRelativeLayout = (ToolTipRelativeLayout) _root_view .findViewById(R.id.activity_main_tooltipRelativeLayout); _help.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (myToolTipView == null) { myToolTipView = toolTipRelativeLayout.showToolTipForView(toolTip, _help); //myToolTipView.setOnToolTipViewClickedListener(DvTextWidget.this); } else { myToolTipView.remove(); myToolTipView = null; } } }); Log.d(TAG, "DV QUANTITY VALUE: " + datatype.getMagnitude()); setupEditingFilters(); updateWidgetContents(); }
From source file:com.github.michalbednarski.intentslab.browser.FetcherOptionsDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { // Inflate and get views LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.browse_components_top_options, null, false); mTopLayout = (ViewGroup) view.findViewById(R.id.top_layout); Spinner fetcherTypeSpinner = (Spinner) mTopLayout.findViewById(R.id.fetcher_type); mTopLayoutWithoutFetcherChildCount = mTopLayout.getChildCount(); // Prepare fetcher spinner fetcherTypeSpinner.setAdapter(new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, FetcherManager.getFetcherNames(getActivity()))); fetcherTypeSpinner.setSelection(FetcherManager.getFetcherIndex(mFetcher)); fetcherTypeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override//from w w w . ja v a 2s . c o m public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (FetcherManager.getFetcherIndex(mFetcher) != position) { mFetcher = FetcherManager.createNewFetcherByIndex(position); createFetcherConfigurationView(); } } @Override public void onNothingSelected(AdapterView<?> parent) { // Spinner won't have nothing selected } }); // Prepare fetcher configuration createFetcherConfigurationView(); // Create dialog return new AlertDialog.Builder(getActivity()).setView(view) .setPositiveButton(R.string.set_custom_filter, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { mFetcher.updateFromConfigurationForm(FetcherOptionsDialog.this); ((BrowseComponentsFragment) getTargetFragment()).setFetcher(mFetcher); } }).create(); }
From source file:com.jbirdvegas.mgerrit.cards.PatchSetPropertiesCard.java
public PatchSetPropertiesCard(Context context, RequestQueue requestQueue) { this.mRequestQuery = requestQueue; this.mContext = context; this.mActivity = (FragmentActivity) mContext; mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); this.mOrange = context.getResources().getColor(android.R.color.holo_orange_light); this.mGreen = context.getResources().getColor(R.color.text_green); this.mRed = context.getResources().getColor(R.color.text_red); }
From source file:com.devergence.widget.fraglistview.adapter.BaseAdapter.java
/** * Adaptador que gestiona una lista donde su primer elemento es un elemento destacado y manejado por un Fragmento * //from w ww . ja v a 2s.c o m * @param ctx * @param resource ID del recurso del layout que contiene la vista de los items * @param featuredItem Elemento que va a destacarse * @param items Lista de elementos secundarios * @param itemTypesCount cantidad de tipos de elemento de la lista secundaria */ public BaseAdapter(Context ctx, int resource, Object featuredItem, List<Object> items, int itemTypesCount) { super(ctx, resource, items); this.mItems = items; this.mFeaturedItem = featuredItem; this.TYPE_MAX_COUNT = itemTypesCount + 1; mInflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE); }
From source file:com.jbirdvegas.mgerrit.dialogs.DiffDialog.java
public DiffDialog(Context context, String website, ChangedFile changedFile) { super(context); mRequestQueue = Volley.newRequestQueue(context); mUrl = website;//ww w.j ava 2s. c om mChangedFile = changedFile; mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mRootView = mInflater.inflate(R.layout.diff_dialog, null); setView(mRootView); mDiffTextView = (TextView) mRootView.findViewById(R.id.diff_view_diff); mDiffTextView.setText(R.string.loading); mDiffTextView.setTextSize(18f); Log.d(TAG, "Calling url: " + mUrl); if (DIFF_DEBUG) { debugRestDiffApi(context, mUrl, mChangedFile); } // we can use volley here because we return // does not contain the magic number on the // first line. return is just the Base64 formatted // return mRequestQueue.add(getBase64StringRequest(mUrl)); mRequestQueue.start(); }
From source file:de.geeksfactory.opacclient.frontend.AccountListAdapter.java
@SuppressWarnings("deprecation") @Override/*from w w w . jav a2s . com*/ public View getView(int position, View contentView, ViewGroup viewGroup) { View view; // position always 0-7 if (objects.get(position) == null) { LayoutInflater layoutInflater = (LayoutInflater) getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = layoutInflater.inflate(R.layout.listitem_account, viewGroup, false); return view; } Account item = objects.get(position); if (contentView == null) { LayoutInflater layoutInflater = (LayoutInflater) getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = layoutInflater.inflate(R.layout.listitem_account, viewGroup, false); } else { view = contentView; } if (((OpacClient) ((Activity) context).getApplication()).getAccount().getId() == item.getId() && highlight) { view.findViewById(R.id.rlItem).setBackgroundColor(context.getResources().getColor(R.color.accent_red)); } else { // should be replaced by setBackground which is not available before API level 16 view.findViewById(R.id.rlItem).setBackgroundDrawable(null); } Library lib; try { lib = ((OpacClient) ((Activity) context).getApplication()).getLibrary(item.getLibrary()); TextView tvCity = (TextView) view.findViewById(R.id.tvCity); if (lib.getTitle() != null && !lib.getTitle().equals("null")) { tvCity.setText(lib.getCity() + "\n" + lib.getTitle()); } else { tvCity.setText(lib.getCity()); } } catch (IOException | JSONException e) { e.printStackTrace(); } TextView tvName = (TextView) view.findViewById(R.id.tvName); if (item.getName() != null) { tvName.setText(item.getName()); } TextView tvLabel = (TextView) view.findViewById(R.id.tvLabel); if (item.getLabel() != null) { tvLabel.setText(item.getLabel()); } return view; }