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.h6ah4i.android.example.advrecyclerview.demo_composition_all.MySwipeableAdapter.java

@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item, parent, false);
    MyViewHolder vh = new MyViewHolder(v);
    vh.containerView.setOnClickListener(this);
    return vh;/*from w ww.  j a v  a2  s  .  c  o  m*/
}

From source file:com.h6ah4i.android.example.advrecyclerview.demo_d.MyDraggableItemAdapter.java

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

From source file:com.uprayzner.mediator.adapters.PlanStandsListAdapter.java

@SuppressLint("InflateParams")
@Override//ww  w .j a v  a2  s.  co m
public PlanStandsListAdapter.StandViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    return new StandViewHolder(
            LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_stand_item, null, false));
}

From source file:com.example.admin.news.mvp.ui.adapter.NewsChannelAdapter.java

@Override
public NewsChannelViewHolder onCreateViewHolder(ViewGroup parent, final int viewType) {
    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_news_channel, parent, false);
    final NewsChannelViewHolder newsChannelViewHolder = new NewsChannelViewHolder(view);
    handleLongPress(newsChannelViewHolder);
    handleOnClick(newsChannelViewHolder);
    return newsChannelViewHolder;
}

From source file:com.jio.mhood.services.api.settings.LicensesFragment.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override/*from  w  w  w  .  j  ava2s.c om*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup view = (ViewGroup) inflater.inflate(R.layout.fragment_licenses, container, false);

    if (mWebView == null) {
        mWebView = new WebView(view.getContext());
        mWebView.setLayoutParams(
                new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
        mWebView.setWebChromeClient(new WebChromeClient());
        mWebView.setBackgroundColor(0);

        WebSettings webSettings = mWebView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        webSettings.setDomStorageEnabled(true);
        webSettings.setPluginState(PluginState.ON_DEMAND);
        webSettings.setPluginState(PluginState.ON);
        webSettings.setBuiltInZoomControls(true);
        webSettings.setUseWideViewPort(true);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            webSettings.setDisplayZoomControls(false);
        }

        mWebView.loadUrl(URL);
    } else {
        mParent.removeView(mWebView);
    }
    mParent = view;
    mParent.addView(mWebView);

    return mParent;
}

From source file:com.sherpasteven.sscte.Views.RecyclerView.CardAdapter.java

/**
 * Setup viewholder based on the XML.//from w ww  . j av  a  2  s.  com
 * @param viewGroup ViewGroup to style with the xml
 * @param viewType ViewType, unused.
 * @return Viewholder for the cards.
 */
@Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
    // Create a new view.
    View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.card_item, viewGroup, false);

    return new ViewHolder(v);
}

From source file:com.awesome.byunghwa.app.popularmoviesapp2.adapter.MovieListRecyclerViewAdapter.java

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

From source file:com.example.jony.myapp.reader_APP.adapter.ReadingItemAdapter.java

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_reading, parent, false);
    final ViewHolder vh = new ViewHolder(itemView);

    return vh;/* w  w  w  .j  a  v  a2  s  .  com*/
}

From source file:com.example.repository_pattern_demo.ui.GithubUsersAdapter.java

@Override
public BaseHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    LayoutInflater inflater = LayoutInflater.from(parent.getContext());
    switch (viewType) {
    case TYPE_USER:
        return new UserHolder(LiUserBinding.inflate(inflater, parent, false));
    case TYPE_LOAD_MORE:
        return new LoadMoreHolder(LiLoadMoreBinding.inflate(inflater, parent, false));
    default:/*from  ww  w .j av  a  2s.  co  m*/
        return null;
    }
}

From source file:com.sherpasteven.sscte.Views.RecyclerView.ViewFriendsCardAdapter.java

@Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
    // Create a new view.
    View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.card_item, viewGroup, false);

    return new ViewHolder(v);
}