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.android.wearable.wear.wearnotifications.CustomRecyclerAdapter.java

@Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
    View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.recycler_row_item, viewGroup,
            false);//from  w ww  .  j  a va2 s.  co m

    return new ViewHolder(view);
}

From source file:com.example.kuassivi.material_avatar.core.adapter.RecyclerViewAdapter.java

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

From source file:com.twolinessoftware.smarterlist.view.MasterSmartListItemSearchAdapter.java

@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
    View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_listview, parent, false);
    v.setTag(new GenericListViewHolder(v));

    return v;// ww w  .  j a  v a 2 s  .c  o  m
}

From source file:com.chromium.fontinstaller.ui.fontlist.FontListAdapter.java

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

From source file:com.example.facebookfriendviewer.adapters.PhotoCursorAdapter.java

@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
    final ViewHolder holder;
    LayoutInflater inflater = LayoutInflater.from(parent.getContext());
    View view = inflater.inflate(viewLayout, null, false);

    holder = new ViewHolder();
    holder.image = (ImageView) view.findViewById(R.id.picture);
    view.setTag(holder);//from   ww  w .j  a  va2  s.  c  o m
    return view;
}

From source file:com.ferid.app.classroom.adapters.TakeAttendanceAdapter.java

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

    return new ViewHolder(view);
}

From source file:com.erevacation.challenge.ui.screens.main.productlist.recyclerview.ProductAdapter.java

@Override
public ProductViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.rv_item_product, parent, false);

    return new ProductViewHolder(itemView);
}

From source file:com.felkertech.n.tv.presenters.CardPresenter.java

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent) {
    mContext = parent.getContext();
    sDefaultBackgroundColor = parent.getResources().getColor(R.color.default_background);
    sSelectedBackgroundColor = parent.getResources().getColor(R.color.selected_background);

    ImageCardView cardView = new ImageCardView(mContext);

    cardView.setFocusable(true);//from  ww  w . j  a v a 2s  .  c  o  m
    cardView.setFocusableInTouchMode(true);
    updateCardBackgroundColor(cardView, false);
    return new ViewHolder(cardView);
}

From source file:com.scooter1556.sms.android.presenter.MenuItemPresenter.java

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent) {
    defaultBackgroundColor = ContextCompat.getColor(parent.getContext(), R.color.primary);
    selectedBackgroundColor = ContextCompat.getColor(parent.getContext(), R.color.primary_dark);

    ImageCardView view = new ImageCardView(parent.getContext()) {
        @Override//from   ww  w  .  j av a  2s.c  o 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.wayhua.framework.adapter.WelcomePagerAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    View v = LayoutInflater.from(container.getContext()).inflate(view, container, false);

    TextView titleText = ((TextView) v.findViewById(R.id.tv_title));
    TextView infoText = ((TextView) v.findViewById(R.id.tv_info));
    titleText.setText(titles[position]);
    infoText.setText(info[position]);/*from w w w .  ja  v a 2s .com*/
    if (position == 0) {
        @ColorInt
        int primaryColor = titleText.getResources().getColor(R.color.colorPrimary);
        titleText.setTextColor(primaryColor);
        infoText.setTextColor(primaryColor);
    }
    ImageView imageView = (ImageView) v.findViewById(R.id.iv_art);
    //.setImageResource(images[position]);
    Glide.with(context).load(images[position]).into(imageView);
    container.addView(v);
    return v;
}