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.lzh.yuanstrom.adapter.ExpandableDraggableSwipeableExampleAdapter.java

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

From source file:com.moto.miletus.application.DeviceListAdapter.java

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    // create a new view
    View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.listitem_device, parent, false);
    return new ViewHolder(v, (TextView) v.findViewById(R.id.device_title),
            (TextView) v.findViewById(R.id.device_description), (ImageView) v.findViewById(R.id.device_picture),
            (ImageView) v.findViewById(R.id.ble_picture));
}

From source file:com.example.chinyao.mow.mow.recycler.SwipeableAdapter.java

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

From source file:com.lillicoder.demo.carouselview.DemoActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_demo);

    CarouselView carousel = (CarouselView) findViewById(R.id.carousel);
    carousel.setAdapter(new CarouselView.Adapter<Pair<String, Integer>>(getCarouselItems()) {
        @Override/*  w  w w .j a va  2  s  . c  o  m*/
        public boolean isViewFromObject(View view, Object object) {
            return view == object;
        }

        @Override
        public void onDestroyItem(ViewGroup container, int position, Object object) {
            container.removeView((View) object);
        }

        @Override
        public Object onInstantiateItem(ViewGroup container, int position) {
            Pair<String, Integer> pair = getItem(position);

            final LayoutInflater inflater = LayoutInflater.from(container.getContext());
            TextView view = (TextView) inflater.inflate(R.layout.view_carousel_item, container, false);
            view.setBackgroundResource(pair.second);
            view.setText(pair.first);

            container.addView(view);

            return view;
        }
    });
}

From source file:com.lloydtorres.stately.issues.IssueResultsRecyclerAdapter.java

@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    RecyclerView.ViewHolder viewHolder;/*from ww  w.j  av  a2  s. c  o  m*/
    LayoutInflater inflater = LayoutInflater.from(parent.getContext());
    View genericCard = inflater.inflate(R.layout.card_generic, parent, false);

    switch (viewType) {
    case NEWS_CARD:
        viewHolder = new NewsCard(context, genericCard);
        break;
    case POSITION_CARD:
        viewHolder = new PositionCard(context, genericCard);
        break;
    case POSTCARD_CARD:
        View postcardCard = inflater.inflate(R.layout.card_postcard, parent, false);
        viewHolder = new PostcardCard(context, postcardCard);
        break;
    case CENSUSDELTA_CARD:
        View censusDeltaCard = inflater.inflate(R.layout.card_census_delta, parent, false);
        viewHolder = new CensusDeltaCard(context, censusDeltaCard);
        break;
    default:
        View headlineCard = inflater.inflate(R.layout.card_headline, parent, false);
        viewHolder = new HeadlineCard(context, headlineCard);
        break;
    }
    return viewHolder;
}

From source file:com.grottworkshop.gwsmaterialcalendarview.MonthPagerAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    CalendarDay month = getItem(position);
    MonthView monthView = new MonthView(container.getContext(), month, firstDayOfTheWeek);
    monthView.setAlpha(0);/*from w ww.ja  v  a 2 s .  co m*/

    monthView.setWeekDayFormatter(weekDayFormatter);
    monthView.setDayFormatter(dayFormatter);
    monthView.setCallbacks(callbacks);
    if (color != null) {
        monthView.setSelectionColor(color);
    }
    if (dateTextAppearance != null) {
        monthView.setDateTextAppearance(dateTextAppearance);
    }
    if (weekDayTextAppearance != null) {
        monthView.setWeekDayTextAppearance(weekDayTextAppearance);
    }
    if (showOtherDates != null) {
        monthView.setShowOtherDates(showOtherDates);
    }
    monthView.setMinimumDate(minDate);
    monthView.setMaximumDate(maxDate);
    monthView.setSelectedDate(selectedDate);

    container.addView(monthView);
    currentViews.add(monthView);

    monthView.setDayViewDecorators(decoratorResults);

    return monthView;
}

From source file:com.owncloud.android.ui.adapter.UserListAdapter.java

@NonNull
@Override//from  w ww  .  j  av  a 2  s . c  o  m
public UserViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
    View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.file_details_share_user_item, parent,
            false);
    return new UserViewHolder(v);
}

From source file:com.tr4android.support.extension.internal.AccountAdapter.java

@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    switch (viewType) {
    case VIEW_TYPE_ACCOUNT:
        AccountViewHolder holder = new AccountViewHolder(LayoutInflater.from(parent.getContext())
                .inflate(R.layout.appcompat_extension_account_list_item, parent, false));
        holder.itemView.setOnClickListener(mAccountClickListener);
        return holder;
    case VIEW_TYPE_HEADER:
        return new HeaderViewHolder(mHeader);
    }/*from   w w w . ja va  2  s  .co  m*/
    return null;
}

From source file:com.umeng.common.ui.adapters.ImagePagerAdapter.java

private View createView(final ViewGroup parent, final ImageItem imageItem) {
    // //www  .  java 2  s .com
    int layoutResId = ResFinder.getLayout("umeng_comm_img_browser_item_layout");
    View rootView = LayoutInflater.from(parent.getContext()).inflate(layoutResId, parent, false);
    return setupWidgets(rootView, imageItem);
}

From source file:com.umeng.comm.ui.imagepicker.adapters.ImagePagerAdapter.java

private View createView(final ViewGroup parent, final ImageItem imageItem) {
    // //  w ww.j a  v  a 2  s.c  om
    int layoutResId = ResFinder.getLayout("umeng_commm_img_browser_item_layout");
    View rootView = LayoutInflater.from(parent.getContext()).inflate(layoutResId, parent, false);
    return setupWidgets(rootView, imageItem);
}