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.mifos.mifosxdroid.adapters.CentersListAdapter.java

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

From source file:com.ymsfd.practices.ui.adapter.fancy.RecyclerListAdapter.java

@Override
public ItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_main, parent, false);
    view.setOnClickListener(new View.OnClickListener() {
        @Override/* ww w.  j a  v a  2s.  c om*/
        public void onClick(View view) {
            WTLogger.d(getClass().getSimpleName(), "onClick");
        }
    });
    return new ItemViewHolder(view);
}

From source file:arun.com.popularmovies.adapters.GridAdapter.java

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

From source file:com.google.samples.apps.ledtoggler.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),
            (TextView) v.findViewById(R.id.device_device_type),
            (ImageView) v.findViewById(R.id.device_picture));
}

From source file:com.veniosg.dir.android.dialog.DetailsDialog.java

private void addDetailsItem(ViewGroup container, int titleResId, String value) {
    from(container.getContext()).inflate(R.layout.item_details, container);

    ((TextView) getChildAtFromEnd(container, 1)).setText(titleResId);
    ((TextView) getLastChild(container)).setText(value);
}

From source file:de.kuschku.quasseldroid_ng.ui.coresettings.network.server.NetworkServerAdapter.java

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

From source file:com.ahmadrosid.lib.baseapp.core.BaseFragment.java

public View inflate(ViewGroup container, int layoutRes) {
    return LayoutInflater.from(container.getContext()).inflate(layoutRes, container, false);
}

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

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

From source file:com.LogIn.AdvancedPagerAdapter.java

/**
 * Instantiate the {@link View} which should be displayed at {@code position}. Here we
 * inflate a layout from the apps resources and then change the text view to signify the position.
 *///from   w w w . jav a 2 s .c  om
@Override
public Object instantiateItem(final ViewGroup container, int position) {
    final View view;
    LayoutInflater inflater = LayoutInflater.from(container.getContext());

    if (Utility.LogInType.equals("Sleepiness")) {
        view = inflater.inflate(R.layout.visualization_scroll_sleepiness, container, false);
        container.addView(view);
        CalendarViewSleepiness cal = (CalendarViewSleepiness) view.findViewById(R.id.CalendarViewSleepiness);
        cal.setPageIndex(position);
    } else if (Utility.LogInType.equals("Depression")) {
        view = inflater.inflate(R.layout.visualization_scroll_depression, container, false);
        container.addView(view);
        CalendarViewDepression cal = (CalendarViewDepression) view.findViewById(R.id.CalendarViewDepression);
        cal.setPageIndex(position);
    } else {
        view = inflater.inflate(R.layout.visualization_scroll_mood, container, false);
        container.addView(view);
        CalendarViewMood cal = (CalendarViewMood) view.findViewById(R.id.CalendarViewMood);
        cal.setPageIndex(position);
    }
    return view;
}

From source file:com.tmall.ultraviewpager.sample.UltraPagerAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    LinearLayout linearLayout = (LinearLayout) LayoutInflater.from(container.getContext())
            .inflate(R.layout.layout_child, null);
    //new LinearLayout(container.getContext());
    TextView textView = (TextView) linearLayout.findViewById(R.id.pager_textview);
    textView.setText(position + "");
    linearLayout.setId(R.id.item_id);//  ww w .  java  2 s .  c o  m
    switch (position) {
    case 0:
        linearLayout.setBackgroundColor(Color.parseColor("#2196F3"));
        break;
    case 1:
        linearLayout.setBackgroundColor(Color.parseColor("#673AB7"));
        break;
    case 2:
        linearLayout.setBackgroundColor(Color.parseColor("#009688"));
        break;
    case 3:
        linearLayout.setBackgroundColor(Color.parseColor("#607D8B"));
        break;
    case 4:
        linearLayout.setBackgroundColor(Color.parseColor("#F44336"));
        break;
    }
    container.addView(linearLayout);
    //        linearLayout.getLayoutParams().width = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 180, container.getContext().getResources().getDisplayMetrics());
    //        linearLayout.getLayoutParams().height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 400, container.getContext().getResources().getDisplayMetrics());
    return linearLayout;
}