Search in sources :

Example 1 with ItemAdapter

use of greendroid.widget.ItemAdapter in project GreenDroid by cyrilmottier.

the class BasicItemActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    List<Item> items = new ArrayList<Item>();
    items.add(new SeparatorItem("Class 1"));
    items.add(new ThumbnailItem("Powered paragliding", "aka paramotoring", R.drawable.class1));
    items.add(new DescriptionItem("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tempus consequat leo, et tincidunt justo tristique in."));
    items.add(new SeparatorItem("Class 2"));
    items.add(new DrawableItem("Trikes", R.drawable.class2));
    items.add(new DescriptionItem("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tempus consequat leo, et tincidunt justo tristique in."));
    items.add(new SeparatorItem("Class 3"));
    items.add(new ThumbnailItem("Multi-axis", "Looks like a tiny plane", R.drawable.class3));
    items.add(new DescriptionItem("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tempus consequat leo, et tincidunt justo tristique in."));
    items.add(new SeparatorItem("Class 4"));
    items.add(new ThumbnailItem("Auto-gyro", "A scary helicopter", R.drawable.class4));
    items.add(new DescriptionItem("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tempus consequat leo, et tincidunt justo tristique in."));
    items.add(new SeparatorItem("Class 5"));
    items.add(new DrawableItem("Hot air baloon", R.drawable.class5));
    items.add(new DescriptionItem("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tempus consequat leo, et tincidunt justo tristique in."));
    final Item item1 = new SeparatorItem("Class 6");
    final Item item2 = new TextItem("Airbus/Boeing planes");
    final Item item3 = new DescriptionItem("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tempus consequat leo, et tincidunt justo tristique in.");
    items.add(item1);
    items.add(item2);
    items.add(item3);
    final ProgressItem progressItem = new ProgressItem("Removing intruders", true);
    items.add(progressItem);
    final ItemAdapter adapter = new ItemAdapter(this, items);
    setListAdapter(adapter);
    mHandler.postDelayed(new Runnable() {

        public void run() {
            adapter.remove(item1);
            adapter.remove(item2);
            adapter.remove(item3);
            adapter.remove(progressItem);
            adapter.insert(new ThumbnailItem("Ultralight aviation", "List of French 'ULM' classes", R.drawable.ic_gdcatalog), 0);
            adapter.notifyDataSetChanged();
        }
    }, 8000);
}
Also used : ThumbnailItem(greendroid.widget.item.ThumbnailItem) SeparatorItem(greendroid.widget.item.SeparatorItem) Item(greendroid.widget.item.Item) TextItem(greendroid.widget.item.TextItem) DescriptionItem(greendroid.widget.item.DescriptionItem) DrawableItem(greendroid.widget.item.DrawableItem) ProgressItem(greendroid.widget.item.ProgressItem) TextItem(greendroid.widget.item.TextItem) ArrayList(java.util.ArrayList) ThumbnailItem(greendroid.widget.item.ThumbnailItem) DrawableItem(greendroid.widget.item.DrawableItem) ProgressItem(greendroid.widget.item.ProgressItem) SeparatorItem(greendroid.widget.item.SeparatorItem) DescriptionItem(greendroid.widget.item.DescriptionItem) ItemAdapter(greendroid.widget.ItemAdapter)

Example 2 with ItemAdapter

use of greendroid.widget.ItemAdapter in project GreenDroid by cyrilmottier.

the class TweakedItemViewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ItemAdapter adapter = new SectionedItemAdapter(this, CHEESES, SECTIONS);
    getListView().setFastScrollEnabled(true);
    setListAdapter(adapter);
}
Also used : ItemAdapter(greendroid.widget.ItemAdapter)

Example 3 with ItemAdapter

use of greendroid.widget.ItemAdapter in project GreenDroid by cyrilmottier.

the class CatalogActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ItemAdapter adapter = new ItemAdapter(this);
    adapter.add(createTextItem(R.string.basic_item_label, BasicItemActivity.class));
    adapter.add(createTextItem(R.string.xml_item_label, XmlItemActivity.class));
    adapter.add(createTextItem(R.string.tweaked_item_view_label, TweakedItemViewActivity.class));
    adapter.add(createTextItem(R.string.segmented_label, SegmentedActivity.class));
    adapter.add(createTextItem(R.string.action_bar_activity_label, ActionBarActivity.class));
    adapter.add(createTextItem(R.string.quick_action_label, QuickActionActivity.class));
    adapter.add(createTextItem(R.string.simple_async_image_view_label, SimpleAsyncImageViewActivity.class));
    adapter.add(createTextItem(R.string.async_image_view_list_view_label, AsyncImageViewListActivity.class));
    adapter.add(createTextItem(R.string.map_pin_drawable_label, MapPinMapActivity.class));
    adapter.add(createTextItem(R.string.paged_view_label, PagedViewActivity.class));
    setListAdapter(adapter);
    addActionBarItem(getActionBar().newActionBarItem(NormalActionBarItem.class).setDrawable(new ActionBarDrawable(this, R.drawable.ic_action_bar_info)), R.id.action_bar_view_info);
}
Also used : ActionBarDrawable(greendroid.graphics.drawable.ActionBarDrawable) ItemAdapter(greendroid.widget.ItemAdapter)

Example 4 with ItemAdapter

use of greendroid.widget.ItemAdapter in project GreenDroid by cyrilmottier.

the class XmlItemActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ItemAdapter adapter;
    try {
        adapter = ItemAdapter.createFromXml(this, R.xml.items);
        setListAdapter(adapter);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : ItemAdapter(greendroid.widget.ItemAdapter)

Aggregations

ItemAdapter (greendroid.widget.ItemAdapter)4 ActionBarDrawable (greendroid.graphics.drawable.ActionBarDrawable)1 DescriptionItem (greendroid.widget.item.DescriptionItem)1 DrawableItem (greendroid.widget.item.DrawableItem)1 Item (greendroid.widget.item.Item)1 ProgressItem (greendroid.widget.item.ProgressItem)1 SeparatorItem (greendroid.widget.item.SeparatorItem)1 TextItem (greendroid.widget.item.TextItem)1 ThumbnailItem (greendroid.widget.item.ThumbnailItem)1 ArrayList (java.util.ArrayList)1