Java Code Examples for android.app.ActionBar#setSubtitle()

The following examples show how to use android.app.ActionBar#setSubtitle() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DuoDrawerToggleHoneycomb.java    From duo-navigation-drawer with Apache License 2.0 6 votes vote down vote up
public static SetIndicatorInfo setActionBarDescription(SetIndicatorInfo info, Activity activity,
                                                       int contentDescRes) {
    if (info == null) {
        info = new SetIndicatorInfo(activity);
    }
    if (info.setHomeAsUpIndicator != null) {
        try {
            final ActionBar actionBar = activity.getActionBar();
            info.setHomeActionContentDescription.invoke(actionBar, contentDescRes);
            if (Build.VERSION.SDK_INT <= 19) {
                // For API 19 and earlier, we need to manually force the
                // action bar to generate a new content description.
                actionBar.setSubtitle(actionBar.getSubtitle());
            }
        } catch (Exception e) {
            Log.w(TAG, "Couldn't set content description via JB-MR2 API", e);
        }
    }
    return info;
}
 
Example 2
Source File: MoreSettingsActivity.java    From Blackbulb with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    Settings settings = Settings.getInstance(this);

    if (settings.isDarkTheme()) {
        setTheme(android.R.style.Theme_Material);
    }

    super.onCreate(savedInstanceState);

    final ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setSubtitle(R.string.app_name);
    }

    getFragmentManager().beginTransaction()
            .replace(android.R.id.content, new SettingsFragment())
            .commit();
}
 
Example 3
Source File: ArticleCollectionActivity.java    From aard2-android with GNU General Public License v3.0 6 votes vote down vote up
private void updateTitle(int position) {
    Log.d("updateTitle", ""+position + " count: " + articleCollectionPagerAdapter.getCount());
    Slob.Blob blob = articleCollectionPagerAdapter.get(position);
    CharSequence pageTitle = articleCollectionPagerAdapter.getPageTitle(position);
    Log.d("updateTitle", ""+blob);
    ActionBar actionBar = getActionBar();
    if (blob != null) {
        String dictLabel = blob.owner.getTags().get("label");
        actionBar.setTitle(dictLabel);
        Application app = (Application)getApplication();
        app.history.add(app.getUrl(blob));
    }
    else {
        actionBar.setTitle("???");
    }
    actionBar.setSubtitle(pageTitle);
}
 
Example 4
Source File: MainActivity.java    From Bitocle with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    ActionBar actionBar = getActionBar();
    actionBar.setTitle(R.string.app_name);
    actionBar.setSubtitle(null);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setHomeButtonEnabled(false);

    fragment = (MainFragment) getSupportFragmentManager().findFragmentById(R.id.main_fragment);

    preferences = getSharedPreferences(getString(R.string.login_sp), MODE_PRIVATE);
    editor = preferences.edit();

    layoutParams = getWindow().getAttributes();

    search = (AutoCompleteTextView) findViewById(R.id.main_header_search);
    View line = findViewById(R.id.main_header_line);
    fragment.setSearch(search);
    fragment.setLine(line);
}
 
Example 5
Source File: WebViewActivity.java    From Bitocle with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.webview);

    Intent intent = getIntent();
    String title = intent.getStringExtra(getString(R.string.webview_intent_title));
    String subTitle = intent.getStringExtra(getString(R.string.webview_intent_subtitle));

    ActionBar actionBar = getActionBar();
    actionBar.setTitle(title);
    actionBar.setSubtitle(subTitle);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayHomeAsUpEnabled(true);

    fragment = (WebViewFragment) getSupportFragmentManager().findFragmentById(R.id.webview_fragment);

    preferences = getSharedPreferences(getString(R.string.login_sp), MODE_PRIVATE);
    editor = preferences.edit();

    layoutParams = getWindow().getAttributes();
}
 
