Example usage for android.app ActionBar setDisplayShowTitleEnabled

List of usage examples for android.app ActionBar setDisplayShowTitleEnabled

Introduction

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

Prototype

public abstract void setDisplayShowTitleEnabled(boolean showTitle);

Source Link

Document

Set whether an activity title/subtitle should be displayed.

Usage

From source file:edu.ufl.cise.android.MainActivity.java

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

    // 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();

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

    // Specify that we will be displaying tabs in the action bar.
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setDisplayUseLogoEnabled(false);

    // 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.
        actionBar.addTab(
                actionBar.newTab().setText(mAppSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
    }
}

From source file:com.numenta.taurus.TaurusBaseActivity.java

@SuppressLint("InflateParams")
@Override//from w w  w  . j av a  2s .c o m
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.i(TAG, "{TAG:ANDROID.APP.CREATE}");
    final ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayShowTitleEnabled(false);
    }
    LayoutInflater inflater = getLayoutInflater();

    _refreshView = inflater.inflate(R.layout.actionbar_indeterminate_progress, null);

}

From source file:blackman.matt.infinitebrowser.InfinityBrowser.java

/**
 * Restores the action bar when called./*from  ww  w . jav a  2  s. co  m*/
 */
void restoreActionBar() {
    ActionBar actionBar = getActionBar();
    assert actionBar != null;
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
}

From source file:com.example.gangzhang.myapplication.VideoPlayerActivity.java

public void restoreActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(getTitle());/*from w ww.jav a2 s  .  co m*/
    actionBar.setIcon(null);
    actionBar.setDisplayUseLogoEnabled(false);
}

From source file:com.aknowledge.v1.automation.RemoteActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_remote);
    myApp = (PyHomeController) getApplication();

    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    actionBar.setListNavigationCallbacks(
            // Specify a SpinnerAdapter to populate the dropdown list.
            new ArrayAdapter<String>(actionBar.getThemedContext(), android.R.layout.simple_list_item_1,
                    android.R.id.text1, new String[] { "All" }),
            this);

}

From source file:com.keithcassidy.finishline.HomeActivity.java

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

    //volume controls will adjust media playback when this app has focus
    setVolumeControlStream(AudioManager.STREAM_MUSIC);

    // Set up the action bar.
    final ActionBar actionBar = getActionBar();// getSupportActionBar();
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.pinstripe_actionbar_tile));

    currentFragment = PreferencesUtils.getCurrentFragment(this);

    homeFragment = new HomeFragment();
    setupFragment1 = new SetupFragment();
    ((SetupFragment) setupFragment1).setBuoyNumber(1);
    setupFragment2 = new SetupFragment();
    ((SetupFragment) setupFragment2).setBuoyNumber(2);
    lineCrossFragment = new LineCrossingsFragment();
    mapFragment = new FinishLineMapFragment();

    // Create the adapter that will return a fragment for each of the 
    // primary sections of the app.
    mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());

    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mSectionsPagerAdapter);
    mViewPager.setCurrentItem(currentFragment);

    mIndicator = (TitlePageIndicator) findViewById(R.id.indicator);
    mIndicator.setViewPager(mViewPager);

    mIndicator.setClipPadding(-10);//  w  w  w . j a  v  a 2  s .  c  o m
    // When swiping between different sections, select the corresponding
    // tab. We can also use ActionBar.Tab#select() to do this if we have
    // a reference to the Tab.
    mIndicator.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            try {
                currentFragment = position;
                //               PreferencesUtils.setCurrentFragment(context, currentFragment);

                TabFocusInterface frag = (TabFocusInterface) mSectionsPagerAdapter.getItem(position);
                frag.tabSetFocus();

                if (lastPosition != -1) {
                    frag = (TabFocusInterface) mSectionsPagerAdapter.getItem(lastPosition);
                    frag.tabLoseFocus();
                }

                lastPosition = position;
            } catch (Exception e) {
                Log.e(TAG, "onPageSelected " + e);
            }

        }

        @Override
        public void onPageScrollStateChanged(int state) {

        }

        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

        }
    });

    LocalBroadcastManager.getInstance(this).registerReceiver(onBroadcastServiceStatusReceived,
            new IntentFilter(Constants.SERVICE_STATUS_MESSAGE));

    new SimpleEula(this).show();
}

