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:com.burntout.burntout.AddCarActivity.java

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

    ActionBar bar = getActionBar();
    bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#1E5791")));
    bar.setTitle("Burnt Out");
    bar.setSubtitle("Add Vehicle");
    bar.setDisplayHomeAsUpEnabled(true);

    //adapter = new AutopickerArrayAdapter(this, R.layout.add_car_activity, autopickerValues);

    makeModelEntry = (EditText) findViewById(R.id.make_model);
    plateNumberEntry = (EditText) findViewById(R.id.plate_number);
    pageMarkers = (PageMarkers) findViewById(R.id.pageMarkersAdd);
    pageMarkers.setTotalPages(4);//from w  w  w.  ja  v a2 s  .  com
    pageMarkers.makeView(0);

    Context context = this;

    SharedPreferences sharedPref = context.getSharedPreferences(getString(R.string.pref), Context.MODE_PRIVATE);

    email = sharedPref.getString("email", null);

    vehicleTypeHSV = (VehicleTypeHSV) findViewById(R.id.addVehicleTypeHSV);
    vehicleTypeHSV.setComm(this);
    vehicleTypeHSV.initItems(this);
    vehicleTypeHSV.setFeatureItems();
    vehicleTypeHSV.addManagers(this);

    statePicker = (StatePicker) findViewById(R.id.statepicker_view2);

    submitBtn = (Button) findViewById(R.id.submit_button_addcar);

    addListenerOnSubmit();

}

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

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

    myRecreating = false;/*from w ww .j av  a  2s  . 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.dmfs.webcal.fragments.PagerFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View returnView = inflater.inflate(R.layout.fragment_pager, container, false);

    mProgressBar = (ProgressBar) returnView.findViewById(android.R.id.progress);
    mMessageText = (TextView) returnView.findViewById(android.R.id.message);

    mAdapter = new SectionsPagerAdapter(getChildFragmentManager(), mIcon);

    mViewPager = (ViewPager) returnView.findViewById(R.id.pager);
    mViewPager.setOnPageChangeListener(this);
    mViewPager.setAdapter(mAdapter);/*from   w w w. ja  va 2 s .c  o m*/

    // start loading the pages
    getLoaderManager().initLoader(ID_URL_LOADER, null, this);

    // set the page title and clear the subtitle if any
    ActionBar actionBar = getActivity().getActionBar();
    actionBar.setTitle(mTitle);
    actionBar.setSubtitle(null);

    // load the icon and set it if we get any, otherwise insert a placeholder and set it later
    Drawable icon = ImageProxy.getInstance(this.getActivity()).getImage(mIcon, this);
    if (icon != null) {
        // we need to pre-scale the icon, apparently Android doesn't do that for us
        actionBar.setIcon(BitmapUtils.scaleDrawable(getResources(), (BitmapDrawable) icon, 36, 36));
    } else {
        actionBar.setIcon(new ColorDrawable(getResources().getColor(android.R.color.transparent)));
    }

    return returnView;
}

From source file:com.burntout.burntout.SendReportActivity.java

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

    ActionBar bar = getActionBar();
    bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#1E5791")));
    bar.setTitle("Burnt Out");
    bar.setSubtitle("Report Burnout");
    bar.setDisplayHomeAsUpEnabled(true);

    context = this;
    SharedPreferences sharedPref = context.getSharedPreferences(getString(R.string.pref), Context.MODE_PRIVATE);

    email = sharedPref.getString("email", null);

    Log.d("email", email);

    frontText = (TextView) findViewById(R.id.frontText);
    backText = (TextView) findViewById(R.id.backText);
    reportedLightsCheck = (TextView) findViewById(R.id.reported_lights_text);
    reportPlateNumber = (EditText) findViewById(R.id.report_plate_number);
    message = (EditText) findViewById(R.id.extra_message);
    submitBtn = (Button) findViewById(R.id.report_button);
    pageMarkers = (PageMarkers) findViewById(R.id.pageMarkersReport);
    pageMarkers.setTotalPages(4);/*from w w w  . j  a  v a 2  s.  c  o m*/
    pageMarkers.makeView(0);

    statePicker = (StatePicker) findViewById(R.id.statepicker_view1);

    reportables = (TappablesHSV) findViewById(R.id.tappablesHSV1);
    reportables.setCommunicator(this);
    reportables.initItems(this);
    reportables.setFeatureItems();
    reportables.addManagers(this);

    reportPlateNumber.clearFocus();
    message.clearFocus();

    addListenerOnSubmit();

}

From source file:com.glanznig.beepme.view.MainActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);//from  w ww .  j  a  v  a2s . co  m

    audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);

    pagerAdapter = new MainSectionsPagerAdapter(getSupportFragmentManager(), this);
    final ActionBar actionBar = getActionBar();

    final BeeperApp app = (BeeperApp) getApplication();

    if (app.getPreferences().isTestMode()) {
        actionBar.setSubtitle(getString(R.string.pref_title_test_mode));
    }

    // displaying tabs in the action bar
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    pager = (ViewPager) findViewById(R.id.main_tab_pager);
    pager.setAdapter(pagerAdapter);

    // set gap between pages
    pager.setPageMargin((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4,
            this.getResources().getDisplayMetrics()));
    pager.setPageMarginDrawable(R.drawable.swipe_filler);

    // listening for page changes
    pager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            actionBar.setSelectedNavigationItem(position);
        }
    });

    // for each of the sections in the app, add a tab to the action bar
    for (int i = 0; i < pagerAdapter.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(pagerAdapter.getPageTitle(i)).setTabListener(this));
    }
}

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

