@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_extras, container, false); list = (CardListView) view.findViewById(R.id.ListView); list.setOnCardClickListener( new CardClickListener() { public void onCardClick(AdapterView<?> adapter, View view, int position, long arg) { Object listItem = list.getItemAtPosition(position); } @Override public void onCardClick(int position, CardBase card, View view) { String str = card.getTitle(); if (str.equals(getString(R.string.play))) { actPlay(); } if (str.equals(getString(R.string.wallpaper))) { actWallpapers(); } if (str.equals(getString(R.string.icon))) { actIcons(); } if (str.equals(getString(R.string.request))) { actRequest(); } if (str.equals(getString(R.string.uccw))) { actUCCW(); } if (str.equals(getString(R.string.zooper))) { actZooper(); } if (str.equals(getString(R.string.extras1))) { actExtras1(); } if (str.equals(getString(R.string.extras2))) { actExtras2(); } } }); return view; }
@Override public void onStart() { super.onStart(); CardAdapter<Card> cardsAdapter = new CardAdapter<Card>(getActivity()) .setAccentColorRes(android.R.color.holo_blue_light) .setPopupMenu(R.menu.extras_popup, this); cardsAdapter.add(new CardHeader(getActivity(), R.string.playheader)); cardsAdapter.add( new Card(getString(R.string.play), getString(R.string.play_extra)) .setThumbnail( getActivity(), R.drawable.apps_googleplaystore) // sets a thumbnail image from drawable resources .setPopupMenu(-1, null) // -1 disables the popup menu for this individual card ); cardsAdapter.add(new CardHeader(getActivity(), R.string.basicsheader)); cardsAdapter.add( new Card(getString(R.string.wallpaper), getString(R.string.wallpaper_extra)) .setThumbnail( getActivity(), R.drawable.system_gallery) // sets a thumbnail image from drawable resources .setPopupMenu(-1, null) // -1 disables the popup menu for this individual card ); cardsAdapter.add( new Card(getString(R.string.icon), getString(R.string.icon_extra)) .setThumbnail( getActivity(), R.drawable.icon) // sets a thumbnail image from drawable resources .setPopupMenu(-1, null) // -1 disables the popup menu for this individual card ); cardsAdapter.add( new Card(getString(R.string.request), getString(R.string.request_extra)) .setThumbnail( getActivity(), R.drawable.apps_androidactivities) // sets a thumbnail image from drawable resources .setPopupMenu(-1, null) // -1 disables the popup menu for this individual card ); cardsAdapter.add(new CardHeader(getActivity(), R.string.extrasheader)); cardsAdapter.add( new Card(getString(R.string.uccw), getString(R.string.uccw_extra)) .setThumbnail( getActivity(), R.drawable.apps_uccw) // sets a thumbnail image from drawable resources .setPopupMenu(-1, null) // -1 disables the popup menu for this individual card ); cardsAdapter.add( new Card(getString(R.string.zooper), getString(R.string.zooper_extra)) .setThumbnail( getActivity(), R.drawable.apps_zooperwidget) // sets a thumbnail image from drawable resources .setPopupMenu(-1, null) // -1 disables the popup menu for this individual card ); cardsAdapter.add( new Card(getString(R.string.extras1), getString(R.string.extras1_extra)) .setThumbnail( getActivity(), R.drawable.jai) // sets a thumbnail image from drawable resources .setPopupMenu(-1, null) // -1 disables the popup menu for this individual card ); cardsAdapter.add( new Card(getString(R.string.extras2), getString(R.string.extras2_extra)) .setThumbnail( getActivity(), R.drawable.amasan25) // sets a thumbnail image from drawable resources .setPopupMenu(-1, null) // -1 disables the popup menu for this individual card ); list.setAdapter(cardsAdapter); }