From source file:com.notriddle.budget.EnvelopesActivity.java

private void setupDrawer() {
    mNavDrawer = (ListView) findViewById(R.id.left_drawer);
    mNavAdapter = new NavAdapter(this);
    mNavDrawer.setAdapter(mNavAdapter);/*from  ww  w  . j  a va2s  . c  o  m*/
    mNavDrawer.setOnItemClickListener(this);
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mNavToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer,
            R.string.drawerOpen_button, R.string.drawerClose_button) {
        @Override
        public void onDrawerClosed(View v) {
            super.onDrawerClosed(v);
            ActionBar ab = getActionBar();
            ab.setTitle(getTitle());
            invalidateOptionsMenu();
            if (mCustomActionBarView != null) {
                ab.setCustomView(mCustomActionBarView);
                ab.setDisplayShowTitleEnabled(false);
                ab.setDisplayShowCustomEnabled(true);
            }
        }

        @Override
        public void onDrawerSlide(View v, float off) {
            super.onDrawerSlide(v, off);
            int allIn = mColor;
            int allOut = 0xFFEEEEEE;
            int result = Color.rgb((int) (Color.red(allIn) * (1 - off) + Color.red(allOut) * off),
                    (int) (Color.green(allIn) * (1 - off) + Color.green(allOut) * off),
                    (int) (Color.blue(allIn) * (1 - off) + Color.blue(allOut) * off));
            mActionBarColor.setColor(result);
        }

        @Override
        public void onDrawerOpened(View v) {
            super.onDrawerOpened(v);
            ActionBar ab = getActionBar();
            ab.setTitle(getString(R.string.app_name));
            invalidateOptionsMenu();
            if (mCustomActionBarView != null) {
                ab.setDisplayShowTitleEnabled(true);
                ab.setDisplayShowCustomEnabled(false);
                ab.setCustomView(null);
            }
        }
    };
    mDrawerLayout.setDrawerListener(mNavToggle);
    getActionBar().setHomeButtonEnabled(true);
    getActionBar().setDisplayHomeAsUpEnabled(true);
}

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

void onGetStatus(TwitterStatus status) {
    mStatus = new TwitterStatus(status);
    updateViewVisibility();//from   w  ww  .  j  ava  2s  .c o m

    ActionBar actionBar = getActionBar();
    actionBar.setDisplayUseLogoEnabled(true);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);

    invalidateOptionsMenu();
    setComposeDefault();
}

From source file:com.google.samples.apps.iosched.ui.BaseScheduleActivity.java

private void updateActionBarNavigation() {
    boolean show = !isNavDrawerOpen();
    if (getLPreviewUtils().shouldChangeActionBarForDrawer()) {
        ActionBar ab = getActionBar();
        ab.setDisplayShowTitleEnabled(show);
        ab.setDisplayUseLogoEnabled(!show);
    }//  w w w  . j ava 2s .  co  m
}

From source file:org.webinos.android.app.wrt.ui.WidgetListActivity.java

@Override
public void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    setContentView(R.layout.activity_widget_list);

    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayShowHomeEnabled(false);
        actionBar.setDisplayShowTitleEnabled(false);
    } else {// w  w w.j  av a2  s  . c o  m
        Log.i(TAG, "WidgetListActivity has no action bar.");
    }

    registerForContextMenu(getListView());
    asyncRefreshHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            initList();
        }
    };
    mgr = WidgetManagerService.getWidgetManagerInstance(this, this);
    if (mgr != null) {
        mgr.addEventListener(this);
        initList();
    }

    scanner = new WidgetImportHelper(this);

    /* populate stores array */
    stores = getStores();

    synchronized (this) {
        if (mgr == null) {
            blocked = true;
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    /* put up progress dialog until the service is
                     * available */
                    Activity context = WidgetListActivity.this;
                    progressDialog = new ProgressDialog(context);
                    progressDialog.setCancelable(false);
                    progressDialog.setMessage(context.getString(R.string.initialising_runtime));
                    progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
                    progressDialog.setIndeterminate(false);
                    progressDialog.setMax(PROGRESS_MAX);
                    progressDialog.show();
                    progressDialog.setProgressNumberFormat(null);
                }
            });
        }
    }

    /* BroadcastReceiver to receive module loading progress */
    progressBroadcastReceiver = new ProgressBroadcastReceiver();
}