Example usage for android.app ActionBar setTitle

List of usage examples for android.app ActionBar setTitle

Introduction

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

Prototype

public abstract void setTitle(@StringRes int resId);

Source Link

Document

Set the action bar's title.

Usage

From source file:com.lithiumli.fiction.NowPlayingActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.now_playing);
    initializeDrawer(false);/*from   w w  w  .j av a 2  s . co m*/

    mCoverPager = (AlbumSwiper) findViewById(R.id.cover_pager);
    mCoverPager.setListener(this);

    mSongName = (TextView) findViewById(R.id.np_song_name);
    mSongAlbum = (TextView) findViewById(R.id.np_song_album);
    mSongArtist = (TextView) findViewById(R.id.np_song_artist);
    mSongArtist.setSelected(true);

    ActionBar ab = getActionBar();
    ab.setDisplayHomeAsUpEnabled(true);
    ab.setTitle("Now Playing");

    mCache = ArtistImageCache.getInstance(this);

    setQueueMargin();

    HandlerThread thread = new HandlerThread("thread");
    thread.start();

    mLooper = thread.getLooper();
    mHandler = new Handler(mLooper);

    mFadeOut = new FadeOut();
    mHandler.postDelayed(mFadeOut, 2000);
}

From source file:org.openmidaas.app.activities.MainTabActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
    setContentView(R.layout.activity_main_tab);

    //Get the text
    tabProfile = getResources().getString(R.string.profileTabtext);
    tabScan = getResources().getString(R.string.scanTabtext);
    tabInputURL = getResources().getString(R.string.urlTabtext);

    //Enabling action bar
    ActionBar actionBar = getActionBar();
    actionBar.setTitle(null);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST | ActionBar.DISPLAY_SHOW_TITLE);
    actionBar.show();//from  ww w  .ja va2s.c o  m
    getOverflowMenu();

    mActivity = this;
    mProgressDialog = new ProgressDialog(mActivity);

    mAttributeListFragment = new AttributeListFragment();
    mUrlInputFragment = new EnterURLDialogFragment();
    mScanFragment = new ScanFragment();

    mTabHost = (TabHost) findViewById(android.R.id.tabhost);
    mTabHost.setOnTabChangedListener(listener);
    mTabHost.setup();
    mTabHost.getTabWidget().setShowDividers(LinearLayout.SHOW_DIVIDER_NONE);
    //initializing tabs
    initializeTab();
    //Check for updates
    checkForUpdates();
    //See if its being called to process URL from push message. 
    //MainAcivity not being killed to be consistent with what happens when the URL taken via QR code etc.
    if ((getIntent().getExtras() != null) && !getIntent().getExtras().isEmpty()) {
        if (getIntent().getAction().equals(Constants.IntentActionMessages.PROCESS_URL)) {
            processUrl(getIntent().getExtras().getString("url"));
        }
    }
}

From source file:com.tcity.android.ui.overview.buildconfiguration.BuildConfigurationOverviewActivity.java

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

    myRecreating = false;/*from   www .  j a va2s  . c  o m*/
    myBuildConfigurationId = getIntent().getStringExtra(ID_INTENT_KEY);

    setContentView(R.layout.overview_ui);

    ActionBar bar = getActionBar();
    if (bar != null) {
        bar.setTitle(calculateTitle());
        bar.setSubtitle(calculateSubtitle());
        bar.setDisplayHomeAsUpEnabled(true);
    }

    updateSyncBound();

    myLayout = (SwipeRefreshLayout) findViewById(R.id.overview_srlayout);
    myLayout.setColorSchemeResources(R.color.green, R.color.red);
    myLayout.setOnRefreshListener(this);

    myEngine = calculateEngine();
    setListAdapter(myEngine.getAdapter());
}

From source file:org.jorge.lolin1.ui.frags.NavigationDrawerFragment.java

private void restoreActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(Boolean.TRUE);
    actionBar.setTitle(LoLin1Utils.getString(getActivity(),
            "title_section" + (DrawerLayoutFragmentActivity.getLastSelectedNavDrawerIndex() + 1), "Home"));
}

From source file:org.jorge.lolin1.ui.frags.NavigationDrawerFragment.java

/**
 * Per the navigation drawer design guidelines, updates the action bar to show the actionbar app
 * 'context', rather than just what's in the current screen.
 *//*  ww w  . ja v a 2s .  c  o  m*/
private void showGlobalContextActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(Boolean.TRUE);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setTitle(R.string.app_name);
}

