Search in sources :

Example 1 with ActionBarDrawable

use of greendroid.graphics.drawable.ActionBarDrawable in project GreenDroid by cyrilmottier.

the class ActionBarItem method createWithType.

static ActionBarItem createWithType(ActionBar actionBar, ActionBarItem.Type type) {
    int drawableId = 0;
    int descriptionId = 0;
    switch(type) {
        case GoHome:
            drawableId = R.drawable.gd_action_bar_home;
            descriptionId = R.string.gd_go_home;
            break;
        case Search:
            drawableId = R.drawable.gd_action_bar_search;
            descriptionId = R.string.gd_search;
            break;
        case Talk:
            drawableId = R.drawable.gd_action_bar_talk;
            descriptionId = R.string.gd_talk;
            break;
        case Compose:
            drawableId = R.drawable.gd_action_bar_compose;
            descriptionId = R.string.gd_compose;
            break;
        case Export:
            drawableId = R.drawable.gd_action_bar_export;
            descriptionId = R.string.gd_export;
            break;
        case Share:
            drawableId = R.drawable.gd_action_bar_share;
            descriptionId = R.string.gd_share;
            break;
        case Refresh:
            return actionBar.newActionBarItem(LoaderActionBarItem.class).setDrawable(new ActionBarDrawable(actionBar.getContext(), R.drawable.gd_action_bar_refresh)).setContentDescription(R.string.gd_refresh);
        case TakePhoto:
            drawableId = R.drawable.gd_action_bar_take_photo;
            descriptionId = R.string.gd_take_photo;
            break;
        case Locate:
            drawableId = R.drawable.gd_action_bar_locate;
            descriptionId = R.string.gd_locate;
            break;
        case Edit:
            drawableId = R.drawable.gd_action_bar_edit;
            descriptionId = R.string.gd_edit;
            break;
        case Add:
            drawableId = R.drawable.gd_action_bar_add;
            descriptionId = R.string.gd_add;
            break;
        case Star:
            drawableId = R.drawable.gd_action_bar_star;
            descriptionId = R.string.gd_star;
            break;
        case SortBySize:
            drawableId = R.drawable.gd_action_bar_sort_by_size;
            descriptionId = R.string.gd_sort_by_size;
            break;
        case SortAlphabetically:
            drawableId = R.drawable.gd_action_bar_sort_alpha;
            descriptionId = R.string.gd_sort_alpha;
            break;
        case LocateMyself:
            drawableId = R.drawable.gd_action_bar_locate_myself;
            descriptionId = R.string.gd_locate_myself;
            break;
        case Compass:
            drawableId = R.drawable.gd_action_bar_compass;
            descriptionId = R.string.gd_compass;
            break;
        case Help:
            drawableId = R.drawable.gd_action_bar_help;
            descriptionId = R.string.gd_help;
            break;
        case Info:
            drawableId = R.drawable.gd_action_bar_info;
            descriptionId = R.string.gd_info;
            break;
        case Settings:
            drawableId = R.drawable.gd_action_bar_settings;
            descriptionId = R.string.gd_settings;
            break;
        case List:
            drawableId = R.drawable.gd_action_bar_list;
            descriptionId = R.string.gd_list;
            break;
        case Trashcan:
            drawableId = R.drawable.gd_action_bar_trashcan;
            descriptionId = R.string.gd_trashcan;
            break;
        case Eye:
            drawableId = R.drawable.gd_action_bar_eye;
            descriptionId = R.string.gd_eye;
            break;
        case AllFriends:
            drawableId = R.drawable.gd_action_bar_all_friends;
            descriptionId = R.string.gd_all_friends;
            break;
        case Group:
            drawableId = R.drawable.gd_action_bar_group;
            descriptionId = R.string.gd_group;
            break;
        case Gallery:
            drawableId = R.drawable.gd_action_bar_gallery;
            descriptionId = R.string.gd_gallery;
            break;
        case Slideshow:
            drawableId = R.drawable.gd_action_bar_slideshow;
            descriptionId = R.string.gd_slideshow;
            break;
        case Mail:
            drawableId = R.drawable.gd_action_bar_mail;
            descriptionId = R.string.gd_mail;
            break;
        default:
            // Do nothing but return null
            return null;
    }
    final Drawable d = new ActionBarDrawable(actionBar.getContext(), drawableId);
    return actionBar.newActionBarItem(NormalActionBarItem.class).setDrawable(d).setContentDescription(descriptionId);
}
Also used : ActionBarDrawable(greendroid.graphics.drawable.ActionBarDrawable) ActionBarDrawable(greendroid.graphics.drawable.ActionBarDrawable) Drawable(android.graphics.drawable.Drawable)

Example 2 with ActionBarDrawable

use of greendroid.graphics.drawable.ActionBarDrawable 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)

Aggregations

ActionBarDrawable (greendroid.graphics.drawable.ActionBarDrawable)2 Drawable (android.graphics.drawable.Drawable)1 ItemAdapter (greendroid.widget.ItemAdapter)1