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.github.pockethub.android.ui.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  .  j a  va 2 s . c  o  m*/
    if (position == 0) {
        @ColorInt
        int primaryColor = titleText.getResources().getColor(R.color.primary);
        titleText.setTextColor(primaryColor);
        infoText.setTextColor(primaryColor);
    }
    ((ImageView) v.findViewById(R.id.iv_art)).setImageResource(images[position]);

    container.addView(v);
    return v;
}

From source file:com.sundayblues.fbchat.MessageRecyclerAdapter.java

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

From source file:com.bartoszlipinski.recyclerviewheader2.sample.adapter.ColorItemsAdapter.java

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

From source file:com.dm.material.dashboard.candybar.adapters.FAQsAdapter.java

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.fragment_faqs_item_list, parent,
            false);/*from  ww w  .jav a  2 s .  c  om*/
    return new ViewHolder(view);
}

From source file:com.rana.contactswithemail.adapters.ContactListAdapter.java

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

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

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

From source file:com.nerderylabs.android.nerdalert.ui.adapter.RecyclerViewAdapter.java

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

From source file:com.h6ah4i.android.example.advrecyclerview.launcher.LauncherButtonsAdapter.java

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.recycler_view_item_launcher_button,
            parent, false);/*w  w w . j  a va 2 s.  c  o m*/
    ViewHolder holder = new ViewHolder(v);
    holder.mButton.setOnClickListener(this);
    return holder;
}

From source file:com.druk.bonjour.browser.ui.adapter.TxtRecordsAdapter.java

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

From source file:com.yanzhenjie.album.adapter.BasicPreviewAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    AttacherImageView imageView = new AttacherImageView(container.getContext());
    imageView.setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
    container.addView(imageView);//  ww  w.  j  av a 2s .  co m
    final PhotoViewAttacher attacher = new PhotoViewAttacher(imageView);
    imageView.setAttacher(attacher);

    Album.getAlbumConfig().getImageLoader().loadImage(imageView, getImagePath(mPreviewList.get(position)),
            DisplayUtils.screenWidth, DisplayUtils.screenHeight);
    return imageView;
}