Example usage for android.app ActionBar DISPLAY_USE_LOGO

List of usage examples for android.app ActionBar DISPLAY_USE_LOGO

Introduction

In this page you can find the example usage for android.app ActionBar DISPLAY_USE_LOGO.

Prototype

int DISPLAY_USE_LOGO

To view the source code for android.app ActionBar DISPLAY_USE_LOGO.

Click Source Link

Document

Use logo instead of icon if available.

Usage

From source file:org.opendatakit.survey.android.activities.MainMenuActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);

    int showOption = MenuItem.SHOW_AS_ACTION_IF_ROOM;
    MenuItem item;//from  w w w  .j  a  va  2  s  .c  o m
    if (currentFragment != ScreenList.WEBKIT) {
        ActionBar actionBar = getActionBar();
        actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE);
        actionBar.show();

        item = menu.add(Menu.NONE, MENU_FILL_FORM, Menu.NONE, getString(R.string.enter_data_button));
        item.setIcon(R.drawable.ic_action_collections_collection).setShowAsAction(showOption);

        // Using a file for this work now
        String get = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_GET_BLANK);
        if (get.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_PULL_FORMS, Menu.NONE, getString(R.string.get_forms));
            item.setIcon(R.drawable.ic_action_av_download).setShowAsAction(showOption);

            item = menu.add(Menu.NONE, MENU_CLOUD_FORMS, Menu.NONE, getString(R.string.get_forms));
            item.setIcon(R.drawable.ic_action_cloud).setShowAsAction(showOption);
        }

        String send = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_SEND_FINALIZED);
        if (send.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_PUSH_FORMS, Menu.NONE, getString(R.string.send_data));
            item.setIcon(R.drawable.ic_action_av_upload).setShowAsAction(showOption);
        }

        String manage = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_MANAGE_FORMS);
        if (manage.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_MANAGE_FORMS, Menu.NONE, getString(R.string.manage_files));
            item.setIcon(R.drawable.trash).setShowAsAction(showOption);
        }

        String settings = PropertiesSingleton.getProperty(appName,
                AdminPreferencesActivity.KEY_ACCESS_SETTINGS);
        if (settings.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_PREFERENCES, Menu.NONE, getString(R.string.general_preferences));
            item.setIcon(R.drawable.ic_menu_preferences).setShowAsAction(showOption);
        }
        item = menu.add(Menu.NONE, MENU_ADMIN_PREFERENCES, Menu.NONE, getString(R.string.admin_preferences));
        item.setIcon(R.drawable.ic_action_device_access_accounts).setShowAsAction(showOption);

        item = menu.add(Menu.NONE, MENU_ABOUT, Menu.NONE, getString(R.string.about));
        item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    } else {
        ActionBar actionBar = getActionBar();
        actionBar.hide();
    }

    return true;
}

From source file:org.path.episample.android.activities.MainMenuActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);

    int showOption = MenuItem.SHOW_AS_ACTION_IF_ROOM;
    MenuItem item;/*www  .  j  a  va  2s  .  com*/
    if (currentFragment != ScreenList.WEBKIT) {
        ActionBar actionBar = getActionBar();
        actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE);
        actionBar.show();

        item = menu.add(Menu.NONE, MENU_MAIN_MENU, Menu.NONE, getString(R.string.main_menu));
        item.setIcon(R.drawable.ic_action_home).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);

        //item = menu.add(Menu.NONE, MENU_FILL_FORM, Menu.NONE, getString(R.string.enter_data_button));
        //item.setIcon(R.drawable.ic_action_collections_collection).setShowAsAction(showOption);

        // Using a file for this work now
        String get = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_GET_BLANK);
        if (get.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_PULL_FORMS, Menu.NONE, getString(R.string.get_forms));
            item.setIcon(R.drawable.ic_action_av_download).setShowAsAction(showOption);

            //item = menu.add(Menu.NONE, MENU_CLOUD_FORMS, Menu.NONE, getString(R.string.get_forms));
            //item.setIcon(R.drawable.ic_action_cloud).setShowAsAction(showOption);
        }

        String send = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_SEND_FINALIZED);
        if (send.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_PUSH_FORMS, Menu.NONE, getString(R.string.send_data));
            item.setIcon(R.drawable.ic_action_av_upload).setShowAsAction(showOption);
        }

        String manage = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_MANAGE_FORMS);
        if (manage.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_MANAGE_FORMS, Menu.NONE, getString(R.string.manage_files));
            item.setIcon(R.drawable.trash).setShowAsAction(showOption);
        }

        String settings = PropertiesSingleton.getProperty(appName,
                AdminPreferencesActivity.KEY_ACCESS_SETTINGS);
        if (settings.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_PREFERENCES, Menu.NONE, getString(R.string.general_preferences));
            item.setIcon(R.drawable.ic_menu_preferences).setShowAsAction(showOption);
        }
        item = menu.add(Menu.NONE, MENU_ADMIN_PREFERENCES, Menu.NONE, getString(R.string.admin_preferences));
        item.setIcon(R.drawable.ic_action_device_access_accounts).setShowAsAction(showOption);

        String backup = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_BACKUP_CENSUS);
        if (backup != null && backup.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_BACKUP_CENSUS, Menu.NONE, getString(R.string.backup_census));
            item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
        }

        String restore = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_RESTORE_CENSUS);
        if (restore != null && restore.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_RESTORE_CENSUS, Menu.NONE, getString(R.string.restore_census));
            item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
        }

        String invalidateCensus = PropertiesSingleton.getProperty(appName,
                AdminPreferencesActivity.KEY_INVALIDATE_CENSUS);
        if (invalidateCensus != null && invalidateCensus.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_MARK_CENSUS_AS_INVALID, Menu.NONE,
                    getString(R.string.invalidate_census));
            item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
        }

        String edit = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_EDIT_CENSUS);
        if (edit != null && edit.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_EDIT_CENSUS, Menu.NONE, getString(R.string.edit_census));
            item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
        }

        String removeCensus = PropertiesSingleton.getProperty(appName,
                AdminPreferencesActivity.KEY_REMOVE_CENSUS);
        if (removeCensus != null && removeCensus.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_REMOVE_CENSUS, Menu.NONE, getString(R.string.remove_census));
            item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
        }

        /*String send_receive_bt = PropertiesSingleton.getProperty(appName,
                AdminPreferencesActivity.KEY_SEND_RECEIVE_BLUETOOTH);
        if (send_receive_bt != null && send_receive_bt.equalsIgnoreCase("true")) {
           item = menu.add(Menu.NONE, MENU_SEND_REVEIVE_BLUETOOTH, Menu.NONE, getString(R.string.send_receive_bluetooth));
           item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
        }*/

        item = menu.add(Menu.NONE, MENU_ABOUT, Menu.NONE, getString(R.string.about));
        item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    } else {
        ActionBar actionBar = getActionBar();
        actionBar.hide();
    }

    return true;
}

From source file:org.mozilla.gecko.GeckoApp.java

public void refreshActionBar() {
    if (Build.VERSION.SDK_INT >= 11) {
        mBrowserToolbar = (BrowserToolbar) getLayoutInflater().inflate(R.layout.browser_toolbar, null);
        mBrowserToolbar.init();//  www .  ja v  a 2 s .  co m
        mBrowserToolbar.refresh();
        GeckoActionBar.setBackgroundDrawable(this, getResources().getDrawable(R.drawable.gecko_actionbar_bg));
        GeckoActionBar.setDisplayOptions(this, ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_SHOW_CUSTOM
                | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_USE_LOGO);
        GeckoActionBar.setCustomView(this, mBrowserToolbar);
    }
}