Example usage for android.app ActionBar setDisplayUseLogoEnabled

List of usage examples for android.app ActionBar setDisplayUseLogoEnabled

Introduction

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

Prototype

public abstract void setDisplayUseLogoEnabled(boolean useLogo);

Source Link

Document

Set whether to display the activity logo rather than the activity icon.

Usage

From source file:com.jiusg.mainscreenshow.ui.MSS.java

/**
 * ActionBar//from w  w  w . j  a  v a  2 s.  c o  m
 *
 * @param layoutId Id
 */
public void setActionBarLayout(int layoutId) {
    ActionBar actionBar = getActionBar();
    if (null != actionBar) {
        actionBar.setDisplayShowHomeEnabled(false);
        actionBar.setDisplayShowCustomEnabled(true);
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayHomeAsUpEnabled(false);
        actionBar.setDisplayUseLogoEnabled(false);

        LayoutInflater inflator = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View v = inflator.inflate(layoutId, null);
        ActionBar.LayoutParams layout = new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT);
        actionBar.setCustomView(v, layout);
    }
}

From source file:lth.pontus.getResults.MainActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mContext = getApplicationContext();//from  www  . j a v a  2s.  com

    // Create the adapter that will return a fragment for each of the three
    // primary sections
    // of the app.
    mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager());

    // Set up the action bar.
    final ActionBar actionBar = getActionBar();

    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setDisplayUseLogoEnabled(false);

    // Specify that the Home/Up button should not be enabled, since there is
    // no hierarchical
    // parent.
    actionBar.setHomeButtonEnabled(false);

    // Specify that we will be displaying tabs in the action bar.
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    exercisel = new ExerciseProvider();
    DateHelper = new DateProvider();
    openDB();

    // Set up the ViewPager, attaching the adapter and setting up a listener
    // for when the
    // user swipes between sections.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mAppSectionsPagerAdapter);
    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            // When swiping between different app sections, select
            // the corresponding tab.
            // We can also use ActionBar.Tab#select() to do this if
            // we have a reference to the
            // Tab.
            actionBar.setSelectedNavigationItem(position);
        }
    });

    // For each of the sections in the app, add a tab to the action bar.
    for (int i = 0; i < mAppSectionsPagerAdapter.getCount(); i++) {
        // Create a tab with text corresponding to the page title defined by
        // the adapter.
        // Also specify this Activity object, which implements the
        // TabListener interface, as the
        // listener for when this tab is selected.
        Tab a = actionBar.newTab().setIcon(mAppSectionsPagerAdapter.getPageICon(i));
        a.setTabListener(this);

        actionBar.addTab(a);
    }
}

From source file:com.tweetlanes.android.view.HomeActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    //StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().penaltyDialog().build());
    //StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build());
    //StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyLog().build());

    super.onCreate(savedInstanceState);

    AccountDescriptor account = getApp().getCurrentAccount();

    // Attempt at fixing a crash found in HomeActivity
    if (account == null) {
        Toast.makeText(getApplicationContext(), "No cached account found, restarting",
                Constant.DEFAULT_TOAST_DISPLAY_TIME).show();
        restartApp();/*w  w w .  j a  v  a2 s . co m*/
        return;
    }

    ActionBar actionBar = getActionBar();
    actionBar.setDisplayUseLogoEnabled(true);
    actionBar.setTitle(null);
    actionBar.setDisplayShowTitleEnabled(false);

    ArrayList<String> adapterList = new ArrayList<String>();
    ArrayList<AccountDescriptor> accounts = getApp().getAccounts();
    for (int i = 0; i < accounts.size(); i++) {
        AccountDescriptor acc = accounts.get(i);
        adapterList.add("@" + acc.getScreenName());
    }
    adapterList.add(getString(R.string.add_account));
    mAdapterStrings = adapterList.toArray(new String[adapterList.size()]);

    mSpinnerAdapter = new ArrayAdapter<String>(getBaseContext(), android.R.layout.simple_spinner_dropdown_item,
            mAdapterStrings);

    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    actionBar.setListNavigationCallbacks(mSpinnerAdapter, mOnNavigationListener);
    actionBar.setSelectedNavigationItem(0);

    onCreateNavigationListener();
    configureListNavigation();

    mViewSwitcher = (ViewSwitcher) findViewById(R.id.rootViewSwitcher);
    updateViewVisibility();

    onCreateHandleIntents();

    account.setDisplayedLaneDefinitionsDirty(false);

    configureNotificationService();
}

