List of usage examples for android.view ViewGroup getContext
@ViewDebug.CapturedViewProperty public final Context getContext()
From source file:com.lloydtorres.stately.census.DatasetRecyclerAdapter.java
@Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { LayoutInflater inflater = LayoutInflater.from(parent.getContext()); View view = inflater.inflate(R.layout.list_name_basic, parent, false); RecyclerView.ViewHolder viewHolder = new DatasetEntry(view); return viewHolder; }
From source file:com.wellsandwhistles.android.redditsp.adapters.AccountListAdapter.java
@Override protected VH onCreateHeaderItemViewHolder(ViewGroup parent) { View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_1_text, parent, false); return new VH1Text(v); }
From source file:com.wellsandwhistles.android.redditsp.adapters.AccountListAdapter.java
@Override protected VH onCreateContentItemViewHolder(ViewGroup parent) { View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_1_text, parent, false); return new VH1Text(v); }
From source file:com.woodblockwithoutco.beretainedexample.widget.support.RecyclerViewFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Context parentContext = container.getContext(); View v = inflater.inflate(R.layout.fragment_recycler_view, container, false); mRecyclerView = (RecyclerView) v;//from ww w .j a v a 2 s . c om mRecyclerView.setLayoutManager(new LinearLayoutManager(parentContext)); SimpleAdapter adapter = new SimpleAdapter(); mRecyclerView.setAdapter(adapter); if (mItems != null) { adapter.setItems(mItems); } return v; }
From source file:de.anycook.einkaufszettel.adapter.RecipeRowArrayAdapter.java
@Override public RecipeViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.discover_row, viewGroup, false); return new RecipeViewHolder(view, activity); }
From source file:com.scooter1556.sms.android.presenter.MediaMetadataPresenter.java
@Override public ViewHolder onCreateViewHolder(ViewGroup parent) { defaultBackgroundColor = ContextCompat.getColor(parent.getContext(), R.color.primary); selectedBackgroundColor = ContextCompat.getColor(parent.getContext(), R.color.primary_dark); defaultIcon = ContextCompat.getDrawable(parent.getContext(), R.drawable.ic_audio); ImageCardView view = new ImageCardView(parent.getContext()) { @Override//from ww w . j a va 2s . co m public void setSelected(boolean selected) { updateCardBackgroundColor(this, selected); super.setSelected(selected); } }; view.setFocusable(true); view.setFocusableInTouchMode(true); updateCardBackgroundColor(view, false); return new ViewHolder(view); }
From source file:com.vinidsl.googleioextended.ui.adapter.DiaryAdapter.java
@Override public ViewHolderDiary onCreateViewHolder(ViewGroup parent, int viewType) { View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.row_diary, parent, false); ViewHolderDiary viewHolderDiary = new ViewHolderDiary(v); return viewHolderDiary; }
From source file:at.alladin.rmbt.android.adapter.result.QoSCategoryPagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { final Context context = container.getContext(); //QoSTestResultEnum key = QoSTestResultEnum.values()[position]; QoSTestResultEnum key = titleList.get(position); View view = null;/*from w ww . j a va 2 s . c o m*/ view = new QoSCategoryView(context, activity, results.getTestDescMap().get(key), resultMap.get(key), descMap.get(key)); container.addView(view); return view; }
From source file:de.kodejak.hashr.fragmentAbout.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.fragmentabout_layout, container, false); this.mContext = container.getContext(); return rootView; }
From source file:com.amazon.android.tv.tenfoot.presenter.SettingsCardPresenter.java
/** * {@inheritDoc}/*from w w w .j a v a 2 s .c o m*/ */ @Override public ViewHolder onCreateViewHolder(ViewGroup parent) { Context context = parent.getContext(); try { sFocusedFadeMask = ContextCompat.getDrawable(context, R.drawable.content_fade_focused); } catch (Resources.NotFoundException e) { Log.e(TAG, "Resource not found", e); throw e; } ImageCardView cardView = new ImageCardView(context) { @Override public void setSelected(boolean selected) { super.setSelected(selected); if (mInfoField != null) { mInfoField.setBackground(sFocusedFadeMask); } } }; cardView.setFocusable(true); cardView.setFocusableInTouchMode(true); // Set the type and visibility of the info area. cardView.setCardType(BaseCardView.CARD_TYPE_INFO_OVER); cardView.setInfoVisibility(BaseCardView.CARD_REGION_VISIBLE_ALWAYS); int CARD_WIDTH_PX = 160; mCardWidthDp = Helpers.convertPixelToDp(context, CARD_WIDTH_PX); int CARD_HEIGHT_PX = 120; mCardHeightDp = Helpers.convertPixelToDp(context, CARD_HEIGHT_PX); mInfoField = cardView.findViewById(R.id.info_field); if (mInfoField != null) { mInfoField.setBackground(sFocusedFadeMask); } return new ViewHolder(cardView); }