Example usage for android.view ViewGroup getContext

List of usage examples for android.view ViewGroup getContext

Introduction

In this page you can find the example usage for android.view ViewGroup getContext.

Prototype

@ViewDebug.CapturedViewProperty
public final Context getContext() 

Source Link

Document

Returns the context the view is running in, through which it can access the current theme, resources, etc.

Usage

From source file:com.gbozza.android.popularmovies.adapters.ReviewsAdapter.java

@Override
public ReviewsAdapterViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
    int layoutIdForListItem = R.layout.reviews_view;
    LayoutInflater inflater = LayoutInflater.from(viewGroup.getContext());
    boolean shouldAttachToParentImmediately = false;

    View view = inflater.inflate(layoutIdForListItem, viewGroup, shouldAttachToParentImmediately);
    ButterKnife.bind(this, view);
    return new ReviewsAdapterViewHolder(view);
}

From source file:com.amanmehara.programming.android.adapters.LanguageAdapter.java

@Override
public LanguageAdapter.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
    View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.language_list, viewGroup, false);
    return new ViewHolder(view);
}

From source file:com.arlib.floatingsearchview.suggestions.SearchSuggestionsAdapter.java

@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {

    View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.search_suggestion_item, viewGroup,
            false);/*from   www .  j a  v  a  2  s  . co m*/
    SearchSuggestionViewHolder viewHolder = new SearchSuggestionViewHolder(view,
            new SearchSuggestionViewHolder.Listener() {

                @Override
                public void onItemClicked(int adapterPosition) {

                    if (mListener != null)
                        mListener.onItemSelected(mSearchSuggestions.get(adapterPosition));
                }

                @Override
                public void onMoveItemToSearchClicked(int adapterPosition) {

                    if (mListener != null)
                        mListener.onMoveItemToSearchClicked(mSearchSuggestions.get(adapterPosition));
                }

            });

    viewHolder.rightIcon.setImageDrawable(mRightIconDrawable);
    viewHolder.body.setTextSize(TypedValue.COMPLEX_UNIT_PX, mBodyTextSizePx);

    return viewHolder;
}

From source file:com.justplay1.shoppist.features.search.SearchAdapter.java

@Override
public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_search_suggestion, parent,
            false);//from   w  ww  . j av  a2 s.  c  o m
    SearchViewHolder holder = new SearchViewHolder(view);
    holder.setClickListener(itemClickListener);
    return holder;
}

From source file:com.simplechatclient.android.LoginFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    view = inflater.inflate(R.layout.login_fragment, container, false);
    context = container.getContext();

    myStart();//from   w  ww.j av a 2 s  .  c o m

    return view;
}

From source file:de.mrapp.android.util.view.AttachedViewRecycler.java

/**
 * Creates a new recycler, which allows to cache views in order to be able to reuse them later
 * instead of inflating new instances. By default, views are added to the parent in the order of
 * their inflation.//from  w  w w  . ja  v  a2s. co  m
 *
 * @param parent
 *         The parent, the recycler should be bound to, as an instance of the class {@link
 *         ViewGroup}. The parent may not be null
 */
public AttachedViewRecycler(@NonNull final ViewGroup parent) {
    this(parent, LayoutInflater.from(parent.getContext()));
}

From source file:com.fatelon.partyphotobooth.fragments.ConfirmationFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mContext = container.getContext();
    /*/*  w w  w .  j  av  a 2s  .  c om*/
     * Inflate views from XML.
     */
    View view = inflater.inflate(R.layout.fragment_confirmation, container, false);
    mMessage = (TextView) view.findViewById(R.id.confirmation_message);
    mSubmit = (Button) view.findViewById(R.id.confirmation_button_submit);
    return view;
}

From source file:com.h6ah4i.android.example.advrecyclerview.demo_s_viewpager.MyViewPagerSwipeableItemAdapter.java

@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    final LayoutInflater inflater = LayoutInflater.from(parent.getContext());
    final View v = inflater.inflate(R.layout.list_item_view_pager, parent, false);
    return new MyViewHolder(v);
}

From source file:com.lastsoft.plog.adapter.GroupAdapter.java

@Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
    // Create a new view.
    View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.group_row_item, viewGroup, false);

    return new ViewHolder(v);
}

From source file:com.murraystudio.murraystudio.GalleryAdapter.java

@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
    // Create a new view.
    View v1 = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.gallery_image, viewGroup, false);

    return new ViewHolderFirst(v1, context);
}