Java Code Examples for android.support.v7.app.ActionBar#setHomeActionContentDescription()

The following examples show how to use android.support.v7.app.ActionBar#setHomeActionContentDescription() . 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: ReadingActivity.java    From IslamicLibraryAndroid with GNU General Public License v3.0 5 votes vote down vote up
public void populateReaderActionBar(@NonNull CharSequence title, CharSequence author) {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setHomeActionContentDescription(R.string.exit_book);
        setTitle(title);
        actionBar.setSubtitle(author);
        if (ReadingActivity.this.getResources().getBoolean(R.bool.reader_show_action_bar_title)) {
            ReadingActivity.this.getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE,
                    ActionBar.DISPLAY_SHOW_TITLE);
        }
    }
    if (SystemUtils.runningOnLollipopOrLater()) {
        ReadingActivity.this.setTaskDescription(new ActivityManager.TaskDescription(title.toString()));
    }
}
 
Example 2
Source File: ToolbarCancel.java    From px-android with MIT License 5 votes vote down vote up
private void init() {
    final Activity activity = getActivity();
    if (activity instanceof AppCompatActivity) {
        final AppCompatActivity appCompatActivity = (AppCompatActivity)activity;
        appCompatActivity.setSupportActionBar(this);
        final ActionBar supportActionBar = appCompatActivity.getSupportActionBar();
        supportActionBar.setHomeAsUpIndicator(R.drawable.ic_close);
        supportActionBar.setHomeActionContentDescription(R.string.px_label_close);
        supportActionBar.setDisplayHomeAsUpEnabled(true);
        supportActionBar.setDisplayShowTitleEnabled(false);
        setNavigationOnClickListener(v -> appCompatActivity.onBackPressed());
    }
}
 
Example 3
Source File: SummaryView.java    From px-android with MIT License 5 votes vote down vote up
public void configureToolbar(@NonNull final AppCompatActivity activity,
    @NonNull final View.OnClickListener listener) {
    final Toolbar toolbar = findViewById(R.id.toolbar);
    activity.setSupportActionBar(toolbar);

    final ActionBar actionBar = activity.getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setHomeButtonEnabled(true);
        actionBar.setHomeActionContentDescription(R.string.px_label_back);
    }
    toolbar.setNavigationOnClickListener(listener);
}
 
Example 4
Source File: SecurityCodeActivity.java    From px-android with MIT License 5 votes vote down vote up
private void initializeToolbar() {
    mToolbar = findViewById(R.id.mpsdkToolbar);
    setSupportActionBar(mToolbar);
    final ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setHomeActionContentDescription(R.string.px_label_back);
    }
    mToolbar.setNavigationOnClickListener(v -> onBackPressed());
}