Example usage for android.app ActionBar setSubtitle

List of usage examples for android.app ActionBar setSubtitle

Introduction

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

Prototype

public abstract void setSubtitle(@StringRes int resId);

Source Link

Document

Set the action bar's subtitle.

Usage

From source file:Main.java

public static void setTitleDefault(ActionBar actionBar, CharSequence title) {
    if (actionBar == null) {
        return;/*from   w w  w . j  a  v  a2s  . c o  m*/
    }
    actionBar.setTitle(title);
    actionBar.setSubtitle(null);
    actionBar.show();
}

From source file:app.hacked.ScheduleListItemDetailActivity.java

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

    final ActionBar actionBar = getActionBar();
    actionBar.setSubtitle("This app is UNOFFICIAL use at your own risk");
    actionBar.setDisplayHomeAsUpEnabled(true);

    // savedInstanceState is non-null when there is fragment state
    // saved from previous configurations of this activity
    // (e.g. when rotating the screen from portrait to landscape).
    // In this case, the fragment will automatically be re-added
    // to its container so we don't need to manually add it.
    // For more information, see the Fragments API guide at:
    ///*w ww .  j  a va 2  s  . c o  m*/
    // http://developer.android.com/guide/components/fragments.html
    //
    if (savedInstanceState == null) {

        // Create the detail fragment and add it to the activity
        // using a fragment transaction.
        Bundle arguments = new Bundle();
        arguments.putString(ScheduleItemDetailFragment.SCHEDULETITLE,
                getIntent().getStringExtra(ScheduleItemDetailFragment.SCHEDULETITLE));
        arguments.putString(ScheduleItemDetailFragment.SCHEDULEID,
                getIntent().getStringExtra(ScheduleItemDetailFragment.SCHEDULEID));
        arguments.putString(ScheduleItemDetailFragment.SCHEDULEFULLDATAHTML,
                getIntent().getStringExtra(ScheduleItemDetailFragment.SCHEDULEFULLDATAHTML));
        arguments.putString(ScheduleItemDetailFragment.SCHEDULESTARTTIME,
                getIntent().getStringExtra(ScheduleItemDetailFragment.SCHEDULESTARTTIME));
        arguments.putString(ScheduleItemDetailFragment.SCHEDULEDESC,
                getIntent().getStringExtra(ScheduleItemDetailFragment.SCHEDULEDESC));
        arguments.putBoolean(ScheduleItemDetailFragment.ISDAYTITLE,
                getIntent().getBooleanExtra(ScheduleItemDetailFragment.ISDAYTITLE, false));
        arguments.putString(ScheduleItemDetailFragment.SCHEDULEENDTIME,
                getIntent().getStringExtra(ScheduleItemDetailFragment.SCHEDULEENDTIME));
        arguments.putBoolean(ScheduleItemDetailFragment.ARG_2PANE,
                getIntent().getBooleanExtra(ScheduleItemDetailFragment.ARG_2PANE, false));

        ScheduleItemDetailFragment fragment = new ScheduleItemDetailFragment();
        fragment.setArguments(arguments);
        getSupportFragmentManager().beginTransaction().replace(R.id.ScheduleDetails, fragment).commit();
    }
}

From source file:org.austindroids.austindroidstestapp.MainActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {

    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    ActionBar actionBar = getActionBar();
    actionBar.setSubtitle("Fish App");
    actionBar.setTitle("Fish App");
    actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.fish));
    // Dim navigation buttons on bottom
    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
    return true;/*from w w w  .ja v a  2s.c o  m*/
}

From source file:com.msplearning.android.app.EducationalContentDemoActivity.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@SuppressLint("NewApi")
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_educational_content_demo);

    // Create an adapter that when requested, will return a fragment representing an object in the collection.
    // ViewPager and its adapters use support library fragments, so we must use getSupportFragmentManager.
    mDemoCollectionPagerAdapter = new DemoCollectionPagerAdapter(getSupportFragmentManager());

    // Set up action bar.
    final ActionBar actionBar = getActionBar();
    actionBar.setSubtitle(getString(R.string.title_view_pager_demo));

    // Specify that the Home button should show an "Up" caret, indicating that touching the button will take the user one step up in the application's hierarchy.
    actionBar.setDisplayHomeAsUpEnabled(true);

    // Set up the ViewPager, attaching the adapter.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mDemoCollectionPagerAdapter);
}

From source file:com.richtodd.android.quiltdesign.app.ThemeEditActivity.java

@Override
public void onEditNamePositiveClick(DialogFragment dialog, String name) throws Exception {

    Repository repository = Repository.getDefaultRepository(this);
    ThemeContainer themes = repository.getThemes();
    if (themes.themeExists(name)) {
        AlertDialogFragment alertDialog = AlertDialogFragment.create(KEY_FILE_EXISTS,
                getString(R.string.alert_message_themeAlreadyExists),
                getString(R.string.alert_button_acknowledge), null);
        alertDialog.show(getFragmentManager(), null);
    } else {/*from w  w  w .  j  ava 2  s .  com*/
        m_saveAsThemeName = name;
        getThemeEditFragment().setSaveAsThemeName(m_saveAsThemeName);
    }

    ActionBar ab = getActionBar();
    ab.setSubtitle(getCurrentThemeName());
}

