List of usage examples for android.view ViewGroup getContext
@ViewDebug.CapturedViewProperty public final Context getContext()
From source file:com.hhwt.travelplanner.adapter.VoteNextadapter.java
@Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.adapter_vote, parent, false); mContext = parent.getContext();/*from ww w .j av a 2 s . co m*/ v.setOnClickListener(this); return new ViewHolder(v); }
From source file:com.fowlcorp.homebank4android.gui.OverviewRecyclerAdapter.java
@Override public OverviewViewHolder onCreateViewHolder(ViewGroup parent, int arg1) { View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.overview_card_layout, parent, false); return new OverviewViewHolder(v); }
From source file:com.hackedcube.blenderopenmovies.CardPresenter.java
@Override public ViewHolder onCreateViewHolder(ViewGroup parent) { Log.d(TAG, "onCreateViewHolder"); sDefaultBackgroundColor = ContextCompat.getColor(parent.getContext(), R.color.default_background); sSelectedBackgroundColor = ContextCompat.getColor(parent.getContext(), R.color.selected_background); mDefaultCardImage = ContextCompat.getDrawable(parent.getContext(), R.drawable.movie); ImageCardView cardView = new ImageCardView(parent.getContext()) { @Override/* w w w.j a v a 2 s .c o m*/ public void setSelected(boolean selected) { updateCardBackgroundColor(this, selected); super.setSelected(selected); } }; cardView.setFocusable(true); cardView.setFocusableInTouchMode(true); updateCardBackgroundColor(cardView, false); return new ViewHolder(cardView); }
From source file:com.scooter1556.sms.android.presenter.MediaDescriptionPresenter.java
@Override public ViewHolder onCreateViewHolder(ViewGroup parent) { defaultBackgroundColor = ContextCompat.getColor(parent.getContext(), R.color.primary); selectedBackgroundColor = ContextCompat.getColor(parent.getContext(), R.color.primary_dark); defaultAudioIcon = ContextCompat.getDrawable(parent.getContext(), R.drawable.ic_audio); defaultVideoIcon = ContextCompat.getDrawable(parent.getContext(), R.drawable.ic_video); ImageCardView view = new ImageCardView(parent.getContext()) { @Override//from w w w . j a v a 2s . com 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.github.chilinh.androidformbuilder.MainFragment.java
@Nullable @Override//from w w w.jav a 2s. c om public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { ListView listView = new ListView(container.getContext()); listView.setAdapter(new ArrayAdapter<>(container.getContext(), android.R.layout.simple_list_item_1, new String[] { "Dialog Form", "Fragment" })); listView.setOnItemClickListener((parent, view, position, id) -> { switch (position) { case 0: showDialog(); break; case 1: showFragment(); break; } }); return listView; }
From source file:com.mifos.mifosxdroid.adapters.ClientNameListAdapter.java
@Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { RecyclerView.ViewHolder vh;/*www .j a va 2 s. c o m*/ View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.row_client_name, parent, false); vh = new ViewHolder(v); return vh; }
From source file:net.olejon.mdapp.LvhCategoriesAdapter.java
@Override public CategoryViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.activity_lvh_categories_card, viewGroup, false);/* ww w. ja v a2 s . c om*/ return new CategoryViewHolder(view); }
From source file:com.fuzz.emptyhusk.SimplePagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { String value = values[position]; LayoutInflater inflater = LayoutInflater.from(container.getContext()); View inflated = inflater.inflate(R.layout.pager_cell_text, container, false); TextView item = (TextView) inflated.findViewById(R.id.cell_text); item.setText(value);//from w w w .j ava 2s . c o m viewCache.put(value, inflated); container.addView(inflated); return value; }
From source file:com.stoneapp.ourvlemoodle2.adapters.PostListAdapter.java
@Override public PostListViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) { View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.list_post_item, viewGroup, false); return new PostListViewHolder(v); }
From source file:com.akvone.dlcifmo.JournalModule.Adapters.ItemAdapter.java
@Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { context = parent.getContext(); View view = LayoutInflater.from(context).inflate(mLayoutId, parent, false); return new ViewHolder(view); }