Java Code Examples for androidx.appcompat.app.actionbar#setHomeButtonEnabled()
The following examples show how to use
androidx.appcompat.app.actionbar#setHomeButtonEnabled() .
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: ToolbarHelper.java From CloudReader with Apache License 2.0 | 6 votes |
/** * 将Toolbar高度填充到状态栏 */ public static void initFullBar(Toolbar toolbar, AppCompatActivity activity) { ViewGroup.LayoutParams params = toolbar.getLayoutParams(); params.height = DensityUtil.getStatusHeight(activity) + getSystemActionBarSize(activity); toolbar.setLayoutParams(params); toolbar.setPadding( toolbar.getLeft(), toolbar.getTop() + DensityUtil.getStatusHeight(activity), toolbar.getRight(), toolbar.getBottom() ); activity.setSupportActionBar(toolbar); ActionBar actionBar = activity.getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); }
Example 2
Source File: LoginSettingsFragment.java From tindroid with Apache License 2.0 | 6 votes |
@Override public void onCreatePreferences(Bundle bundle, String rootKey) { AppCompatActivity activity = (AppCompatActivity) getActivity(); if (activity == null) { return; } setHasOptionsMenu(false); ActionBar bar = activity.getSupportActionBar(); if (bar != null) { bar.setDisplayHomeAsUpEnabled(true); bar.setHomeButtonEnabled(true); bar.setTitle(R.string.settings); } addPreferencesFromResource(R.xml.login_preferences); SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity()); onSharedPreferenceChanged(sharedPreferences, "pref_hostName"); onSharedPreferenceChanged(sharedPreferences, "pref_useTLS"); onSharedPreferenceChanged(sharedPreferences, "pref_wireTransport"); }
Example 3
Source File: SettingsPreferenceActivity.java From DeviceConnect-Android with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); actionBar.setTitle(R.string.settings_name); } getSupportFragmentManager() .beginTransaction() .replace(R.id.settings_container, new RtspPreferenceFragment()) .commit(); }
Example 4
Source File: RTSPSettingPreferenceActivity.java From DeviceConnect-Android with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); actionBar.setTitle(R.string.settings_name); } getSupportFragmentManager() .beginTransaction() .replace(R.id.settings_container, new RtspPreferenceFragment()) .commit(); }
Example 5
Source File: CodeRecordActivity.java From XposedSmsCode with GNU General Public License v3.0 | 5 votes |
private void setupToolbar() { setSupportActionBar(mToolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); } }
Example 6
Source File: SettingsActivity.java From EhViewer with Apache License 2.0 | 5 votes |
private void setActionBarUpIndicator(Drawable drawable) { ActionBarDrawerToggle.Delegate delegate = getDrawerToggleDelegate(); if (delegate != null) { delegate.setActionBarUpIndicator(drawable, 0); } ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); } }
Example 7
Source File: ActionBarPreferenceActivity.java From SkyTube with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { getDelegate().installViewFactory(); getDelegate().onCreate(savedInstanceState); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowTitleEnabled(true); setTitle(R.string.preferences); } super.onCreate(savedInstanceState); }
Example 8
Source File: MainActivity.java From syncthing-android with Mozilla Public License 2.0 | 5 votes |
@Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); mDrawerToggle.syncState(); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeButtonEnabled(true); } }
Example 9
Source File: BaseToolbarFragment.java From Jockey with Apache License 2.0 | 5 votes |
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 10
Source File: ActivityUtils.java From WiFiAnalyzer with GNU General Public License v3.0 | 5 votes |
static void setActionBarOptions(ActionBar actionBar) { if (actionBar == null) { return; } actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); }
Example 11
Source File: BaseActivity.java From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 | 5 votes |
@Deprecated public void setupActionBar(Toolbar toolbar) { if (toolbar != null && getSupportActionBar() == null) { setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); } } }
Example 12
Source File: NavigationDrawerFragment.java From bitmask_android with GNU General Public License v3.0 | 5 votes |
private ActionBar setupActionBar() { AppCompatActivity activity = (AppCompatActivity) getActivity(); activity.setSupportActionBar(toolbar); final ActionBar actionBar = activity.getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayShowTitleEnabled(true); return actionBar; }
Example 13
Source File: HomeActivity.java From XposedSmsCode with GNU General Public License v3.0 | 5 votes |
private void refreshActionBar(String title) { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setTitle(title); actionBar.setHomeButtonEnabled(true); if (mCurrentFragment instanceof SettingsFragment) { actionBar.setDisplayHomeAsUpEnabled(false); } else { actionBar.setDisplayHomeAsUpEnabled(true); } } }
Example 14
Source File: DynamicActivity.java From dynamic-support with Apache License 2.0 | 5 votes |
/** * Set the icon and on click listener for the back or up button in the app bar. * * @param icon The drawable used for the back or up button. * @param onClickListener The click listener for the back or up button. */ public void setNavigationClickListener(@Nullable Drawable icon, @Nullable View.OnClickListener onClickListener) { mToolbar.setNavigationIcon(icon); setSupportActionBar(mToolbar); final ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayShowHomeEnabled(true); actionBar.setHomeButtonEnabled(onClickListener != null); } mToolbar.setNavigationOnClickListener(onClickListener); }
Example 15
Source File: BaseActivity.java From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 | 5 votes |
public void setupActionBar() { if (mToolbarEnabled) { setupToolbar(); } else { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); } } }
Example 16
Source File: ImageZoomActivity.java From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 | 5 votes |
private void initActionBar() { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); } }
Example 17
Source File: CodeRulesActivity.java From SmsCode with GNU General Public License v3.0 | 5 votes |
private void refreshActionBar(String title) { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setTitle(title); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); } }
Example 18
Source File: HoneycombUtil.java From shortyz with GNU General Public License v3.0 | 5 votes |
@TargetApi(11) @Override public void holographic(AppCompatActivity a) { ActionBar bar = a.getSupportActionBar(); if (bar != null) { bar.setHomeButtonEnabled(true); } }
Example 19
Source File: ComposeActivity.java From lttrs-android with Apache License 2.0 | 5 votes |
private void setupActionBar() { setSupportActionBar(binding.toolbar); final ActionBar actionbar = requireActionBar(); final boolean displayUpButton = !isTaskRoot(); actionbar.setHomeButtonEnabled(displayUpButton); actionbar.setDisplayHomeAsUpEnabled(displayUpButton); }
Example 20
Source File: MainActivity.java From FChat with MIT License | 4 votes |
private void prepareActionBar(Toolbar toolbar) { setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(false); actionBar.setHomeButtonEnabled(false); }