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.sakisds.icymonitor.fragments.ProcessesFragment.java

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

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

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

    // Refresh fragment data
    refreshData();//from w w  w.  j a v  a 2s . c o  m
}

From source file:com.tompee.funtablayout.FlipTabAdapter.java

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    FlipTabView itemView = new FlipTabView(parent.getContext());
    itemView.setLayoutParams(createLayoutParamsForTabs(parent));
    ViewCompat.setPaddingRelative(itemView, mTabPaddingStart, mTabPaddingTop, mTabPaddingEnd,
            mTabPaddingBottom);/*from  w w  w . j av  a 2s .  c om*/
    itemView.setBackgroundResource(mTabBackgroundResId);
    itemView.setIconDimension(mIconDimension);
    itemView.setTextAppearance(mTabTextAppearance);
    itemView.setMaxLines(MAX_TAB_TEXT_LINES);
    itemView.setSelectedTextColor(mTabIndicatorColor);
    return new ViewHolder(itemView);
}

From source file:com.tompee.funtablayout.SimpleTabAdapter.java

@Override
public SimpleTabAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    TabTextView tabTextView = new TabTextView(parent.getContext());
    tabTextView.setLayoutParams(createLayoutParamsForTabs(parent));
    ViewCompat.setPaddingRelative(tabTextView, mTabPaddingStart, mTabPaddingTop, mTabPaddingEnd,
            mTabPaddingBottom);// w  w w  .  j a  v  a  2  s  .  c  om
    TextViewCompat.setTextAppearance(tabTextView, mTabTextAppearance);
    tabTextView.setGravity(Gravity.CENTER);
    tabTextView.setMaxLines(MAX_TAB_TEXT_LINES);
    tabTextView.setEllipsize(TextUtils.TruncateAt.END);

    /** Set background */
    tabTextView.setBackgroundResource(mTabBackgroundResId);

    /** Set tab selected color */
    tabTextView.setTextColor(
            tabTextView.createColorStateList(tabTextView.getCurrentTextColor(), mTabSelectedTextColor));
    return new ViewHolder(tabTextView);
}

From source file:ch.ccapps.android.zeneggen.fragment.CarShareFragment.java

@Nullable
@Override// w  w  w .  java2 s .  c o  m
public ViewHolder createViewHolderFor(@NonNull ViewGroup parent, int type) {
    if (type == SectionRecyclerAdapter.DATA_TYPE) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_carshare_item, parent,
                false);
        //view.setBackgroundResource(mBackground);
        return new CarShareViewHolder(view);
    } else if (type == SectionRecyclerAdapter.SECTION_TYPE) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_section_header_item, parent,
                false);
        return new SectionViewHolder(view);
    } else {
        return null;
    }

}

From source file:ch.ccapps.android.zeneggen.fragment.HotelListFragment.java

@Nullable
@Override//from   w  ww . j a v  a 2  s.co  m
public ViewHolder createViewHolderFor(@NonNull ViewGroup parent, int type) {
    if (type == SectionRecyclerAdapter.DATA_TYPE) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item, parent, false);
        //view.setBackgroundResource(mBackground);
        return new HotelRestViewHolder(view);
    } else if (type == SectionRecyclerAdapter.SECTION_TYPE) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_section_header_item, parent,
                false);
        return new SectionViewHolder(view);
    } else {
        return null;
    }

}

From source file:com.davidmiguel.gobees.hive.RecordingsAdapter.java

@Override
public RecordingViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.hive_recordings_list_item, parent,
            false);//from ww w .j  ava 2  s.com
    return new RecordingViewHolder(view);
}

From source file:com.twolinessoftware.smarterlist.view.MasterSmartListCategoryRecyclerViewAdapter.java

@Override
public GenericListViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_listview, parent, false);

    GenericListViewHolder vh = new GenericListViewHolder(v);

    v.setOnClickListener(v1 -> {/*ww  w  . j a v a2  s .  com*/
        MasterSmartCategory category = (MasterSmartCategory) v1.getTag();
        ViewCompat.setTransitionName(v1, "viewtransition_" + category.getId());

        m_eventBus.post(new OnNavigateToCategory(v1, category));
    });

    return vh;
}

From source file:com.example.matt.bingeList.viewControllers.fragments.movies.MovieWatchListFragment.java

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

    mRecyclerView = (RecyclerView) inflater.inflate(R.layout.recycler_view, container, false);

    mUiRealm = ((MyApplication) getActivity().getApplication()).getUiRealm();
    mContext = container.getContext();

    if (getArguments().getInt("watched") == 1) {
        mWatchListAdapter = null;/*from   www .j a  va 2 s  . c om*/
        mWatchedAdapter = new WatchedMoviesAdapter(new RealmList<Movie>(), getContext(), mUiRealm);
        mRecyclerView.setAdapter(mWatchedAdapter);
    } else {
        mWatchedAdapter = null;
        mWatchListAdapter = new MovieWatchlistAdapter(new RealmList(), getContext(), mUiRealm);
        mRecyclerView.setAdapter(mWatchListAdapter);
    }

    mRecyclerView.setHasFixedSize(true);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));

    sort(PreferencesHelper.getMovieSort(mContext));

    return mRecyclerView;
}

From source file:com.mifos.mifosxdroid.online.SurveyQuestionFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.fragment_survey_question, container, false);
    ButterKnife.inject(this, view);
    thiscontext = container.getContext();
    mQuestionDatas = (new Gson()).fromJson(getArguments().getString(QUESTION_DATA), QuestionDatas.class);
    mScorecardValues = new ScorecardValues();

    tv_question.setText(mQuestionDatas.getText());

    ViewGroup hourButtonLayout = (ViewGroup) view.findViewById(R.id.radio1);
    for (int i = 0; i < mQuestionDatas.getResponseDatas().size(); i++) {
        button1 = new RadioButton(thiscontext);
        button1.setId(i);/*w ww.  java  2 s. c  o m*/
        button1.setText(mQuestionDatas.getResponseDatas().get(i).getText());
        hourButtonLayout.addView(button1);
        radioGroup1.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            public void onCheckedChanged(RadioGroup mRadioGroup2, int checkedId2) {
                for (int j = 0; j < mRadioGroup2.getChildCount(); j++) {
                    btn = (RadioButton) mRadioGroup2.getChildAt(j);
                    int t = mRadioGroup2.getId();
                    Log.d(LOG_TAG, "" + t);

                    if (btn.getId() == checkedId2) {
                        answer = btn.getText().toString();
                        mScorecardValues.setQuestionId(mQuestionDatas.getQuestionId());
                        mScorecardValues
                                .setResponseId(mQuestionDatas.getResponseDatas().get(j).getResponseId());
                        mScorecardValues.setValue(mQuestionDatas.getResponseDatas().get(j).getValue());
                        mCallback.answer(mScorecardValues);
                        Log.d(LOG_TAG,
                                "Q R V" + mQuestionDatas.getQuestionId() + " "
                                        + mQuestionDatas.getResponseDatas().get(j).getResponseId() + " "
                                        + mQuestionDatas.getResponseDatas().get(j).getValue());
                        return;
                    }
                }
            }
        });
    }

    return view;
}

From source file:app.hanks.com.testadvancerecyclerview.MyDraggableSwipeableItemAdapter.java

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