Example 6
Source File: WebViewActivity.java    From Bitocle with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.webview);

    Intent intent = getIntent();
    String title = intent.getStringExtra(getString(R.string.webview_intent_title));
    String subTitle = intent.getStringExtra(getString(R.string.webview_intent_subtitle));

    ActionBar actionBar = getActionBar();
    actionBar.setTitle(title);
    actionBar.setSubtitle(subTitle);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayHomeAsUpEnabled(true);

    fragment = (WebViewFragment) getSupportFragmentManager().findFragmentById(R.id.webview_fragment);
}
 
Example 7
Source File: MainActivity.java    From Bitocle with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    ActionBar actionBar = getActionBar();
    actionBar.setTitle(R.string.app_name);
    actionBar.setSubtitle(null);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setHomeButtonEnabled(false);

    fragment = (MainFragment) getSupportFragmentManager().findFragmentById(R.id.main_fragment);

    search = (AutoCompleteTextView) findViewById(R.id.main_header_search);
    View line = findViewById(R.id.main_header_line);
    fragment.setSearch(search);
    fragment.setLine(line);
}
 
Example 8
Source File: BluetoothChatFragment.java    From android-BluetoothChat with Apache License 2.0 5 votes vote down vote up
/**
 * Updates the status on the action bar.
 *
 * @param resId a string resource ID
 */
private void setStatus(int resId) {
    FragmentActivity activity = getActivity();
    if (null == activity) {
        return;
    }
    final ActionBar actionBar = activity.getActionBar();
    if (null == actionBar) {
        return;
    }
    actionBar.setSubtitle(resId);
}
 
Example 9
Source File: BluetoothChatFragment.java    From connectivity-samples with Apache License 2.0 5 votes vote down vote up
/**
 * Updates the status on the action bar.
 *
 * @param resId a string resource ID
 */
private void setStatus(int resId) {
    FragmentActivity activity = getActivity();
    if (null == activity) {
        return;
    }
    final ActionBar actionBar = activity.getActionBar();
    if (null == actionBar) {
        return;
    }
    actionBar.setSubtitle(resId);
}
 
Example 10
Source File: AbstractFragmentsActivity.java    From subsampling-scale-image-view with Apache License 2.0 5 votes vote down vote up
private void updateNotes() {
    if (page > notes.size() - 1) {
        return;
    }
    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setSubtitle(notes.get(page).getSubtitle());
    }
    onPageChanged(page);
}
 
Example 11
Source File: SettingsActivity.java    From DroidPlay with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	
	setContentView(R.layout.settings);
	
	// action bar icon as home link
	ActionBar actionBar = getActionBar();
	actionBar.setSubtitle("Settings");
	actionBar.setHomeButtonEnabled(true);
	actionBar.setDisplayUseLogoEnabled(false);
	actionBar.setDisplayHomeAsUpEnabled(true); 
	
	// preferences
	prefs = getSharedPreferences("DroidPlay", 0);
	
	// server port
	serverPort = (EditText) findViewById(R.id.server_port);
	
	// image transition
	ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.image_transition_item, R.id.transition, AirPlayUtils.getTransitionDescriptions());
	imageTransition = (Spinner) findViewById(R.id.image_transition);
	imageTransition.setAdapter(adapter);
	
	// load settings
	loadSettings();
}
 
Example 12
Source File: MainActivity.java    From Bitocle with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    ActionBar actionBar = getActionBar();
    actionBar.setTitle(R.string.app_name);
    actionBar.setSubtitle(null);
    actionBar.setHomeButtonEnabled(false);

    mainFragment = (MainFragment) getSupportFragmentManager().findFragmentById(R.id.main_fragment);
}
 
Example 13
Source File: AbstractPagesActivity.java    From subsampling-scale-image-view with Apache License 2.0 5 votes vote down vote up
private void updateNotes() {
    if (page > notes.size() - 1) {
        return;
    }
    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setSubtitle(notes.get(page).getSubtitle());
    }
    ((TextView)findViewById(R.id.note)).setText(notes.get(page).getText());
    findViewById(R.id.next).setVisibility(page >= notes.size() - 1 ? View.INVISIBLE : View.VISIBLE);
    findViewById(R.id.previous).setVisibility(page <= 0 ? View.INVISIBLE : View.VISIBLE);
    onPageChanged(page);
}
 
