Java Code Examples for androidx.appcompat.app.ActionBar#setDisplayShowHomeEnabled()

The following examples show how to use androidx.appcompat.app.ActionBar#setDisplayShowHomeEnabled() . 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: MessagePostActivity.java    From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
    }

    MessagePostParam postParam = getMessagePostParam();
    if (postParam.getAction().equals("new")) {
        setTitle(R.string.new_message);
    } else if (postParam.getAction().equals("reply")) {
        setTitle(R.string.reply_message);
    }

    Bundle bundle = new Bundle();
    bundle.putParcelable("param", postParam);
    Fragment fragment = new MessagePostFragment();
    fragment.setArguments(bundle);
    fragment.setHasOptionsMenu(true);
    getSupportFragmentManager().beginTransaction().replace(android.R.id.content, fragment).commit();

}
 
Example 2
Source File: RecentNotificationActivity.java    From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FragmentManager fm = getSupportFragmentManager();
    Fragment fragment = fm.findFragmentById(android.R.id.content);
    if (fragment == null) {
        fragment = new RecentNotificationFragment();
        fragment.setArguments(getIntent().getExtras());
        fm.beginTransaction().add(android.R.id.content, fragment).commit();
    }
    setTitle("我的被喷");
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
    }

}
 
Example 3
Source File: AbsAboutActivity.java    From about-page with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(layoutRes());
  toolbar = findViewById(R.id.toolbar);
  ImageView icon = findViewById(R.id.icon);
  slogan = findViewById(R.id.slogan);
  version = findViewById(R.id.version);
  collapsingToolbar = findViewById(R.id.collapsing_toolbar);
  headerContentLayout = findViewById(R.id.header_content_layout);
  onTitleViewCreated(collapsingToolbar);
  onCreateHeader(icon, slogan, version);

  setSupportActionBar(toolbar);
  ActionBar actionBar = getSupportActionBar();
  if (actionBar != null) {
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowHomeEnabled(true);
  }
  onApplyPresetAttrs();
  recyclerView = findViewById(R.id.list);
}
 
Example 4
Source File: BaseActivity.java    From MasteringAndroidDataBinding with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(false);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setDisplayUseLogoEnabled(false);
    }
}
 
Example 5
Source File: DetailActivity.java    From android-popular-movies-app with Apache License 2.0 5 votes vote down vote up
/**
 * Show an up button in Collapsing Toolbar
 */
private void showUpButton() {
    setSupportActionBar(mDetailBinding.toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
    }
}
 
Example 6
Source File: ArtistFragment.java    From Jockey with Apache License 2.0 5 votes vote down vote up
private void setUpToolbar(Toolbar toolbar) {
    toolbar.setTitle(mArtist.getArtistName());

    setActivitySupportActionBar(toolbar);
    ActionBar actionBar = getActivitySupportActionBar();

    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeButtonEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
    }
}
 
Example 7
Source File: AlbumFragment.java    From Jockey with Apache License 2.0 5 votes vote down vote up
private void setupToolbar(Toolbar toolbar) {
    toolbar.setTitle(mAlbum.getAlbumName());
    setActivitySupportActionBar(toolbar);

    ActionBar actionBar = getActivitySupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeButtonEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
    }
}
 
Example 8
Source File: BaseToolbarFragment.java    From Jockey with Apache License 2.0 5 votes vote down vote up
protected void setUpToolbar(Toolbar toolbar) {
    toolbar.setTitle(getFragmentTitle());

    setActivitySupportActionBar(toolbar);
    ActionBar actionBar = getActivitySupportActionBar();

    if (actionBar != null) {
        boolean showUpButton = canNavigateUp();
        actionBar.setDisplayHomeAsUpEnabled(showUpButton);
        actionBar.setHomeButtonEnabled(showUpButton);
        actionBar.setDisplayShowHomeEnabled(showUpButton);

        actionBar.setHomeAsUpIndicator(getUpButtonDrawable());
    }
}
 