From source file:com.shafiq.mytwittle.view.HomeActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    // StrictMode.setThreadPolicy(new
    // StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().penaltyDialog().build());
    // StrictMode.setThreadPolicy(new
    // StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build());
    // StrictMode.setVmPolicy(new
    // StrictMode.VmPolicy.Builder().detectAll().penaltyLog().build());

    super.onCreate(savedInstanceState);

    AccountDescriptor account = getApp().getCurrentAccount();

    // Attempt at fixing a crash found in HomeActivity
    if (account == null) {
        Toast.makeText(getApplicationContext(), "No cached account found, restarting",
                Constant.DEFAULT_TOAST_DISPLAY_TIME).show();
        restartApp();/*from w  w w . j a v a2 s .c  o  m*/
        return;
    }

    ActionBar actionBar = getActionBar();
    actionBar.setDisplayUseLogoEnabled(true);
    actionBar.setTitle(null);
    actionBar.setDisplayShowTitleEnabled(false);

    ArrayList<String> adapterList = new ArrayList<String>();
    ArrayList<AccountDescriptor> accounts = getApp().getAccounts();
    for (int i = 0; i < accounts.size(); i++) {
        AccountDescriptor acc = accounts.get(i);
        adapterList.add("@" + acc.getScreenName()
                + (acc.getSocialNetType() == SocialNetConstant.Type.Appdotnet ? " (App.net)" : " (Twitter)"));
    }
    adapterList.add(getString(R.string.add_account));
    mAdapterStrings = adapterList.toArray(new String[adapterList.size()]);

    mSpinnerAdapter = new ArrayAdapter<String>(getBaseContext(), android.R.layout.simple_spinner_dropdown_item,
            mAdapterStrings);

    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    actionBar.setListNavigationCallbacks(mSpinnerAdapter, mOnNavigationListener);
    actionBar.setSelectedNavigationItem(0);

    onCreateNavigationListener();
    configureListNavigation();

    mViewSwitcher = (ViewSwitcher) findViewById(R.id.rootViewSwitcher);
    updateViewVisibility();

    onCreateHandleIntents();

    account.setDisplayedLaneDefinitionsDirty(false);

    configureNotificationService();
}

From source file:com.tweetlanes.android.core.view.HomeActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    AccountDescriptor account = getApp().getCurrentAccount();

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        // Notifications
        String accountKey = extras.getString("account_key");
        String notificationType = extras.getString("notification_type");
        long notificationPostId = extras.getLong("notification_post_id");
        String laneName = extras.getString("lane");
        final String urlToLoad = extras.getString("urlToLoad");

        if (accountKey != null) {
            getIntent().removeExtra("account_key");
            getIntent().removeExtra("notification_type");
            AccountDescriptor notificationAccount = getApp().getAccountByKey(accountKey);

            Notifier.saveLastNotificationActioned(this, accountKey, notificationType, notificationPostId);

            Constant.LaneType notificationLaneType = notificationType.equals(
                    SharedPreferencesConstants.NOTIFICATION_TYPE_MENTION) ? Constant.LaneType.USER_MENTIONS
                            : Constant.LaneType.DIRECT_MESSAGES;

            if (notificationAccount != null) {
                long notificationAccountId = notificationAccount.getId();
                long currentAccountId = account.getId();
                if (notificationAccountId == currentAccountId) {
                    int index = account.getCurrentLaneIndex(notificationLaneType);
                    if (index > -1) {
                        mDefaultLaneOverride = index;
                    }//ww w .j  ava  2s  .c om
                } else {
                    showAccount(notificationAccount, notificationLaneType);
                }
            }
        } else if (laneName != null) {
            getIntent().removeExtra("lane");
            int index = account.getCurrentLaneIndex(Constant.LaneType.valueOf(laneName.trim().toUpperCase()));
            if (index > -1) {
                mDefaultLaneOverride = index;
            }
        } else if (urlToLoad != null) {
            getIntent().removeExtra("urlToLoad");
            AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
            alertDialogBuilder.setMessage(getString(R.string.unknown_intent));
            alertDialogBuilder.setPositiveButton(getString(R.string.yes),
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            Intent viewIntent = new Intent("android.intent.action.VIEW",
                                    Uri.parse(urlToLoad.trim()));
                            startActivity(viewIntent);
                        }
                    });
            alertDialogBuilder.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();
                }
            });
            alertDialogBuilder.create().show();
        }
    }

    super.onCreate(savedInstanceState);

    // Attempt at fixing a crash found in HomeActivity
    if (account == null) {
        Toast.makeText(getApplicationContext(), "No cached account found, restarting",
                Constant.DEFAULT_TOAST_DISPLAY_TIME).show();
        restartApp();
        return;
    }

    ActionBar actionBar = getActionBar();
    actionBar.setDisplayUseLogoEnabled(true);
    actionBar.setTitle(null);
    actionBar.setDisplayShowTitleEnabled(false);

    mSpinnerAdapter = new AccountAdapter(this, getApp().getAccounts());

    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    actionBar.setListNavigationCallbacks(mSpinnerAdapter, mOnNavigationListener);
    actionBar.setSelectedNavigationItem(0);

    onCreateNavigationListener();
    configureListNavigation();

    mViewSwitcher = (ViewSwitcher) findViewById(R.id.rootViewSwitcher);
    updateViewVisibility();

    onCreateHandleIntents();

    account.setDisplayedLaneDefinitionsDirty(false);

    Notifier.setNotificationAlarm(this);

    clearTempFolder();

    cacheFollowers();

    //Launch change log dialog
    final WhatsNewDialog whatsNewDialog = new WhatsNewDialog(this);
    whatsNewDialog.show();
}

