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.mercandalli.android.apps.files.file.image.FileImageAdapter.java

@Override
public ViewHolder onCreateViewHolder(final ViewGroup parent, final int viewType) {
    if (viewType == TYPE_HEADER) {
        return new HeaderViewHolder(LayoutInflater.from(parent.getContext())
                .inflate(R.layout.view_file_header_image, parent, false), mHeaderIds, mOnHeaderClickListener);
    } else if (viewType == TYPE_ROW_CARDS_HEADER) {
        return new RowCardsViewHolder(
                LayoutInflater.from(parent.getContext()).inflate(R.layout.tab_file_row_cards, parent, false));
    }/*from  ww  w .j  ava2 s  .  c  o m*/
    return new FileViewHolder(new FileImageCardView(parent.getContext()), mHasHeader, mItemClickListener,
            mItemLongClickListener);
}

From source file:com.sakisds.icymonitor.fragments.history.HistoryPickerFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ViewGroup viewGroup = (ViewGroup) view;

    mEmptyView = view.findViewById(R.id.emptyhidden);
    mEmptyView.setOnClickListener(this);

    mProgressBar = view.findViewById(R.id.progressBar_list);

    mPullToRefreshLayout = new PullToRefreshLayout(viewGroup.getContext());

    ActionBarPullToRefresh.from(getActivity()).insertLayoutInto(viewGroup)
            .theseChildrenArePullable(android.R.id.list, android.R.id.empty).listener(this)
            .setup(mPullToRefreshLayout);

    mClient.setMaxRetriesAndTimeout(2, 2000);

    // Refresh fragment data
    refreshData();/*from   w w  w.  j  a  va2  s .  co m*/
}

From source file:com.lvfq.rabbit.swipe.SwipeRefreshListFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    // Create the list fragment's content view
    final View listFragmentView = super.onCreateView(inflater, container, savedInstanceState);

    // Now create a SwipeRefreshLayout to wrap the fragment's content view
    mSwipeRefreshLayout = new ListFragmentSwipeRefreshLayout(container.getContext());

    // Add the list fragment's content view to the SwipeRefreshLayout, making sure that it fills
    // the SwipeRefreshLayout
    mSwipeRefreshLayout.addView(listFragmentView, ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);

    // Make sure that the SwipeRefreshLayout will fill the fragment
    mSwipeRefreshLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    // Now return the SwipeRefreshLayout as this fragment's content view
    return mSwipeRefreshLayout;
}

From source file:com.potato.appstore.jiongtu.ui.fragment.JiongTuListFragment.java

@Nullable
@Override//  w ww  .  jav  a  2 s. co m
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    mSectionId = getArguments() == null ? 0 : getArguments().getLong(EXTRARS_SECTION_ID);
    mTitle = getArguments() == null ? "" : getArguments().getString(EXTRARS_TITLE);

    mBinding = DataBindingUtil.inflate(LayoutInflater.from(container.getContext()),
            R.layout.fragment_jiongtu_list, container, false);

    mParser = new JiongtuAlbumListParser();
    mBinding.swipeContainer.setFooterView(getActivity(), mBinding.list, R.layout.listview_footer);

    mAdapter = new JiongTuListAdapter(getActivity());
    mBinding.list.setAdapter(mAdapter);

    mBinding.swipeContainer.setColorSchemeResources(R.color.google_blue, R.color.google_green,
            R.color.google_red, R.color.google_yellow);

    mBinding.swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            sendRequest2RefreshList();
        }
    });
    mBinding.swipeContainer.setOnLoadListener(new ListSwipeLayout.OnLoadListener() {
        @Override
        public void onLoad() {
            sendRequest2LoadMoreList();
        }
    });

    mBinding.swipeContainer.setEmptyView(mBinding.emptyView);
    mBinding.emptyView.setOnClickListener(this);
    mBinding.swipeContainer.showProgress();
    sendRequest2RefreshList();

    return mBinding.getRoot();
}

From source file:com.xamoom.android.xamoomcontentblocks.Adapters.ContentBlock1Adapter.java

@NonNull
@Override/*from   w w  w .  jav a 2s . co  m*/
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, Fragment fragment, EnduserApi enduserApi,
        String youtubeApiKey, LruCache bitmapCache, LruCache contentCache, boolean showContentLinks,
        ContentBlock3ViewHolder.OnContentBlock3ViewHolderInteractionListener onContentBlock3ViewHolderInteractionListener,
        XamoomContentFragment.OnXamoomContentFragmentInteractionListener onXamoomContentFragmentInteractionListener) {
    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.content_block_1_layout, parent,
            false);
    return new ContentBlock1ViewHolder(view, fragment);
}

