예제 #1
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);
 }
예제 #2
0
 protected boolean onProcessContent(TextView content, ItemType Tab) {
   content.setText(Tab.getContent());
   return false;
 }