From source file:org.akvo.caddisfly.ui.activity.MainActivity.java

private void updateActionBarNavigation(int index) {
    if (index == Config.CALIBRATE_SCREEN_INDEX) {
        ActionBar ab = getActionBar();
        assert ab != null;
        ab.setDisplayShowCustomEnabled(true);
        ab.setDisplayShowTitleEnabled(false);
        ab.setDisplayUseLogoEnabled(false);
    } else {//  w w  w  .  j  a  v  a  2  s  .  co  m
        ActionBar ab = getActionBar();
        assert ab != null;
        ab.setDisplayShowCustomEnabled(false);
        ab.setDisplayShowTitleEnabled(true);
        ab.setDisplayUseLogoEnabled(true);
    }

    switch (index) {
    case Config.SETTINGS_SCREEN_INDEX:
        setTitle(R.string.settings);
        break;
    case Config.HOME_SCREEN_INDEX:
        setTitle(R.string.appName);
        break;
    case Config.SWATCH_SCREEN_INDEX:
        setTitle(R.string.swatches);
        break;

    }
}

From source file:se.liu.tddd77.bilsensor.MainActivity.java

/**
 * The menu consists of two parts, the record button and the settings. 
 * The record button is a checkable button. The settings is the collection 
 * of the other available options. They should all be added through the 
 * XML-file with the definition of the event here in onOptionsItemSelected.
 *///from  w w w. j av a 2  s . com
@Override
public boolean onCreateOptionsMenu(Menu menu) {

    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setDisplayUseLogoEnabled(false);
    actionBar.setDisplayHomeAsUpEnabled(false);
    actionBar.setDisplayShowCustomEnabled(true);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
    View view = getLayoutInflater().inflate(R.layout.actionbar, null);
    actionBar.setCustomView(view);

    final TextView projectName = (TextView) findViewById(R.id.project_name);
    Log.i("MainActivity", "Getting project name");
    Bundle projectnamebundle = getIntent().getExtras();
    projectname = projectnamebundle.getString("Project_name");
    serverIP = projectnamebundle.getString("Server_IP");
    if (projectname == null) {
        Log.i("MainActivity", "Projectname == null");
    } else {
        Log.i("MainActivity", "Projectname != null");
    }
    Log.i("MainActivity", projectname);
    projectName.setText(projectname);

    final ImageButton button = (ImageButton) findViewById(R.id.recButton);
    button.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            handleRecord(button);
        }
    });
    /*   final ImageButton playButton = (ImageButton) findViewById(R.id.playButton);
       playButton.setOnClickListener(new View.OnClickListener() {
          public void onClick(View v) {
    handlePlay(playButton);
          }
       });*/
    final ImageButton buttonMenu = (ImageButton) findViewById(R.id.menuButton);
    buttonMenu.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {

            try {
                saveProfile("profil.txt");
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

        }
    });
    final ImageButton loadMenu = (ImageButton) findViewById(R.id.loadButton);
    loadMenu.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {

            //try {
            //SelectViewNameDialog dialog = new SelectViewNameDialog(avb);
            //dialog.show(getFragmentManager(), null);
            try {
                loadProfile("profil.txt");
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (BackendError e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

        }
    });

    //playButton.setMaxWidth(playButton.getHeight());

    return super.onCreateOptionsMenu(menu);
}

