@Override
 public Fragment getFragment(int i, int i1) {
   Page page = PAGES[i][i1];
   String title = page.titleRes != 0 ? mContext.getString(page.titleRes) : null;
   String text = page.textRes != 0 ? mContext.getString(page.textRes) : null;
   CardFragment fragment = CardFragment.create(title, text, page.iconRes);
   fragment.setCardGravity(page.cardGravity);
   fragment.setExpansionEnabled(page.expansionEnabled);
   fragment.setExpansionDirection(page.expansionDirection);
   return fragment;
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_card_fragment);

    FragmentManager fragmentManager = getFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    CardFragment cardFragment =
        CardFragment.create("Title", "Description", android.R.drawable.ic_dialog_alert);
    fragmentTransaction.add(R.id.frame_layout, cardFragment);
    fragmentTransaction.commit();
  }
Exemplo n.º 3
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_card);

    Intent intent = getIntent();

    String title = intent.getExtras().getString(TITLE);
    String desc = intent.getExtras().getString(DESC);

    FragmentManager fragmentManager = getFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    CardFragment cardFragment = CardFragment.create(title, desc, 0);
    fragmentTransaction.add(R.id.frame_layout, cardFragment);
    fragmentTransaction.commit();
  }
Exemplo n.º 4
0
 @Override
 public Fragment getFragment(int row, int column) {
   switch (column) {
     case SUMMARY:
       String title = flickr_images.get(row).getTitle();
       String views = flickr_images.get(row).getViews();
       return CardFragment.create(title, views);
     case IMAGE:
       return new Fragment();
     case ADD_NOTES:
       return new FragmentAddNote();
     case WIKIS:
       FragmentSeeWiki fsw = new FragmentSeeWiki();
       fsw.setImageId(row);
       return fsw;
     default:
       throw new IllegalArgumentException("getFragment(row=" + row + ", column=" + column + ")");
   }
 }