Java Code Examples for android.support.v7.widget.CardView#setOnClickListener()
The following examples show how to use
android.support.v7.widget.CardView#setOnClickListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CaptionedImagesAdapter.java From HeadFirstAndroid with MIT License | 8 votes |
@Override public void onBindViewHolder(ViewHolder holder, final int position) { CardView cardView = holder.cardView; ImageView imageView = (ImageView)cardView.findViewById(R.id.info_image); Drawable drawable = cardView.getResources().getDrawable(imageIds[position]); imageView.setImageDrawable(drawable); imageView.setContentDescription(captions[position]); TextView textView = (TextView)cardView.findViewById(R.id.info_text); textView.setText(captions[position]); cardView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (listener != null) { listener.onClick(position); } } }); }
Example 2
Source File: ReplyCheckerAdapter.java From Ouroboros with GNU General Public License v3.0 | 6 votes |
public ReplyCheckerViewHolder(View itemView) { super(itemView); rcCard = (CardView) itemView.findViewById(R.id.reply_checker_card); rcThreadName = (TextView) itemView.findViewById(R.id.reply_checker_thread_name); rcSubjectText = (TextView) itemView.findViewById(R.id.reply_checker_sub_text); rcCommentText = (TextView) itemView.findViewById(R.id.reply_checker_com_text); rcReplyCountText = (TextView) itemView.findViewById(R.id.reply_checker_reply_count); rcMarkAsReadButton = (ImageButton) itemView.findViewById(R.id.reply_checker_mark_as_read_button); replyCheckerObject = new ReplyCheckerObject(); rcThreadName.setTypeface(rcThreadName.getTypeface(), Typeface.BOLD); rcReplyCountText.setTypeface(rcReplyCountText.getTypeface(), Typeface.BOLD); rcMarkAsReadButton.setOnClickListener(this); rcCard.setOnClickListener(this); rcThreadName.setOnClickListener(this); rcSubjectText.setOnClickListener(this); rcCommentText.setOnClickListener(this); rcReplyCountText.setOnClickListener(this); }
Example 3
Source File: ReviewListAdapter.java From AndroidReview with GNU General Public License v3.0 | 6 votes |
private void createCardView(ViewHolder holder, List<Point> points) { for (int i = 0; i < points.size(); i++) { final Point point = points.get(i); View pointView = LayoutInflater.from(mContext).inflate(R.layout.carview_review, holder.ly_carview, false); TextView pointName = (TextView) pointView.findViewById(R.id.tv_carview); CardView cardView = (CardView) pointView.findViewById(R.id.cv_carview); //5.0CarView 才支持设置阴影 if(Build.VERSION.SDK_INT >=21) { cardView.setElevation(TDevice.dpToPixel(8)); } cardViewSetBackgroundColor(point, cardView); //如果不是无效知识点,则加入点击事件 if (point.getObjectId() != null) { cardView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startContentList(point); } }); } pointName.setText(point.getName()); holder.ly_carview.addView(pointView); } }
Example 4
Source File: EditShareMessageActivity.java From TestChat with Apache License 2.0 | 6 votes |
@Override public void initView() { edit = (EditText) findViewById(R.id.et_edit_share_message_edit); location = (TextView) findViewById(R.id.tv_edit_share_message_location); visibility = (TextView) findViewById(R.id.tv_edit_share_message_visibility); display = (RecyclerView) findViewById(R.id.rcv_edit_share_message_display); RelativeLayout visibilityContainer = (RelativeLayout) findViewById(R.id.rl_edit_share_message_visibility_container); video = (ImageView) findViewById(R.id.iv_edit_share_message_video); RelativeLayout locationLayout = (RelativeLayout) findViewById(R.id.rl_edit_share_message_location); urlAvatar = (ImageView) findViewById(R.id.iv_edit_share_message_url_avatar); urlTitle = (TextView) findViewById(R.id.tv_edit_share_message_url_title); mCardView = (CardView) findViewById(R.id.cv_edit_share_message_url_container); selectedFriend = (SwipeMenuRecyclerView) findViewById(R.id.swrc_edit_share_message_visibility); title = (TextView) findViewById(R.id.tv_edit_share_message_visibility_title); visibilityContainer.setOnClickListener(this); video.setOnClickListener(this); locationLayout.setOnClickListener(this); mCardView.setOnClickListener(this); }
Example 5
Source File: TVCastsOfPersonAdapter.java From PopCorn with Apache License 2.0 | 6 votes |
public TVShowViewHolder(View itemView) { super(itemView); tvShowCard = (CardView) itemView.findViewById(R.id.card_view_show_cast); tvShowPosterImageView = (ImageView) itemView.findViewById(R.id.image_view_show_cast); tvShowTitleTextView = (TextView) itemView.findViewById(R.id.text_view_title_show_cast); castCharacterTextView = (TextView) itemView.findViewById(R.id.text_view_cast_character_show_cast); tvShowPosterImageView.getLayoutParams().width = (int) (mContext.getResources().getDisplayMetrics().widthPixels * 0.31); tvShowPosterImageView.getLayoutParams().height = (int) ((mContext.getResources().getDisplayMetrics().widthPixels * 0.31) / 0.66); tvShowCard.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(mContext, TVShowDetailActivity.class); intent.putExtra(Constants.TV_SHOW_ID, mTVCasts.get(getAdapterPosition()).getId()); mContext.startActivity(intent); } }); }
Example 6
Source File: GankListAdapter.java From GankLock with GNU General Public License v3.0 | 6 votes |
public GankListHolder(View itemView, boolean isShow) { super(itemView); cardView = (CardView) itemView.findViewById(R.id.item_gank_card_view); cardView.setOnClickListener(this); category = (TextView) itemView.findViewById(R.id.item_gank_category); ccv = (ColorfulCircleView) itemView.findViewById(R.id.item_gank_ccv); who = (TextView) itemView.findViewById(R.id.item_gank_who); like = (ImageView) itemView.findViewById(R.id.item_gank_like); like.setOnClickListener(this); share = (ImageView) itemView.findViewById(R.id.item_gank_share); share.setOnClickListener(this); desc = (TextView) itemView.findViewById(R.id.item_gank_desc); if (isShow) { category.setVisibility(View.VISIBLE); } else { category.setVisibility(View.GONE); } }
Example 7
Source File: InfoRecyclerViewAdapter.java From Camera-Roll-Android-App with Apache License 2.0 | 5 votes |
private void setColor(CardView card, TextView text, int color) { if (Color.alpha(color) == 0) { //color not found card.setVisibility(View.GONE); return; } card.setCardBackgroundColor(color); text.setTextColor(getTextColor(text.getContext(), color)); String colorHex = String.format("#%06X", (0xFFFFFF & color)); text.setText(colorHex); card.setTag(colorHex); card.setOnClickListener(onClickListener); }
Example 8
Source File: AcNavigationRvAdapter.java From BlueBoard with Apache License 2.0 | 5 votes |
private void setButtonInfo(ImageView imgButton, TextView tvButton, CardView cvButton, int drawable, int color, final String partitionType) { imgButton.setBackgroundResource(drawable); tvButton.setText(partitionType); cvButton.setCardBackgroundColor(MyApplication.getInstance().getResources().getColor(color)); cvButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mOnClickListener.onClick(v, partitionType); } }); }
Example 9
Source File: DonateActivity.java From screenrecorder with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { String theme = PreferenceManager.getDefaultSharedPreferences(this) .getString(getString(R.string.preference_theme_key), Const.PREFS_LIGHT_THEME); switch (theme){ case Const.PREFS_DARK_THEME: setTheme(R.style.AppTheme_Dark); break; case Const.PREFS_BLACK_THEME: setTheme(R.style.AppTheme_Black); break; } super.onCreate(savedInstanceState); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } setContentView(R.layout.activity_donate); CardView donate1 = findViewById(R.id.donate_1); CardView donate2 = findViewById(R.id.donate_2); CardView donate5 = findViewById(R.id.donate_5); CardView donatePayPal = findViewById(R.id.donate_paypal); donate1.setOnClickListener(this); donate2.setOnClickListener(this); donate5.setOnClickListener(this); donatePayPal.setOnClickListener(this); setupPurchase(); }
Example 10
Source File: DonateActivity.java From screenrecorder with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { String theme = PreferenceManager.getDefaultSharedPreferences(this) .getString(getString(R.string.preference_theme_key), Const.PREFS_LIGHT_THEME); switch (theme) { case Const.PREFS_DARK_THEME: setTheme(R.style.AppTheme_Dark); break; case Const.PREFS_BLACK_THEME: setTheme(R.style.AppTheme_Black); break; } super.onCreate(savedInstanceState); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } setContentView(R.layout.activity_donate); CardView donatePayPal = findViewById(R.id.donate_paypal); CardView donateAlt = findViewById(R.id.donate_alt); donatePayPal.setOnClickListener(this); donateAlt.setOnClickListener(this); }
Example 11
Source File: HomeFragment.java From white-label-event-app with Apache License 2.0 | 5 votes |
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); final Activity activity = getActivity(); if (activity instanceof ContentHost) { host = (ContentHost) activity; host.setTitle(title); } final View root = getView(); if (root == null) { throw new IllegalStateException(); } vgMutex = (MutexViewGroup) root.findViewById(R.id.vg_mutex); final View content = root.findViewById(R.id.vg_content); vBeforeEvent = content.findViewById(R.id.v_before_event); vBeforeEvent.setVisibility(View.GONE); vAfterEvent = content.findViewById(R.id.v_after_event); vAfterEvent.setVisibility(View.GONE); cardHappeningNow = (CardView) content.findViewById(R.id.card_happening_now); cardHappeningNow.setVisibility(View.GONE); cardHappeningNow.setOnClickListener(new HappeningNowOnClickListener()); cardUpNext = (CardView) content.findViewById(R.id.card_up_next); cardUpNext.setVisibility(View.GONE); cardUpNext.setOnClickListener(new UpNextOnClickListener()); tvDescription = (TextView) content.findViewById(R.id.tv_description); updateUi(); }
Example 12
Source File: HomeItemAdapter.java From MangoBloggerAndroidApp with Mozilla Public License 2.0 | 5 votes |
private ViewHolder(View itemView) { super(itemView); // imageView = (ImageView) itemView.findViewById(R.id.imageView); parentCardView = (CardView) itemView.findViewById(R.id.parent_card); titleText = (TextView) itemView.findViewById(R.id.title); subtitleText = (TextView) itemView.findViewById(R.id.sub_title); // parentCardView.setRadius(8); parentCardView.setOnClickListener(this); // ratingTextView = (TextView) itemView.findViewById(R.id.ratingTextView); }
Example 13
Source File: AppListAdapter.java From CoolApk-Console with GNU General Public License v3.0 | 5 votes |
@Override public @NonNull View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { if (convertView == null) { convertView = LayoutInflater.from(mContext) .inflate(R.layout.item_app, parent, false); } final AppItem item = mList.get(position); CardView card = (CardView)convertView.findViewById(R.id.item_card); ImageView icon = (ImageView)convertView.findViewById(R.id.item_icon); TextView title = (TextView)convertView.findViewById(R.id.item_title); TextView subtitle = (TextView)convertView.findViewById(R.id.item_subtitle); TextView context = (TextView)convertView.findViewById(R.id.item_context); Glide.with(mContext) .load(item.getIcon()) .into(icon); title.setText(item.getName()); subtitle.setText(item.getStatus()); context.setText(mContext.getString(R.string.apk_item_context, item.getDownloads())); // Card's clicking listener card.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mContext.startActivity(new Intent(mContext, DetailActivity.class) .putExtra(DetailActivity.EXTRA_APP_ITEM, item)); } }); return convertView; }
Example 14
Source File: VideoAdapter.java From PopCorn with Apache License 2.0 | 5 votes |
public VideoViewHolder(View itemView) { super(itemView); videoCard = (CardView) itemView.findViewById(R.id.card_view_video); videoImageView = (ImageView) itemView.findViewById(R.id.image_view_video); videoTextView = (TextView) itemView.findViewById(R.id.text_view_video_name); videoCard.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent youtubeIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(Constants.YOUTUBE_WATCH_BASE_URL + mVideos.get(getAdapterPosition()).getKey())); mContext.startActivity(youtubeIntent); } }); }
Example 15
Source File: SearchableSpinner.java From searchablespinner with Apache License 2.0 | 5 votes |
@Override protected void onFinishInflate() { super.onFinishInflate(); mRevealContainerCardView = (CardView) findViewById(R.id.CrdVw_RevealContainer); mRevealContainerCardView.setOnClickListener(mOnRevelViewClickListener); mRevealItem = (LinearLayout) findViewById(R.id.FrmLt_SelectedItem); mStartSearchImageView = (IconTextView) findViewById(R.id.ImgVw_StartSearch); mContainerCardView = (CardView) findViewById(R.id.CrdVw_Container); mSearchEditText = (AppCompatEditText) findViewById(R.id.EdtTxt_SearchEditText); mDoneSearchImageView = (IconTextView) findViewById(R.id.ImgVw_DoneSearch); init(); }
Example 16
Source File: CardsFragment.java From iGap-Android with GNU Affero General Public License v3.0 | 4 votes |
private void addEmptyCard() { Context context = getContext(); int dp8 = RaadCommonUtils.getPx(8, context); int dp16 = RaadCommonUtils.getPx(16, context); int cardHeight = BankCardView.getDefaultCardHeight(getContext()); CardView cardView = new CardView(context); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, cardHeight); params.setMargins(dp16, 0, dp16, dp16); cardView.setLayoutParams(params); if (WalletActivity.isDarkTheme) { cardView.setCardBackgroundColor(Color.parseColor(WalletActivity.backgroundTheme_2)); } else { cardView.setCardBackgroundColor(Color.parseColor(WalletActivity.backgroundTheme)); } cardView.setPreventCornerOverlap(false); cardView.setCardElevation(RaadCommonUtils.getPx(6, context)); cardView.setRadius(RaadCommonUtils.getPx(8, context)); cardsLayout.addView(cardView); viewItems.add(cardView); TextView textView = new TextView(context); CardView.LayoutParams textViewParams = new CardView.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); textViewParams.gravity = Gravity.CENTER; textView.setLayoutParams(textViewParams); textView.setGravity(Gravity.CENTER); textView.setTextColor(Color.parseColor(WalletActivity.textTitleTheme)); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16); textView.setTypeface(Typefaces.get(context, Typefaces.IRAN_YEKAN_REGULAR)); textView.setText(R.string.click_here_for_adding_card); cardView.addView(textView); cardView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ((NavigationBarActivity) getActivity()).pushFullFragment( new AddCardFragment(), "AddCardFragment"); } }); }
Example 17
Source File: FabSpeedDial.java From fab-speed-dial with Apache License 2.0 | 4 votes |
private View createFabMenuItem(MenuItem menuItem) { ViewGroup fabMenuItem = (ViewGroup) LayoutInflater.from(getContext()) .inflate(getMenuItemLayoutId(), this, false); FloatingActionButton miniFab = (FloatingActionButton) fabMenuItem.findViewById(R.id.mini_fab); CardView cardView = (CardView) fabMenuItem.findViewById(R.id.card_view); TextView titleView = (TextView) fabMenuItem.findViewById(R.id.title_view); fabMenuItemMap.put(miniFab, menuItem); cardViewMenuItemMap.put(cardView, menuItem); miniFab.setImageDrawable(menuItem.getIcon()); miniFab.setOnClickListener(this); cardView.setOnClickListener(this); ViewCompat.setAlpha(miniFab, 0f); ViewCompat.setAlpha(cardView, 0f); final CharSequence title = menuItem.getTitle(); if (!TextUtils.isEmpty(title) && miniFabTitlesEnabled) { cardView.setCardBackgroundColor(miniFabTitleBackgroundTint.getDefaultColor()); titleView.setText(title); titleView.setTypeface(null, Typeface.BOLD); titleView.setTextColor(miniFabTitleTextColor); if (miniFabTitleTextColorArray != null) { titleView.setTextColor(ContextCompat.getColorStateList(getContext(), miniFabTitleTextColorArray[menuItem.getOrder()])); } } else { fabMenuItem.removeView(cardView); } miniFab.setBackgroundTintList(miniFabBackgroundTint); if (miniFabBackgroundTintArray != null) { miniFab.setBackgroundTintList(ContextCompat.getColorStateList(getContext(), miniFabBackgroundTintArray[menuItem.getOrder()])); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { miniFab.setImageTintList(miniFabDrawableTint); } return fabMenuItem; }
Example 18
Source File: BaseLearningActivity.java From allenglish with Apache License 2.0 | 4 votes |
private void addView(List<LeanCloudApiBean.ResultsEntity> list) { LayoutInflater inflater = LayoutInflater.from(mContext); //实例化一个LinearLayout LinearLayout linear = new LinearLayout(this); //设置LinearLayout属性(宽和高) LinearLayout.LayoutParams layoutParams=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 120); //将以上的属性赋给LinearLayout linear.setLayoutParams(layoutParams); ImageLoader imageLoader = new ImageLoader(VolleySingleton.getInstance().getRequestQueue(), BaseApplication.getInstance().getBitmapCache()); for (final LeanCloudApiBean.ResultsEntity lc : list) { // 获取需要添加的布局 CardView layout = (CardView) inflater.inflate( R.layout.item_article_list, linear).findViewById(R.id.card_view); if (layout.getParent() != null) ((LinearLayout) layout.getParent()).removeView(layout); // <- fix // 将布局加入到当前布局中 linearLayout.addView(layout); TextView title = (TextView) layout.findViewById(R.id.title); TextView source = (TextView) layout.findViewById(R.id.source); NetworkImageView picture = (NetworkImageView) layout.findViewById(R.id.picture); if (lc.type == 0) { title.setText(lc.title); try { source.setText(lc.source + " " + TimeUtils.DATE_FORMAT_DATE.format(TimeUtils.FULL_DATE_FORMAT_DATE.parse(lc.postTime.iso))); } catch (ParseException e) { e.printStackTrace(); } if (isShowPicture) { if (lc.imageUrl.isEmpty()) { picture.setVisibility(View.GONE); } else { picture.setVisibility(View.VISIBLE); picture.setDefaultImageResId(R.drawable.ic_default); picture.setErrorImageResId(R.drawable.ic_default); picture.setImageUrl(lc.imageUrl, imageLoader); } } else { picture.setVisibility(View.GONE); } layout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = getIntent(); intent.putExtra("BEAN", lc); intent.putExtra("TABLE_NAME", tableName); intent.putExtra("BILINGUAL_READING_TAG", bilingualReadingTag); finish(); startActivity(intent); } }); } else { NativeADDataRef nativeADDataRef = lc.nativeADDataRef; title.setText(nativeADDataRef.getTitle() != null ? nativeADDataRef.getTitle() : nativeADDataRef.getSubTitle()); source.setText("广告"); if (isShowPicture) { picture.setImageUrl(nativeADDataRef.getImage(), imageLoader); picture.setDefaultImageResId(R.drawable.ic_default); picture.setErrorImageResId(R.drawable.ic_default); } else { picture.setVisibility(View.GONE); } CommonUtils.setAds(layout, lc.iflyNativeAd, nativeADDataRef); adCardView = layout; nativeADDataRef2 = nativeADDataRef; } } }
Example 19
Source File: ReviewsFragment.java From v2ex with Apache License 2.0 | 4 votes |
private void initHeader(View header) { if (mFeed != null) { ImageLoader imageLoader = new ImageLoader(getActivity(), R.drawable.person_image_empty); CardView cardView = (CardView) header.findViewById(R.id.nodeCard); TextView title = (TextView) header.findViewById(R.id.title); HtmlTextView content = (HtmlTextView) header.findViewById(R.id.content); ImageView avatar = (ImageView) header.findViewById(R.id.avatar); TextView name = (TextView) header.findViewById(R.id.name); TextView time = (TextView) header.findViewById(R.id.time); TextView replies = (TextView) header.findViewById(R.id.replies); TextView nodeTitle = (TextView) header.findViewById(R.id.node_title); title.setText(mFeed.title); content.setVisibility(View.VISIBLE); content.setHtmlFromString(mFeed.content_rendered, false); // content.setText(Html.fromHtml(mFeed.content_rendered, new URLImageParser(getActivity(), content), null)); if (mFeed.member != null) { String avatarUrl = mFeed.member.avatar_large; if (avatarUrl != null) { avatarUrl = avatarUrl.startsWith("http:") ? avatarUrl : "http:" + avatarUrl; } else { avatarUrl = ""; } imageLoader.loadImage(avatarUrl, avatar); name.setText(mFeed.member.username); } if (mFeed.node != null) { nodeTitle.setText(mFeed.node.title); cardView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = FeedsActivity.getCallingIntent(getActivity(), mFeed.node.title, mFeed.node.id); startActivity(intent); } }); } time.setText(DateUtils.getRelativeTimeSpanString(mFeed.last_modified * 1000, System.currentTimeMillis(), DateUtils.MINUTE_IN_MILLIS)); replies.setText(mFeed.replies + getString(R.string.noun_reply)); } }
Example 20
Source File: NavigationItem.java From android-AutofillFramework with Apache License 2.0 | 4 votes |
public NavigationItem(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.NavigationItem, defStyleAttr, defStyleRes); int activityMinSdk = typedArray.getInteger(R.styleable.NavigationItem_minSdk, 26); // TODO: Remove BuildCompat.isAtLeastP() check when API 28 is finalized. int deviceMinSdk = BuildCompat.isAtLeastP() ? 28 : Build.VERSION.SDK_INT; if (deviceMinSdk < activityMinSdk) { // If device's SDK is lower than the minSdk specified by the NavigationItem, hide it. setVisibility(View.GONE); return; } String labelText = typedArray.getString(R.styleable.NavigationItem_labelText); String infoText = typedArray.getString(R.styleable.NavigationItem_infoText); Drawable logoDrawable = typedArray.getDrawable(R.styleable.NavigationItem_itemLogo); @ColorRes int colorRes = typedArray.getResourceId(R.styleable.NavigationItem_imageColor, 0); String launchingActivityName = typedArray.getString(R.styleable.NavigationItem_destinationActivityName); int imageColor = ContextCompat.getColor(getContext(), colorRes); typedArray.recycle(); View rootView = LayoutInflater.from(context).inflate(R.layout.navigation_item, this); TextView buttonLabel = rootView.findViewById(R.id.buttonLabel); buttonLabel.setText(labelText); if (logoDrawable != null) { Drawable mutatedLogoDrawable = logoDrawable.mutate(); mutatedLogoDrawable.setColorFilter(imageColor, PorterDuff.Mode.SRC_IN); buttonLabel.setCompoundDrawablesRelativeWithIntrinsicBounds(mutatedLogoDrawable, null, null, null); } InfoButton infoButton = rootView.findViewById(R.id.infoButton); infoButton.setInfoText(infoText); infoButton.setColorFilter(imageColor); CardView outerView = rootView.findViewById(R.id.cardView); outerView.setOnClickListener((view) -> { if (launchingActivityName != null) { Intent intent = new Intent(); intent.setClassName(getContext().getPackageName(), launchingActivityName); context.startActivity(intent); } else { Log.w(TAG, "Launching Activity name not set."); } }); }