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.ibm.mil.readyapps.telco.usage.IncomingOutgoingBinder.java

/**
 * creates a new ViewHolder using the provided xml layout
 *
 * @param viewGroup the parent ViewGroup that this ViewHolder will inflate
 * specifies the xml layout that the binder should use to create the view
 * @return the inflated view/*from  w ww  .  j  a v a  2s .  co m*/
 */
@Override
public UsageViewHolder newViewHolder(ViewGroup viewGroup) {
    View usageView = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.incoming_outgoing, viewGroup,
            false);
    return new UsageViewHolder(usageView);
}

From source file:ca.farrelltonsolar.classic.MessageFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    adapter = new MessageListAdapter(container.getContext());
    setListAdapter(adapter);//w  w w.j av a 2 s  .  co  m
    return super.onCreateView(inflater, container, savedInstanceState);
}

From source file:com.lloydtorres.stately.telegrams.FoldersRecyclerAdapter.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 FolderEntry(view);
    return viewHolder;
}

From source file:com.rukiasoft.androidapps.cocinaconroll.ui.SearchRecyclerViewAdapter.java

@Override
public RecipeViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.search_item, parent, false);
    RecipeViewHolder recipeViewHolder = new RecipeViewHolder(v);
    v.setOnClickListener(this);
    return recipeViewHolder;
}

From source file:com.secretbiology.battleship.arrange.BoardAdapter.java

@Override
public BoardView onCreateViewHolder(ViewGroup parent, int viewType) {
    return new BoardView(LayoutInflater.from(parent.getContext()).inflate(R.layout.board_item, parent, false));
}

From source file:com.colinearproductions.scrumcompanion.BacklogRecyclerViewAdapter.java

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

From source file:com.rks.musicx.ui.adapters.PlaylistListAdapter.java

@Override
public PlaylistViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.playlist_list, parent, false);
    return new PlaylistViewHolder(itemView);
}

From source file:com.aengbee.android.leanback.presenter.CardPresenter.java

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent) {
    mDefaultBackgroundColor = ContextCompat.getColor(parent.getContext(), R.color.default_background);
    mSelectedBackgroundColor = ContextCompat.getColor(parent.getContext(), R.color.selected_background);
    mDefaultCardImage = parent.getResources().getDrawable(R.drawable.movie, null);

    ImageCardView cardView = new ImageCardView(parent.getContext()) {
        @Override//from w  ww  .  ja  v a2  s .co 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.example.emachine.RecyclerGridAdapter.java

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

From source file:com.mvcoding.financius.feature.introduction.IntroductionAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    final IntroductionView introductionView = (IntroductionView) LayoutInflater.from(container.getContext())
            .inflate(R.layout.view_introduction, container, false);
    introductionView.setIntroduction(introductions.get(position));
    container.addView(introductionView);
    return introductionView;
}