Example 14
Source File: MainActivity.java    From AndrOBD with GNU General Public License v3.0 5 votes vote down vote up
/**
 * set status message in status bar
 *
 * @param subTitle status text to be set
 */
private void setStatus(CharSequence subTitle)
{
	final ActionBar actionBar = getActionBar();
	if (actionBar != null)
	{
		actionBar.setSubtitle(subTitle);
		// show action bar to make state change visible
		unHideActionBar();
	}
}
 
Example 15
Source File: ChannelLookupActivity.java    From UTubeTV with The Unlicense 5 votes vote down vote up
public void setActionBarTitle() {
  CharSequence title = "Channel Editor";
  CharSequence subtitle = "" + listFragment.getCount() + " Channels";

  ActionBar bar = getActionBar();

  if (bar != null) {
    bar.setTitle(title);
    bar.setSubtitle(subtitle);
  }
}
 
Example 16
Source File: BluetoothChatFragment.java    From connectivity-samples with Apache License 2.0 5 votes vote down vote up
/**
 * Updates the status on the action bar.
 *
 * @param subTitle status
 */
private void setStatus(CharSequence subTitle) {
    FragmentActivity activity = getActivity();
    if (null == activity) {
        return;
    }
    final ActionBar actionBar = activity.getActionBar();
    if (null == actionBar) {
        return;
    }
    actionBar.setSubtitle(subTitle);
}
 
Example 17
Source File: DeviceControlActivity.java    From bluetooth-spp-terminal with Apache License 2.0 4 votes vote down vote up
@Override
public void handleMessage(Message msg) {
    DeviceControlActivity activity = mActivity.get();
    if (activity != null) {
        switch (msg.what) {
            case MESSAGE_STATE_CHANGE:

                Utils.log("MESSAGE_STATE_CHANGE: " + msg.arg1);
                final ActionBar bar = activity.getActionBar();
                switch (msg.arg1) {
                    case DeviceConnector.STATE_CONNECTED:
                        bar.setSubtitle(MSG_CONNECTED);
                        break;
                    case DeviceConnector.STATE_CONNECTING:
                        bar.setSubtitle(MSG_CONNECTING);
                        break;
                    case DeviceConnector.STATE_NONE:
                        bar.setSubtitle(MSG_NOT_CONNECTED);
                        break;
                }
                activity.invalidateOptionsMenu();
                break;

            case MESSAGE_READ:
                final String readMessage = (String) msg.obj;
                if (readMessage != null) {
                    activity.appendLog(readMessage, false, false, activity.needClean);
                }
                break;

            case MESSAGE_DEVICE_NAME:
                activity.setDeviceName((String) msg.obj);
                break;

            case MESSAGE_WRITE:
                // stub
                break;

            case MESSAGE_TOAST:
                // stub
                break;
        }
    }
}
 
Example 18
Source File: Api11Adapter.java    From mytracks with Apache License 2.0 4 votes vote down vote up
@Override
public void setTitleAndSubtitle(Activity activity, String title, String subtitle) {
  ActionBar actionBar = activity.getActionBar();
  actionBar.setTitle(title);
  actionBar.setSubtitle(subtitle);
}
 
Example 19
Source File: NextBaseFragment.java    From Android-Next with Apache License 2.0 4 votes vote down vote up
public final void setActionBarSubTitle(CharSequence text) {
    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setSubtitle(text);
    }
}
 
Example 20
Source File: NextBaseFragment.java    From Android-Next with Apache License 2.0 4 votes vote down vote up
public final void setActionBarSubTitle(int resId) {
    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setSubtitle(resId);
    }
}