From source file:com.bignerdranch.android.fragmentbasics.NewsReaderActivity.java

/** Sets up Action Bar (if present).
 *
 * @param showTabs whether to show tabs (if false, will show list).
 * @param selTab the selected tab or list item.
 *//*w  w w  .j  a  v  a  2s . c  o  m*/
public void setUpActionBar(boolean showTabs, int selTab) {
    if (Build.VERSION.SDK_INT < 11) {
        // No action bar for you!
        // But do not despair. In this case the layout includes a bar across the
        // top that looks and feels like an action bar, but is made up of regular views.
        return;
    }

    android.app.ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(false);

    // Set up a CompatActionBarNavHandler to deliver us the Action Bar nagivation events
    CompatActionBarNavHandler handler = new CompatActionBarNavHandler(this);
    if (showTabs) {
        actionBar.setNavigationMode(android.app.ActionBar.NAVIGATION_MODE_TABS);
        int i;
        for (i = 0; i < CATEGORIES.length; i++) {
            actionBar.addTab(actionBar.newTab().setText(CATEGORIES[i]).setTabListener(handler));
        }
        actionBar.setSelectedNavigationItem(selTab);
    } else {
        actionBar.setNavigationMode(android.app.ActionBar.NAVIGATION_MODE_LIST);
        SpinnerAdapter adap = new ArrayAdapter<String>(this, R.layout.actionbar_list_item, CATEGORIES);
        actionBar.setListNavigationCallbacks(adap, handler);
    }

    // Show logo instead of icon+title.
    actionBar.setDisplayUseLogoEnabled(true);
}

From source file:com.schedule.ScheduleActivity.java

/**
 * Sets up Action Bar (if present).//from w ww  .j  a  va 2  s. co m
 * 
 * @param showTabs
 *            whether to show tabs (if false, will show list).
 * @param selTab
 *            the selected tab or list item.
 */
public void setUpActionBar(boolean showTabs, int selTab) {
    if (Build.VERSION.SDK_INT < 11) {
        // No action bar for you!
        // But do not despair. In this case the layout includes a bar across
        // the
        // top that looks and feels like an action bar, but is made up of
        // regular views.
        return;
    }

    android.app.ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(false);

    // Set up a CompatActionBarNavHandler to deliver us the Action Bar
    // nagivation events
    CompatActionBarNavHandler handler = new CompatActionBarNavHandler(this);
    if (showTabs) {
        actionBar.setNavigationMode(android.app.ActionBar.NAVIGATION_MODE_TABS);
        int i;
        for (i = 0; i < MENUS.length; i++) {
            actionBar.addTab(actionBar.newTab().setText(MENUS[i]).setTabListener(handler));
        }
        actionBar.setSelectedNavigationItem(selTab);
    } else {
        actionBar.setNavigationMode(android.app.ActionBar.NAVIGATION_MODE_LIST);
        SpinnerAdapter adap = new ArrayAdapter<String>(this, R.layout.actionbar_list_item, MENUS);
        actionBar.setListNavigationCallbacks(adap, handler);
    }

    // Show logo instead of icon+title.
    actionBar.setDisplayUseLogoEnabled(true);
}

From source file:com.android.email.activity.setup.MailboxSettings.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    // This needs to happen before super.onCreate() since that calls onBuildHeaders()
    mInboxId = getIntent().getIntExtra(EXTRA_INBOX_ID, -1);
    mFoldersUri = getIntent().getParcelableExtra(EXTRA_FOLDERS_URI);
    mType = getIntent().getStringExtra(EXTRA_TYPE);

    if (mFoldersUri != null) {
        getLoaderManager().initLoader(FOLDERS_LOADER_ID, null, new MailboxSettingsFolderLoaderCallbacks());
    }//from  w ww. j a  v  a  2s  .co  m

    super.onCreate(savedInstanceState);

    // Always show "app up" as we expect our parent to be an Email activity.
    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP, ActionBar.DISPLAY_HOME_AS_UP);
        // Hide the app icon.
        actionBar.setIcon(android.R.color.transparent);
        actionBar.setDisplayUseLogoEnabled(false);
        if (mType != null && mType.equals(PREFERENCE_SYNC_SETTINGS)) {
            actionBar.setTitle(getString(R.string.mailbox_settings_activity_title));
        } else if (mType != null && mType.equals(PREFERENCE_PER_FOLDER_NOTIFICATIONS)) {
            actionBar.setTitle(getString(R.string.mailbox_notify_settings_activity_title));
        }
    }
}