List of usage examples for android.view ViewGroup getContext
@ViewDebug.CapturedViewProperty public final Context getContext()
From source file:com.rks.musicx.ui.adapters.ArtistListAdapter.java
@Override public ArtistViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(parent.getContext()).inflate(layoutID, parent, false); return new ArtistViewHolder(itemView); }
From source file:augsburg.se.alltagsguide.navigation.NavigationAdapter.java
@Override public NavigationViewHolder onCreateViewHolder(ViewGroup parent) { return new NavigationViewHolder( LayoutInflater.from(parent.getContext()).inflate(R.layout.navigation_item, parent, false)); }
From source file:com.google.android.leanbackjank.presenter.HeaderItemPresenter.java
@Override public ViewHolder onCreateViewHolder(ViewGroup viewGroup) { mUnselectedAlpha = viewGroup.getResources().getFraction(R.fraction.lb_browse_header_unselect_alpha, 1, 1); LayoutInflater inflater = (LayoutInflater) viewGroup.getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.header_item, null); view.setAlpha(mUnselectedAlpha); // Initialize icons to be at half-opacity. return new ViewHolder(view); }
From source file:arun.com.chromer.webheads.ui.context.WebsiteAdapter.java
@Override public WebSiteHolder onCreateViewHolder(ViewGroup parent, int viewType) { return new WebSiteHolder(LayoutInflater.from(parent.getContext()) .inflate(R.layout.activity_web_head_context_item_template, parent, false)); }
From source file:ca.rmen.android.scrumchatter.meeting.list.MeetingsCursorAdapter.java
@Override public MeetingViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { MeetingListItemBinding binding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.meeting_list_item, parent, false); binding.getRoot().setTag(binding);//ww w . j a v a 2 s . c o m return new MeetingViewHolder(binding); }
From source file:com.thatkawaiiguy.meleehandbook.adapter.SearchAdapter.java
@Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { if (viewType == 0) { View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.term_layout, parent, false); return new TermAdapter.ViewHolder(v); } else if (viewType == 1) { View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.card_layout, parent, false); return new TermAdapter.ViewHolder(v); }/*from w w w . java 2s . c o m*/ View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.card_layout, parent, false); return new TermAdapter.ViewHolder(v); }
From source file:com.example.igorklimov.popularmoviesdemo.helpers.CustomAdapter.java
@Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { Log.d(LOG_TAG, "onCreateViewHolder: "); View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_movie, parent, false); ImageView posterImageView = (ImageView) view.findViewById(R.id.poster); boolean isTablet = Utility.isTabletPreference(mContext); if (mMinWidth == 0) { if (isTablet && mOrientation == Configuration.ORIENTATION_PORTRAIT) { mMinHeight = mRecyclerView.getHeight(); mMinWidth = (int) (((double) mMinHeight / 278) * 185); } else {// www . ja v a 2 s . c o m mMinWidth = mRecyclerView.getWidth() / (mOrientation == Configuration.ORIENTATION_LANDSCAPE || isTablet ? 3 : 2); mMinHeight = (int) (((double) mMinWidth / 185) * 278); } } posterImageView.setMinimumWidth(mMinWidth); posterImageView.setMinimumHeight(mMinHeight); return new ViewHolder(view); }
From source file:android.arch.lifecycle.testapp.CollectingSupportFragment.java
@Nullable @Override/*from w w w .jav a 2s. c o m*/ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { //noinspection ConstantConditions FrameLayout layout = new FrameLayout(container.getContext()); layout.setId(R.id.child_fragment_container); return layout; }
From source file:de.kodejak.hashr.fragmentPreference.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.fragmentpref_layout, container, false); this.mContext = container.getContext(); SharedPreferences mySharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity()); boolean my_checkbox_upper = mySharedPreferences.getBoolean("uppercase_hash", false); boolean my_checkbox_trim = mySharedPreferences.getBoolean("trim_hash", true); checkUpper = (CheckBox) rootView.findViewById(R.id.checkPrefUppercase); checkUpper.setChecked(my_checkbox_upper); checkUpper.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override/*from ww w. j a v a 2 s . c om*/ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { checkUpper.setChecked(isChecked); SharedPreferences mySharedPreferences = PreferenceManager .getDefaultSharedPreferences(getActivity()); mySharedPreferences.edit().putBoolean("uppercase_hash", isChecked).commit(); } }); checkTrim = (CheckBox) rootView.findViewById(R.id.checkPrefTrim); checkTrim.setChecked(my_checkbox_trim); checkTrim.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { checkTrim.setChecked(isChecked); SharedPreferences mySharedPreferences = PreferenceManager .getDefaultSharedPreferences(getActivity()); mySharedPreferences.edit().putBoolean("trim_hash", isChecked).commit(); } }); return rootView; }
From source file:com.domowe.apki.lista2.MyDraggableWithSectionItemAdapter2.java
@Override public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { final LayoutInflater inflater = LayoutInflater.from(parent.getContext()); final View v = inflater.inflate(R.layout.list_item_draggable_64_main, parent, false); return new MyViewHolder(v); }