From source file:fr.simon.marquis.preferencesmanager.ui.AppListActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(App.theme.theme);/*w w w . ja v  a2 s  .c o  m*/
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_app_list);
    Utils.checkBackups(getApplicationContext());
    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setTitle(Ui.applyCustomTypeFace(getString(R.string.app_name), this));
    }

    loadingView = findViewById(R.id.loadingView);
    emptyView = findViewById(R.id.emptyView);
    listView = (StickyListHeadersListView) findViewById(R.id.listView);
    listView.setDrawingListUnderStickyHeader(false);
    listView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            if (isRootAccessGiven) {
                startPreferencesActivity((AppEntry) mAdapter.getItem(arg2));
            } else {
                checkRoot();
            }
        }
    });

    if (savedInstanceState == null) {
        checkRoot();
    }

    if (savedInstanceState == null || Utils.getPreviousApps() == null) {
        startTask();
    } else {
        updateListView(Utils.getPreviousApps());
    }
}

From source file:org.catnut.fragment.MentionTimelineFragment.java

@Override
public void onStart() {
    super.onStart();
    ActionBar bar = getActivity().getActionBar();
    bar.setIcon(R.drawable.ic_stat_mention);
    bar.setTitle(getString(R.string.mention_me_timeline));
}

From source file:org.mars3142.android.toaster.activity.MainActivity.java

private void restoreActionBar() {
    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setTitle(mTitle);
    }/*from  w w  w.  ja  v a2  s  . com*/
}

From source file:com.blueoxfords.peacecorpstinder.activities.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    activity = this;

    mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(this, getSupportFragmentManager());

    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mAppSectionsPagerAdapter);
    mViewPager.setOffscreenPageLimit(2);

    final ActionBar actionBar = getActionBar();

    if (actionBar != null) {
        actionBar.setHomeButtonEnabled(false);
        actionBar.setTitle(getString(R.string.app_name));
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

        mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
            @Override//  ww w .j a  v a  2  s .co  m
            public void onPageSelected(int position) {
                actionBar.setSelectedNavigationItem(position);
            }
        });
        for (int i = 0; i < mAppSectionsPagerAdapter.getCount(); i++) {
            actionBar.addTab(
                    actionBar.newTab().setIcon(mAppSectionsPagerAdapter.getPageIcon(i)).setTabListener(this));
        }
    }
}

From source file:net.kw.shrdlu.grtgtfs.Activities.MenuListActivity.java

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

    mListDetail = findViewById(R.id.detail_area);

    // Set what's shown on a new screen, before children change things
    getActionBar().setIcon(R.drawable.grticon_leftspace);
    getActionBar().setTitle(R.string.app_name);

    // Load up the navigation drawer
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerListView = (ListView) findViewById(R.id.left_drawer);

    mNavAdapter = new NavDrawerListAdapter(mContext, R.layout.drawer_list_item, mDrawerItems);
    mDrawerListView.setAdapter(mNavAdapter);

    mDrawerToggle = new ActionBarDrawerToggle(mContext, mDrawerLayout, R.string.drawer_open,
            R.string.drawer_close) {//  w  w w .  j  a  v a2 s  .co m

        CharSequence savedtitle, savedsubtitle;

        /** Called when a drawer has settled in a completely closed state. */
        public void onDrawerClosed(View view) {
            super.onDrawerClosed(view);
            final ActionBar ab = getActionBar();
            if (ab != null) {
                ab.setSubtitle(savedsubtitle);
                ab.setTitle(savedtitle);
            }
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }

        /** Called when a drawer has settled in a completely open state. */
        public void onDrawerOpened(View drawerView) {
            super.onDrawerOpened(drawerView);
            final ActionBar ab = getActionBar();
            if (ab != null) {
                savedtitle = ab.getTitle();
                savedsubtitle = ab.getSubtitle();
                ab.setTitle(R.string.app_name);
                ab.setSubtitle(null);
            }
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }
    };

    // Set the drawer toggle as the DrawerListener
    mDrawerLayout.setDrawerListener(mDrawerToggle);

    mDrawerListView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
            mDrawerLayout.closeDrawers();
            if (!onNavOptionSelected(mDrawerItems.get(position).getId()))
                NavOptions.onNavOptionSelected(mContext, mDrawerItems.get(position).getId());
        }
    });

    // Display the hamburger in the home screen, else the < home symbol.
    getActionBar().setHomeButtonEnabled(true);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    String lcn = mContext.getLocalClassName();
    if (lcn.equals(GRTApplication.LocalClassNameHome)) { // home screen
        mDrawerToggle.setDrawerIndicatorEnabled(true);
    } else {
        mDrawerToggle.setDrawerIndicatorEnabled(false);
    }
}