List of usage examples for android.view LayoutInflater from
public static LayoutInflater from(Context context)
From source file:com.digipom.manteresting.android.adapter.NailCursorAdapter.java
public NailCursorAdapter(Context context, ServiceConnector<CacheService> serviceConnector) { super(context, null, 0); layoutInflater = LayoutInflater.from(context); this.serviceConnector = serviceConnector; }
From source file:app.hanks.com.testadvancerecyclerview.MyDraggableSwipeableItemAdapter.java
@Override public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { final LayoutInflater inflater = LayoutInflater.from(parent.getContext()); final View v = inflater.inflate(R.layout.item_list_swipe, parent, false); return new MyViewHolder(v); }
From source file:com.manning.androidhacks.hack017.CreateAccountAdapter.java
public CreateAccountAdapter(Context ctx) { mContext = ctx;/*w ww . jav a 2s . co m*/ mInflator = LayoutInflater.from(ctx); mFormData = new HashMap<String, String>(); mAccount = new Account(); }
From source file:com.applift.api.tester.activity.RequestActivity.java
private TableRow newRow(String key) { TableRow row = (TableRow) LayoutInflater.from(this).inflate(R.layout.view_request_table_row, null); Holder h = new Holder(row, key); row.setTag(h);//from ww w. j a v a2s . co m return row; }
From source file:com.facebook.GraphObjectAdapter.java
public GraphObjectAdapter(Context context) { this.inflater = LayoutInflater.from(context); }
From source file:com.androidrocks.bex.zxing.client.android.SearchBookContentsActivity.java
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); // Make sure that expired cookies are removed on launch. CookieSyncManager.createInstance(this); CookieManager.getInstance().removeExpiredCookie(); Intent intent = getIntent();//from ww w . ja v a 2s .c o m if (intent == null || (!intent.getAction().equals(Intents.SearchBookContents.ACTION) && !intent.getAction().equals(Intents.SearchBookContents.DEPRECATED_ACTION))) { finish(); return; } mISBN = intent.getStringExtra(Intents.SearchBookContents.ISBN); setTitle(getString(R.string.sbc_name) + ": ISBN " + mISBN); setContentView(R.layout.search_book_contents); mQueryTextView = (EditText) findViewById(R.id.query_text_view); String initialQuery = intent.getStringExtra(Intents.SearchBookContents.QUERY); if (initialQuery != null && initialQuery.length() > 0) { // Populate the search box but don't trigger the search mQueryTextView.setText(initialQuery); } mQueryTextView.setOnKeyListener(mKeyListener); mQueryButton = (Button) findViewById(R.id.query_button); mQueryButton.setOnClickListener(mButtonListener); mResultListView = (ListView) findViewById(R.id.result_list_view); LayoutInflater factory = LayoutInflater.from(this); mHeaderView = (TextView) factory.inflate(R.layout.search_book_contents_header, mResultListView, false); mResultListView.addHeaderView(mHeaderView); }
From source file:com.findme.adapter.ImageListAdapter.java
@Override public View getView(int position, View view, ViewGroup viewGroup) { // We only create the view if its needed if (view == null) { view = inflator.inflate(R.layout.image_list_child, null); // Set the click listener for the checkbox // view.findViewById(R.id.isSelectedCheckBox).setOnClickListener(this); } else/* w w w . ja va 2 s. co m*/ return view; final JSONObject personInfo = (JSONObject) getItem(position); String imgUrl = null; try { imgUrl = prefix + personInfo.getJSONArray("images").getString(0); } catch (JSONException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } Log.d("image", imgUrl); count++; Log.d("Result", String.valueOf(count)); final ImageButton img = (ImageButton) view.findViewById(R.id.appImageView1); URL url; Bitmap bmp = null; (new DownloadImageTask(img)).execute(imgUrl); img.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AlertDialog.Builder builder = new AlertDialog.Builder(mainAct); View view = LayoutInflater.from(mainAct).inflate(R.layout.popup_layout, null); ImageView image = (ImageView) view.findViewById(R.id.resultDialogImg); /** * Not sure about the license of PhotoViewAttacher * TODO : look into the license of this and decide whether to use it or not. */ image.setImageDrawable(img.getDrawable()); PhotoViewAttacher mAttacher = new PhotoViewAttacher(image); mAttacher.update(); //builder.setIcon(mainAct.getResources().getDrawable(mainAct.getResources().getIdentifier(app.getImage(), "drawable", mainAct.getPackageName()))); builder.setView(view); builder.setPositiveButton(R.string.match_found, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { try { (new AsyncHttpPostTask(prefix)).execute(personInfo.getString("personname")); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); builder.setNegativeButton(R.string.close, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { // User clicked OK. Start a new game. dialog.dismiss(); } }); builder.create().show(); } }); return view; }
From source file:augsburg.se.alltagsguide.event.EventActivity.java
@Override protected void setMorePageDetails(EventPage page) { int color = mPrefUtilities.getCurrentColor(); if (mPage.getEvent().isAllDay()) { fromDateTextView.setText(allDayDateFormat.format(mPage.getEvent().getStartTime())); timeToLayout.setVisibility(View.GONE); } else {/*from ww w .j a v a 2s. c om*/ fromDateTextView.setText(dateFormatFrom.format(mPage.getEvent().getStartTime())); toDateTextView.setText(dateFormatFrom.format(mPage.getEvent().getEndTime())); } if (mPage.getAuthor() != null) { String authorText = mPage.getAuthor().toText(); if (!Objects.isNullOrEmpty(authorText)) { authorTextView.setText(authorText); } else { authorLayout.setVisibility(View.GONE); } } else { authorLayout.setVisibility(View.GONE); } if (!mPage.getCategories().isEmpty()) { for (EventCategory category : mPage.getCategories()) { @SuppressLint("InflateParams") TextView view = (TextView) LayoutInflater.from(this).inflate(R.layout.category_item, categoriesLayout, false); view.setText(category.getName()); view.setTextColor(color); view.setBackgroundColor(ContextCompat.getColor(this, android.R.color.white)); categoriesLayout.addView(view); } } else { categoriesBaseLayout.setVisibility(View.GONE); } if (!mPage.getTags().isEmpty()) { for (EventTag tag : mPage.getTags()) { @SuppressLint("InflateParams") TextView view = (TextView) LayoutInflater.from(this).inflate(R.layout.tag_item, tagsLayout, false); view.setText(tag.getName()); view.setTextColor(ContextCompat.getColor(this, android.R.color.white)); view.setBackgroundColor(color); tagsLayout.addView(view); } } else { tagsLayout.setVisibility(View.GONE); } if (mPage.getLocation() != null) { String location = ""; String name = mPage.getLocation().getName(); String address = mPage.getLocation().getAddress(); if (name != null) { location += name + " - "; } if (address != null) { location += address; } locationTextView.setText(location); } }
From source file:aws.apps.usbDeviceEnumerator.ui.usbinfo.AndroidUsbInfoFragment.java
@Override public void onViewCreated(View view, Bundle bundle) { super.onViewCreated(view, bundle); viewHolder = new InfoViewHolder(view); usbKey = getArguments().getString(EXTRA_DATA, DEFAULT_STRING); if (validData) { viewHolder = new InfoViewHolder(view); populateDataTable(LayoutInflater.from(getContext())); } else {/* www . ja v a2 s . c om*/ final TextView textView = (TextView) view.findViewById(R.id.errorText); if (usbKey == null) { textView.setText(R.string.error_loading_device_info_unknown); } else { textView.setText(R.string.error_loading_device_info_device_disconnected); } } }
From source file:android.example.colorpicker.ColorPickerDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { final Activity activity = getActivity(); View view = LayoutInflater.from(getActivity()).inflate(R.layout.calendar_color_picker_dialog, null); mProgress = (ProgressBar) view.findViewById(android.R.id.progress); mPalette = (ColorPickerPalette) view.findViewById(R.id.color_picker); mPalette.init(mSize, mColumns, this); if (mColors != null) { showPaletteView();// w ww . j a va2 s. c o m } mAlertDialog = new AlertDialog.Builder(activity).setTitle(mTitleResId).setView(view).create(); return mAlertDialog; }