Example usage for android.support.v4.app ActionBar setCustomView

List of usage examples for android.support.v4.app ActionBar setCustomView

Introduction

In this page you can find the example usage for android.support.v4.app ActionBar setCustomView.

Prototype

public abstract void setCustomView(View view);

Source Link

Document

Set the action bar into custom navigation mode, supplying a view for custom navigation.

Usage

From source file:org.pixmob.droidlink.ui.AccountsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.accounts);//ww w  . jav  a  2s  .  c o  m

    // Customize action bar.
    final ActionBar actionBar = getSupportActionBar();
    actionBar.setCustomView(R.layout.nav);
    actionBar.setDisplayShowCustomEnabled(true);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.nav_background));
}

From source file:org.pixmob.droidlink.ui.EventDetailsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.event_details);

    // Customize action bar.
    final ActionBar actionBar = getSupportActionBar();
    actionBar.setCustomView(R.layout.nav);
    actionBar.setDisplayShowCustomEnabled(true);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.nav_background));

    notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
}

From source file:org.pixmob.fm2.ui.FM2.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowCustomEnabled(true);
    actionBar.setCustomView(R.layout.nav);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayShowTitleEnabled(false);

    setContentView(R.layout.main);//from  w  w w .j  av  a 2s . c o  m

    // Setup BugSense framework.
    BugSenseUtils.setup(this);
}

From source file:org.pixmob.fm2.ui.AccountDetails.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowCustomEnabled(true);
    actionBar.setCustomView(R.layout.nav);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayShowTitleEnabled(false);

    final Account account = (Account) getIntent().getSerializableExtra(EXTRA_ACCOUNT);
    if (account == null) {
        throw new IllegalStateException("Missing account");
    }/*  w ww . java2  s  .  co m*/

    if (savedInstanceState == null) {
        final FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        final AccountDetailsFragment f = AccountDetailsFragment.newInstance(account);
        ft.add(android.R.id.content, f);
        ft.commit();
    }
}

From source file:com.todoroo.astrid.actfm.TagUpdatesActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    ThemeService.applyTheme(this);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.tag_updates_activity);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowTitleEnabled(false);

    actionBar.setDisplayShowCustomEnabled(true);
    actionBar.setCustomView(R.layout.header_title_view);
    ((TextView) actionBar.getCustomView().findViewById(R.id.title)).setText(R.string.TAd_contextEditTask);
}

From source file:org.pixmob.droidlink.ui.EventsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(android.view.Window.FEATURE_PROGRESS);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    super.onCreate(savedInstanceState);
    setContentView(R.layout.events);/*from w  w  w. j  a  v a 2 s .  c  o m*/

    // A spinner is displayed when events are synchronizing.
    setProgressBarIndeterminateVisibility(Boolean.FALSE);
    setProgressBarVisibility(false);

    // Customize action bar.
    final ActionBar actionBar = getSupportActionBar();
    actionBar.setCustomView(R.layout.nav);
    actionBar.setDisplayShowCustomEnabled(true);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.nav_background));

    syncActionReceiver = new SyncActionReceiver();

    prefsEditor = getSharedPreferences(SHARED_PREFERENCES_FILE, MODE_PRIVATE).edit();
    notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

    // The details fragment is hidden until an event is selected.
    final Fragment details = getSupportFragmentManager().findFragmentById(R.id.event_details);
    if (details != null) {
        final FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        ft.hide(details);
        ft.commit();
    }
}

From source file:com.actionbarsherlock.sample.hcgallery.MainActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (savedInstanceState != null && savedInstanceState.getInt("theme", -1) != -1) {
        mThemeId = savedInstanceState.getInt("theme");
        this.setTheme(mThemeId);
    }/*www  .  java2s .co  m*/

    setContentView(R.layout.main);

    Directory.initializeDirectory();

    ActionBar bar = getSupportActionBar();

    int i;
    for (i = 0; i < Directory.getCategoryCount(); i++) {
        bar.addTab(bar.newTab().setText(Directory.getCategory(i).getName()).setTabListener(this));
    }

    mActionBarView = getLayoutInflater().inflate(R.layout.action_bar_custom, null);

    bar.setCustomView(mActionBarView);
    bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_USE_LOGO);
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    bar.setDisplayShowHomeEnabled(true);

    // If category is not saved to the savedInstanceState,
    // 0 is returned by default.
    if (savedInstanceState != null) {
        int category = savedInstanceState.getInt("category");
        bar.selectTab(bar.getTabAt(category));
    }
}

From source file:com.todoroo.astrid.actfm.TagSettingsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    setupForDialogOrFullscreen();/*from  w ww  . j  av a 2 s  .c om*/
    super.onCreate(savedInstanceState);
    setContentView(R.layout.tag_settings_activity);
    tagData = getIntent().getParcelableExtra(TagViewFragment.EXTRA_TAG_DATA);
    if (tagData == null) {
        isNewTag = true;
        tagData = new TagData();
    }

    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayShowCustomEnabled(true);
        actionBar.setCustomView(R.layout.header_title_view);
    }

    setUpSettingsPage();

    if (savedInstanceState != null && savedInstanceState.containsKey(MEMBERS_IN_PROGRESS)) {
        final String members = savedInstanceState.getString(MEMBERS_IN_PROGRESS);
        new Thread(new Runnable() {
            @Override
            public void run() {
                AndroidUtilities.sleepDeep(500);
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        updateMembers(members);
                    }
                });
            }
        }).start();
    }
    showCollaboratorsPopover();

}

From source file:com.todoroo.astrid.taskrabbit.TaskRabbitActivity.java

/** Initialize UI components */
private void setUpUIComponents() {
    if (taskTitle == null) {

        taskTitle = (EditText) findViewById(R.id.task_title);

        taskControls = (LinearLayout) findViewById(R.id.task_controls);
        descriptionControls = (LinearLayout) findViewById(R.id.description_controls);
        taskButton = (Button) findViewById(R.id.task_button);
        taskButton.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                submitTaskRabbit();/* w  w  w.j  a  v  a  2  s  .c  o m*/
            }
        });

        ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.setDisplayHomeAsUpEnabled(true);
            actionBar.setDisplayShowTitleEnabled(false);
            actionBar.setDisplayShowCustomEnabled(true);
            actionBar.setCustomView(R.layout.task_rabbit_header_view);

            View customView = actionBar.getCustomView();
            menuNav = customView.findViewById(R.id.menu_nav);
            menuNavDisclosure = (ImageView) customView.findViewById(R.id.menu_disclosure_arrow);

            menuTitle = (TextView) customView.findViewById(R.id.task_rabbit_title);
            menuNav.setOnClickListener(menuClickListener);
            createMenuPopover();
        }

        setUpControls();
    }
}