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.example.evan.comp296.messaging.FirebasePostQueryAdapter.java

@Override
public PostViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    // create a new view
    View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.post_item, parent, false);
    return new PostViewHolder(v);
}

From source file:net.olejon.mdapp.ClinicalTrialsCardsAdapter.java

@Override
public ClinicalTrialsViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
    View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.activity_clinicaltrials_card,
            viewGroup, false);//  w w  w .j  av a 2 s  .  c o  m
    return new ClinicalTrialsViewHolder(view);
}

From source file:net.olejon.mdapp.PoisoningsCardsAdapter.java

@Override
public PoisoningsViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
    View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.activity_poisonings_card,
            viewGroup, false);//from  w ww . j av a2s.c  om
    return new PoisoningsViewHolder(view);
}

From source file:appbox.ideastracker.ItemAdapter.java

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View layoutView = LayoutInflater.from(parent.getContext()).inflate(mLayoutId, parent, false);

    //create Recycler here
    MyRecyclerView recyclerView = (MyRecyclerView) layoutView.findViewById(R.id.horizontal_recycler_view);
    recyclerView.reboot(); //in case it's recycled

    // Create the right adapter for the recycler view
    HorizontalAdapter horizontalAdapter;
    horizontalAdapter = new HorizontalAdapter(recyclerView.getContext(), "", mTabNumber);

    // Set up the manager and adapter of the recycler view
    LinearLayoutManager horizontalLayoutManager = new LinearLayoutManager(mContext,
            LinearLayoutManager.HORIZONTAL, false);
    horizontalLayoutManager.scrollToPositionWithOffset(1, 0);
    recyclerView.setTag(0);/*from w ww  . j  ava2s  . c  o  m*/
    recyclerView.setLayoutManager(horizontalLayoutManager);
    recyclerView.setAdapter(horizontalAdapter);
    recyclerView.setUp();

    return new ViewHolder(layoutView, recyclerView);
}

From source file:com.cndll.chgj.adapter.CaiLeiListAdapter.java

@Override
public ItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_menu_editor, parent, false);
    ListItemViewHolder itemViewHolder = new ListItemViewHolder(view);
    return itemViewHolder;
}

From source file:com.mercandalli.android.apps.files.CardPresenter.java

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent) {
    Log.d(TAG, "onCreateViewHolder");

    final Context context = parent.getContext();
    sDefaultBackgroundColor = ContextCompat.getColor(context, R.color.default_background);
    sSelectedBackgroundColor = ContextCompat.getColor(context, R.color.selected_background);
    mDefaultCardImage = ContextCompat.getDrawable(context, R.drawable.movie);

    ImageCardView cardView = new ImageCardView(context) {
        @Override/*from   w ww  .  j  a  v  a2s .  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.money.manager.ex.assetallocation.full.FullAssetAllocationAdapter.java

@Override
public FullAssetClassViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    this.context = parent.getContext();
    View view = LayoutInflater.from(this.context).inflate(R.layout.item_full_asset_class, parent, false);
    return new FullAssetClassViewHolder(view);
}

From source file:com.example.sascha.mealdecisionhelper.adapter.RecyclerListAdapter.java

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.recipe_list_item, parent, false);
    ViewHolder itemViewHolder = new ViewHolder(view);
    return itemViewHolder;
}

From source file:com.johnny.gank.ui.adapter.PicturePagerAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    View view = LayoutInflater.from(container.getContext()).inflate(R.layout.pager_item_picture, container,
            false);/*from   w  ww.j a  v a  2  s  .  co m*/
    ViewHolder holder = new ViewHolder(view);
    GankNormalItem item = mItems.get(position);
    Glide.with(container.getContext()).load(item.url).dontAnimate().centerCrop().into(holder.vPic);
    container.addView(view);
    return view;
}

From source file:com.luorrak.ouroboros.catalog.WatchListAdapter.java

@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.watchlist_item, parent, false);
    return new WatchListViewHolder(view);
}