Esempio n. 1
0
 @Override
 public final boolean isEnabled(int position) {
   ItemType item = getItem(position);
   if (!mTabsClickable && !item.isHeader()) return false;
   if (item.isHeader()) return item.getActionCallback() != null;
   return item.isClickable();
 }
Esempio n. 2
0
 private void setupHeader(ItemType header, View view) {
   TextView title = (TextView) view.findViewById(android.R.id.title);
   if (title == null)
     throw new RuntimeException(
         "Your header layout must contain a TextView with the ID @android:id/title.");
   TextView subtitle = (TextView) view.findViewById(android.R.id.content);
   if (subtitle == null)
     throw new RuntimeException(
         "Your header layout must contain a TextView with the ID @android:id/content.");
   title.setText(header.getTitle());
   if (header.getContent() != null && !header.getContent().trim().isEmpty()) {
     subtitle.setVisibility(View.VISIBLE);
     subtitle.setText(header.getContent());
   } else subtitle.setVisibility(View.GONE);
   TextView button = (TextView) view.findViewById(android.R.id.button1);
   if (button == null)
     throw new RuntimeException(
         "The header layout must contain a TextView with the ID @android:id/button1.");
   if (header.getActionCallback() != null) {
     button.setVisibility(View.VISIBLE);
     button.setBackgroundColor(mAccentColor);
     String titleTxt = header.getActionTitle();
     if (header.getActionTitle() == null || header.getActionTitle().trim().isEmpty())
       titleTxt = getContext().getString(R.string.see_more);
     button.setText(titleTxt);
   } else button.setVisibility(View.GONE);
 }