From source file:com.richtodd.android.quiltdesign.app.ThemeEditActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_theme_edit);
    getActionBar().setDisplayHomeAsUpEnabled(true);

    m_themeNameArgument = getIntent().getStringExtra(ARG_THEME_NAME);

    if (savedInstanceState != null) {
        m_saveAsThemeName = savedInstanceState.getString("saveAsThemeName");
    }//from  w w w.  j a v a2  s  .  c  o  m

    ActionBar ab = getActionBar();
    ab.setTitle("Edit Theme");
    ab.setSubtitle(getCurrentThemeName());

    FragmentManager fm = getFragmentManager();

    // Create color settings fragment.
    {
        Fragment f = fm.findFragmentById(R.id.layout_themeEditFragment);
        if (f == null) {
            f = ThemeEditFragment.create(m_themeNameArgument);
            fm.beginTransaction().add(R.id.layout_themeEditFragment, f).commit();
        }
    }
}

From source file:org.dmfs.webcal.EventsPreviewActivity.java

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

    if (savedInstanceState == null) {
        FragmentManager fragmentManager = getSupportFragmentManager();
        FragmentTransaction transaction = fragmentManager.beginTransaction();
        transaction.add(R.id.events_preview_fragment_container,
                EventsPreviewDetailFragment.newInstance(mEvent, mCalendarName, mCalendarIconId, mTitle));
        transaction.commit();/*from   w  w  w  .  j a  va 2 s . co  m*/
    }

    ActionBar actionBar = getActionBar();

    if (TextUtils.equals(mTitle, mCalendarName)) {
        actionBar.setTitle(mCalendarName);
        actionBar.setSubtitle(null);
    } else {
        actionBar.setTitle(mCalendarName);
        actionBar.setSubtitle(mTitle);
    }

    // Show the Up button in the action bar.
    getActionBar().setDisplayHomeAsUpEnabled(true);
}

From source file:de.vanita5.twittnuker.fragment.support.SearchFragment.java

@Override
public void onActivityCreated(final Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    setHasOptionsMenu(true);/*www.  j a  v a  2  s .  c om*/
    final Bundle args = getArguments();
    final FragmentActivity activity = getActivity();
    mAdapter = new SupportTabsAdapter(activity, getChildFragmentManager(), null, 1);
    mAdapter.addTab(SearchStatusesFragment.class, args, getString(R.string.statuses),
            R.drawable.ic_iconic_action_twitter, 0);
    mAdapter.addTab(SearchUsersFragment.class, args, getString(R.string.users),
            R.drawable.ic_iconic_action_user, 1);
    mViewPager.setAdapter(mAdapter);
    mViewPager.setOnPageChangeListener(this);
    mViewPager.setOffscreenPageLimit(2);
    mPagerIndicator.setSelectedColor(ThemeUtils.getThemeColor(activity));
    mPagerIndicator.setViewPager(mViewPager);
    if (savedInstanceState == null && args != null && args.containsKey(EXTRA_QUERY)) {
        final String query = args.getString(EXTRA_QUERY);
        final SearchRecentSuggestions suggestions = new SearchRecentSuggestions(getActivity(),
                RecentSearchProvider.AUTHORITY, RecentSearchProvider.MODE);
        suggestions.saveRecentQuery(query, null);
        if (activity instanceof LinkHandlerActivity) {
            final ActionBar ab = activity.getActionBar();
            if (ab != null) {
                ab.setSubtitle(query);
            }
        }
    }
}

From source file:com.plnyyanks.frcnotebook.activities.ViewMatch.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(PreferenceHandler.getTheme());
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_match);

    activity = this;
    ActionBar bar = getActionBar();
    bar.setTitle(parentEvent.getEventName() + " - " + parentEvent.getEventYear());
    bar.setSubtitle(eventKey);
    bar.setDisplayHomeAsUpEnabled(true);

    if (matchKey == null)
        return;/*  w ww.  ja  v  a 2s .co  m*/

    if (PreferenceHandler.getTheme() == R.style.theme_dark) {
        ImageView nextMatch = (ImageView) findViewById(R.id.next_match);
        nextMatch.setBackgroundResource(R.drawable.ic_action_next_item_dark);
        ImageView prevMatch = (ImageView) findViewById(R.id.prev_match);
        prevMatch.setBackgroundResource(R.drawable.ic_action_previous_item_dark);
    }

    new GetNotesForMatch(this).execute(previousKey, matchKey, nextKey, eventKey);

    if (PreferenceHandler.getFMEnabled()) {
        TextView fieldMonitor = (TextView) findViewById(R.id.field_monitor_link);
        fieldMonitor.setVisibility(View.VISIBLE);
        fieldMonitor.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(activity, FieldMonitorActivity.class);
                startActivity(intent);
            }
        });
    }
}

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) {/*from ww  w  .  java  2 s.com*/

        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);
    }
}