From source file:com.xamoom.android.xamoomcontentblocks.Adapters.ContentBlock4Adapter.java

@NonNull
@Override//from  ww  w.j ava  2s.c om
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, Fragment fragment, EnduserApi enduserApi,
        String youtubeApiKey, LruCache bitmapCache, LruCache contentCache, boolean showContentLinks,
        ContentBlock3ViewHolder.OnContentBlock3ViewHolderInteractionListener onContentBlock3ViewHolderInteractionListener,
        XamoomContentFragment.OnXamoomContentFragmentInteractionListener onXamoomContentFragmentInteractionListener) {
    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.content_block_4_layout, parent,
            false);
    return new ContentBlock4ViewHolder(view, fragment);
}

From source file:com.xamoom.android.xamoomcontentblocks.Adapters.ContentBlock5Adapter.java

@NonNull
@Override/*  ww w .j  av  a2s .  com*/
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, Fragment fragment, EnduserApi enduserApi,
        String youtubeApiKey, LruCache bitmapCache, LruCache contentCache, boolean showContentLinks,
        ContentBlock3ViewHolder.OnContentBlock3ViewHolderInteractionListener onContentBlock3ViewHolderInteractionListener,
        XamoomContentFragment.OnXamoomContentFragmentInteractionListener onXamoomContentFragmentInteractionListener) {
    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.content_block_5_layout, parent,
            false);
    return new ContentBlock5ViewHolder(view, fragment);
}

From source file:com.xamoom.android.xamoomcontentblocks.Adapters.ContentBlock8Adapter.java

@NonNull
@Override//from  w  w w .j  a va2 s .co  m
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, Fragment fragment, EnduserApi enduserApi,
        String youtubeApiKey, LruCache bitmapCache, LruCache contentCache, boolean showContentLinks,
        ContentBlock3ViewHolder.OnContentBlock3ViewHolderInteractionListener onContentBlock3ViewHolderInteractionListener,
        XamoomContentFragment.OnXamoomContentFragmentInteractionListener onXamoomContentFragmentInteractionListener) {
    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.content_block_8_layout, parent,
            false);
    return new ContentBlock8ViewHolder(view, fragment);
}

From source file:android.support.v7.preference.PreferenceGroupAdapter.java

@Override
public PreferenceViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    final PreferenceLayout pl = mPreferenceLayouts.get(viewType);
    final LayoutInflater inflater = LayoutInflater.from(parent.getContext());
    TypedArray a = parent.getContext().obtainStyledAttributes(null, R.styleable.BackgroundStyle);
    Drawable background = a.getDrawable(R.styleable.BackgroundStyle_android_selectableItemBackground);
    if (background == null) {
        background = parent.getContext().getResources()
                .getDrawable(android.R.drawable.list_selector_background);
    }//from   w ww .j av a  2  s . c o  m
    a.recycle();

    final View view = inflater.inflate(pl.resId, parent, false);
    if (view.getBackground() == null) {
        ViewCompat.setBackground(view, background);
    }

    final ViewGroup widgetFrame = (ViewGroup) view.findViewById(android.R.id.widget_frame);
    if (widgetFrame != null) {
        if (pl.widgetResId != 0) {
            inflater.inflate(pl.widgetResId, widgetFrame);
        } else {
            widgetFrame.setVisibility(View.GONE);
        }
    }

    return new PreferenceViewHolder(view);
}

From source file:com.xamoom.android.xamoomcontentblocks.Adapters.ContentBlock2Adapter.java

@NonNull
@Override/*from w w w .java 2 s.co  m*/
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, Fragment fragment, EnduserApi enduserApi,
        String youtubeApiKey, LruCache bitmapCache, LruCache contentCache, boolean showContentLinks,
        ContentBlock3ViewHolder.OnContentBlock3ViewHolderInteractionListener onContentBlock3ViewHolderInteractionListener,
        XamoomContentFragment.OnXamoomContentFragmentInteractionListener onXamoomContentFragmentInteractionListener) {
    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.content_block_2_layout, parent,
            false);
    return new ContentBlock2ViewHolder(view, fragment, youtubeApiKey, bitmapCache);
}