/** Sets Buttons visibility */ @SuppressWarnings("deprecation") @SuppressLint("NewApi") protected void setupButtons() { if (mCardHeader.isButtonOverflowVisible()) { visibilityButtonHelper(VISIBLE, GONE, GONE); // Add popup addPopup(); } else { if (mCardHeader.isButtonExpandVisible()) { visibilityButtonHelper(GONE, VISIBLE, GONE); } else { if (mCardHeader.isOtherButtonVisible() && mImageButtonOther != null) { visibilityButtonHelper(GONE, GONE, VISIBLE); // Check if button is not null if (mImageButtonOther != null) { if (mCardHeader.getOtherButtonDrawable() > 0) { if (Build.VERSION.SDK_INT >= 16) { mImageButtonOther.setBackground( getResources().getDrawable(mCardHeader.getOtherButtonDrawable())); } else { mImageButtonOther.setBackgroundDrawable( getResources().getDrawable(mCardHeader.getOtherButtonDrawable())); } } addOtherListener(); } } else { visibilityButtonHelper(GONE, GONE, GONE); } } } }