Example 9
Source File: GingerbreadUtil.java    From shortyz with GNU General Public License v3.0 5 votes vote down vote up
public View onActionBarCustom(AppCompatActivity a, int id) {
    System.out.println("Setting custom ActionBar view");
    ActionBar bar = a.getSupportActionBar();
    if(bar == null){
        return null;
    }
    bar.setDisplayShowCustomEnabled(true);
    bar.setDisplayShowTitleEnabled(false);
    bar.setDisplayShowHomeEnabled(true);
    bar.setCustomView(id);
    return bar.getCustomView();
}
 
Example 10
Source File: RecommendedAppsActivity.java    From Chimee with MIT License 5 votes vote down vote up
private void setupToolbar() {
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setTitle("");
    }
}
 
Example 11
Source File: SaveActivity.java    From Chimee with MIT License 5 votes vote down vote up
private void setupToolbar() {
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setTitle("");
    }
}
 
Example 12
Source File: HistoryActivity.java    From Chimee with MIT License 5 votes vote down vote up
private void setupToolbar() {
	Toolbar toolbar = findViewById(R.id.toolbar);
	setSupportActionBar(toolbar);
	ActionBar actionBar = getSupportActionBar();
	if (actionBar != null) {
		actionBar.setDisplayHomeAsUpEnabled(true);
		actionBar.setDisplayShowHomeEnabled(true);
		actionBar.setTitle("");
	}
}
 
Example 13
Source File: BaseActivity.java    From android with MIT License 5 votes vote down vote up
@Override
protected void onResume() {
    super.onResume();

    ActionBar bar = getSupportActionBar();
    if (null != bar) {
        bar.setDisplayHomeAsUpEnabled(true); // 设置返回按钮可见
        bar.setDisplayShowHomeEnabled(true); // 设置是否显示logo图标
        bar.setHomeButtonEnabled(true); // 设置左上角的图标可点击
    }
}
 
Example 14
Source File: BaseActivity.java    From android with MIT License 5 votes vote down vote up
@Override
protected void onResume() {
    super.onResume();

    ActionBar bar = getSupportActionBar();
    if (null != bar) {
        bar.setDisplayHomeAsUpEnabled(true); // 设置返回按钮可见
        bar.setDisplayShowHomeEnabled(true); // 设置是否显示logo图标
        bar.setHomeButtonEnabled(true); // 设置左上角的图标可点击
    }
}
 
Example 15
Source File: FavoriteActivity.java    From Chimee with MIT License 5 votes vote down vote up
private void setupToolbar() {
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setTitle("");
    }
}
 
Example 16
Source File: DemoFragmentActivity.java    From ActivityTaskView with Apache License 2.0 5 votes vote down vote up
private void setActionBarBack() {
    ActionBar actionBar = getSupportActionBar();
    if(actionBar != null) {
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
}
 
Example 17
Source File: BaseActivity.java    From ActivityTaskView with Apache License 2.0 5 votes vote down vote up
private void setActionBarBack() {
    ActionBar actionBar = getSupportActionBar();
    if(actionBar != null) {
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
}
 
Example 18
Source File: HelpActivity.java    From Chimee with MIT License 5 votes vote down vote up
private void setupToolbar() {
	Toolbar toolbar = findViewById(R.id.toolbar);
	setSupportActionBar(toolbar);
	ActionBar actionBar = getSupportActionBar();
	if (actionBar != null) {
		actionBar.setDisplayHomeAsUpEnabled(true);
		actionBar.setDisplayShowHomeEnabled(true);
		actionBar.setTitle("");
	}
}
 
Example 19
Source File: CodeConverterDetailsActivity.java    From Chimee with MIT License 5 votes vote down vote up
private void setupToolbar() {
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setTitle("");
    }
}
 
Example 20
Source File: CodeConverterActivity.java    From Chimee with MIT License 5 votes vote down vote up
private void setupToolbar() {
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setTitle("");
    }
}