@Override
public void onEditNamePositiveClick(DialogFragment dialog, String name) throws Exception {
    Repository repository = Repository.getDefaultRepository(this);
    QuiltContainer quilts = repository.getQuilts();
    if (quilts.quiltExists(name)) {
        AlertDialogFragment alertDialog = AlertDialogFragment.create(KEY_FILE_EXISTS,
                getString(R.string.alert_message_quiltAlreadyExists),
                getString(R.string.alert_button_acknowledge), null);
        alertDialog.show(getFragmentManager(), null);
    } else {/*  www .  j  a va  2 s  . co m*/
        m_saveAsQuiltName = name;
        getQuiltEditFragment().setSaveAsQuiltName(m_saveAsQuiltName);
    }

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

From source file:com.tcity.android.ui.overview.project.ProjectOverviewActivity.java

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

    myRecreating = false;//from   w ww.ja  v  a 2  s.  c o  m
    myProjectId = calculateProjectId();

    setContentView(R.layout.overview_ui);

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

        if (!isRootProject(myProjectId)) {
            bar.setDisplayHomeAsUpEnabled(true);
        }
    }

    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.mariotaku.twidere.fragment.support.SearchFragment.java

@Override
public void onActivityCreated(final Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    setHasOptionsMenu(true);//from   w w  w . ja va2s .  c  o m
    final Bundle args = getArguments();
    final FragmentActivity activity = getActivity();
    mPagerAdapter = new SupportTabsAdapter(activity, getChildFragmentManager(), null, 1);
    mPagerAdapter.addTab(StatusesSearchFragment.class, args, getString(R.string.statuses),
            R.drawable.ic_action_twitter, 0, null);
    mPagerAdapter.addTab(SearchUsersFragment.class, args, getString(R.string.users), R.drawable.ic_action_user,
            1, null);
    mViewPager.setAdapter(mPagerAdapter);
    mViewPager.setOffscreenPageLimit(2);
    mPagerIndicator.setViewPager(mViewPager);
    mPagerIndicator.setTabDisplayOption(TabPagerIndicator.LABEL);
    mPagerIndicator.setOnPageChangeListener(this);
    ThemeUtils.initPagerIndicatorAsActionBarTab(activity, mPagerIndicator, mPagerWindowOverlay);
    ThemeUtils.setCompatToolbarOverlay(activity, new EmptyDrawable());
    ThemeUtils.setCompatContentViewOverlay(activity, new EmptyDrawable());
    ThemeUtils.setWindowOverlayViewOverlay(activity, new EmptyDrawable());

    if (activity instanceof IThemedActivity) {
        final String backgroundOption = ((IThemedActivity) activity).getCurrentThemeBackgroundOption();
        final boolean isTransparent = ThemeUtils.isTransparentBackground(backgroundOption);
        final int actionBarAlpha = isTransparent
                ? ThemeUtils.getActionBarAlpha(ThemeUtils.getUserThemeBackgroundAlpha(activity))
                : 0xFF;
        mPagerIndicator.setAlpha(actionBarAlpha / 255f);
    }
    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);
        final ContentResolver cr = getContentResolver();
        final ContentValues values = new ContentValues();
        values.put(SearchHistory.QUERY, query);
        cr.insert(SearchHistory.CONTENT_URI, values);
        if (activity instanceof LinkHandlerActivity) {
            final ActionBar ab = activity.getActionBar();
            if (ab != null) {
                ab.setSubtitle(query);
            }
        }
    }
    updateTabOffset();
}

From source file:app.philm.in.AndroidDisplay.java

@Override
public void setActionBarSubtitle(CharSequence title) {
    ActionBar ab = mActivity.getActionBar();
    if (ab != null) {
        if (mColorScheme != null) {
            ab.setSubtitle(convertToCondensed(title, mColorScheme.secondaryText));
        } else {//w  w w  .  j  a v a 2s  .  c o  m
            ab.setSubtitle(convertToCondensed(title));
        }
    }
}

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

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

    m_quiltNameArgument = getIntent().getStringExtra(ARG_QUILT_NAME);

    if (savedInstanceState != null) {
        m_saveAsQuiltName = savedInstanceState.getString("saveAsQuiltName");
    }//from w  ww.  jav a2 s.  com

    ActionBar ab = getActionBar();
    ab.setTitle("Edit Quilt");
    ab.setSubtitle(getCurrentQuiltName());

    FragmentManager fm = getFragmentManager();

    // Create color settings fragment.
    {
        Fragment fragment = fm.findFragmentById(R.id.layout_quiltEditFragment);
        if (fragment == null) {
            fragment = QuiltEditFragment.create(m_quiltNameArgument);
            fm.beginTransaction().add(R.id.layout_quiltEditFragment, fragment).commit();
        }
    }

    m_layout_blocks = (NestedLinearLayout) findViewById(R.id.layout_blocks);

    populateLayoutBlocks();
}