Java Code Examples for androidx.appcompat.app.actionbar#setDisplayHomeAsUpEnabled()
The following examples show how to use
androidx.appcompat.app.actionbar#setDisplayHomeAsUpEnabled() .
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: SRTSettingPreferenceActivity.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 SRTPreferenceFragment()) .commit(); }
Example 2
Source File: BaseActivity.java From shinny-futures-android with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mViewDataBinding = DataBindingUtil.setContentView(this, mLayoutID); mToolbar = findViewById(R.id.toolbar); mToolbarTitle = findViewById(R.id.title_toolbar); mToolbar.setTitle(""); mToolbarTitle.setText(mTitle); setSupportActionBar(mToolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); } sContext = BaseApplication.getContext(); sDataManager = DataManager.getInstance(); initData(); initEvent(); updateToolbarFromNetwork(sContext, mTitle); boolean isFirm = (boolean) SPUtils.get(sContext, CONFIG_IS_FIRM, true); changeStatusBarColor(isFirm); }
Example 3
Source File: DonationsActivity.java From J2ME-Loader with Apache License 2.0 | 6 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_donations); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setTitle(R.string.donate); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); DonationsFragment donationsFragment; if (BuildConfig.DONATIONS_GOOGLE) { donationsFragment = DonationsFragment.newInstance(BuildConfig.DEBUG, true, GOOGLE_PUBKEY, GOOGLE_CATALOG, getResources().getStringArray(R.array.donation_google_catalog_values), false, null, null, null, false, null, null, false, null); } else { donationsFragment = DonationsFragment.newInstance(BuildConfig.DEBUG, false, null, null, null, true, PAYPAL_USER, PAYPAL_CURRENCY_CODE, getString(R.string.donation_paypal_item), false, null, null, false, null); } ft.replace(R.id.donations_activity_container, donationsFragment, "donationsFragment"); ft.commit(); }
Example 4
Source File: SettingsActivity.java From Android-Developer-Fundamentals-Version-2 with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.settings_activity); if (savedInstanceState == null) { getSupportFragmentManager() .beginTransaction() .replace(R.id.settings, new HeaderFragment()) .commit(); } else { setTitle(savedInstanceState.getCharSequence(TITLE_TAG)); } getSupportFragmentManager().addOnBackStackChangedListener( new FragmentManager.OnBackStackChangedListener() { @Override public void onBackStackChanged() { if (getSupportFragmentManager().getBackStackEntryCount() == 0) { setTitle(R.string.title_activity_settings); } } }); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } }
Example 5
Source File: AbstractPreferenceActivity.java From AndroidPreferenceActivity with Apache License 2.0 | 6 votes |
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); initializeToolbarElevation(sharedPreferences); initializeNavigationWidth(sharedPreferences); initializePreferenceScreenElevation(sharedPreferences); initializeBreadCrumbElevation(sharedPreferences); initializeOverrideBackButton(sharedPreferences); initializeHideNavigation(sharedPreferences); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } }
Example 6
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 7
Source File: LabActivity.java From a with GNU General Public License v3.0 | 5 votes |
public void setupActionBar(String title) { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setTitle(title); } }
Example 8
Source File: LoginActivity.java From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mLoginFragment = new LoginWebFragment(); getSupportFragmentManager().beginTransaction().replace(android.R.id.content, mLoginFragment).commit(); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(true); } }
Example 9
Source File: ShareActivity.java From deltachat-android with GNU General Public License v3.0 | 5 votes |
private void initializeToolbar() { Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } }
Example 10
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 11
Source File: BookSourceActivity.java From MyBookshelf with GNU General Public License v3.0 | 5 votes |
private void setupActionBar() { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setTitle(R.string.book_source_manage); } }
Example 12
Source File: GeneralFragment.java From Taskbar with Apache License 2.0 | 5 votes |
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); AppCompatActivity activity = (AppCompatActivity) getActivity(); activity.setTitle(R.string.tb_pref_header_general); ActionBar actionBar = activity.getSupportActionBar(); if(actionBar != null) actionBar.setDisplayHomeAsUpEnabled(true); }
Example 13
Source File: MoreBundleFragment.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); getFragmentComponent(savedInstanceState).inject(this); if (savedInstanceState != null) { if (savedInstanceState.containsKey(MORE_LIST_STATE_KEY)) { listState = savedInstanceState.getParcelable(MORE_LIST_STATE_KEY); savedInstanceState.putParcelable(MORE_LIST_STATE_KEY, null); } } bundlesList = view.findViewById(R.id.more_bundles_list); toolbarElement = view.findViewById(R.id.action_bar); errorView = view.findViewById(R.id.error_view); progressBar = view.findViewById(R.id.progress_bar); swipeRefreshLayout = view.findViewById(R.id.more_refresh_layout); toolbar = view.findViewById(R.id.toolbar); adapter = new BundlesAdapter(new ArrayList<>(), new ProgressBundle(), new ErrorHomeBundle(), oneDecimalFormatter, uiEventsListener, new AdsBundlesViewHolderFactory(uiEventsListener, adClickedEvents, oneDecimalFormatter, marketName, false), captionBackgroundPainter, marketName, themeAttributeProvider); layoutManager = new LinearLayoutManager(getContext()); bundlesList.setLayoutManager(layoutManager); bundlesList.setAdapter(adapter); AppCompatActivity appCompatActivity = ((AppCompatActivity) getActivity()); if (getArguments().getBoolean(StoreTabGridRecyclerFragment.BundleCons.TOOLBAR, true)) { appCompatActivity.setSupportActionBar(toolbar); ActionBar actionBar = appCompatActivity.getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } } else { toolbarElement.setVisibility(GONE); } attachPresenter(presenter); }
Example 14
Source File: BaseToolbarFragment.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
/** * Setup the toolbar, if present. */ @CallSuper @Override public void setupToolbar() { if (hasToolbar()) { ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar); boolean showUp = displayHomeUpAsEnabled(); ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(showUp); actionBar.setTitle(toolbar.getTitle()); setupToolbarDetails(toolbar); } }
Example 15
Source File: SourceEditActivity.java From MyBookshelf with GNU General Public License v3.0 | 5 votes |
private void setupActionBar() { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setTitle(title); } }
Example 16
Source File: TxtChapterRuleActivity.java From MyBookshelf with GNU General Public License v3.0 | 5 votes |
private void setupActionBar() { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setTitle(R.string.txt_chapter_regex); } }
Example 17
Source File: EditHostActivity.java From Kore with Apache License 2.0 | 5 votes |
private void setupActionBar() { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setTitle(R.string.edit_xbmc); TypedArray styledAttrs = getTheme().obtainStyledAttributes(new int[] {R.attr.iconHosts}); actionBar.setIcon(styledAttrs.getResourceId(styledAttrs.getIndex(0), R.drawable.ic_devices_white_24dp)); styledAttrs.recycle(); actionBar.setDisplayHomeAsUpEnabled(true); } }
Example 18
Source File: ControllerPadFragment.java From Bluefruit_LE_Connect_Android_V2 with MIT License | 4 votes |
@Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); // Set title AppCompatActivity activity = (AppCompatActivity) getActivity(); if (activity != null) { ActionBar actionBar = activity.getSupportActionBar(); if (actionBar != null) { actionBar.setTitle(R.string.controlpad_title); actionBar.setDisplayHomeAsUpEnabled(true); } } // UI mRootLayout = view.findViewById(R.id.rootLayout); mTopSpacerView = view.findViewById(R.id.topSpacerView); mBottomSpacerView = view.findViewById(R.id.bottomSpacerView); mContentView = view.findViewById(R.id.contentView); mBufferTextView = view.findViewById(R.id.bufferTextView); if (mBufferTextView != null) { mBufferTextView.setKeyListener(null); // make it not editable } ImageButton upArrowImageButton = view.findViewById(R.id.upArrowImageButton); upArrowImageButton.setOnTouchListener(mPadButtonTouchListener); ImageButton leftArrowImageButton = view.findViewById(R.id.leftArrowImageButton); leftArrowImageButton.setOnTouchListener(mPadButtonTouchListener); ImageButton rightArrowImageButton = view.findViewById(R.id.rightArrowImageButton); rightArrowImageButton.setOnTouchListener(mPadButtonTouchListener); ImageButton bottomArrowImageButton = view.findViewById(R.id.bottomArrowImageButton); bottomArrowImageButton.setOnTouchListener(mPadButtonTouchListener); ImageButton button1ImageButton = view.findViewById(R.id.button1ImageButton); button1ImageButton.setOnTouchListener(mPadButtonTouchListener); ImageButton button2ImageButton = view.findViewById(R.id.button2ImageButton); button2ImageButton.setOnTouchListener(mPadButtonTouchListener); ImageButton button3ImageButton = view.findViewById(R.id.button3ImageButton); button3ImageButton.setOnTouchListener(mPadButtonTouchListener); ImageButton button4ImageButton = view.findViewById(R.id.button4ImageButton); button4ImageButton.setOnTouchListener(mPadButtonTouchListener); // Read shared preferences maxPacketsToPaintAsText = UartBaseFragment.kDefaultMaxPacketsToPaintAsText; //PreferencesFragment.getUartTextMaxPackets(this); }
Example 19
Source File: MatisseActivity.java From Matisse with Apache License 2.0 | 4 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { // programmatically set theme before super.onCreate() mSpec = SelectionSpec.getInstance(); setTheme(mSpec.themeId); super.onCreate(savedInstanceState); if (!mSpec.hasInited) { setResult(RESULT_CANCELED); finish(); return; } setContentView(R.layout.activity_matisse); if (mSpec.needOrientationRestriction()) { setRequestedOrientation(mSpec.orientation); } if (mSpec.capture) { mMediaStoreCompat = new MediaStoreCompat(this); if (mSpec.captureStrategy == null) throw new RuntimeException("Don't forget to set CaptureStrategy."); mMediaStoreCompat.setCaptureStrategy(mSpec.captureStrategy); } Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayHomeAsUpEnabled(true); Drawable navigationIcon = toolbar.getNavigationIcon(); TypedArray ta = getTheme().obtainStyledAttributes(new int[]{R.attr.album_element_color}); int color = ta.getColor(0, 0); ta.recycle(); navigationIcon.setColorFilter(color, PorterDuff.Mode.SRC_IN); mButtonPreview = (TextView) findViewById(R.id.button_preview); mButtonApply = (TextView) findViewById(R.id.button_apply); mButtonPreview.setOnClickListener(this); mButtonApply.setOnClickListener(this); mContainer = findViewById(R.id.container); mEmptyView = findViewById(R.id.empty_view); mOriginalLayout = findViewById(R.id.originalLayout); mOriginal = findViewById(R.id.original); mOriginalLayout.setOnClickListener(this); mSelectedCollection.onCreate(savedInstanceState); if (savedInstanceState != null) { mOriginalEnable = savedInstanceState.getBoolean(CHECK_STATE); } updateBottomToolbar(); mAlbumsAdapter = new AlbumsAdapter(this, null, false); mAlbumsSpinner = new AlbumsSpinner(this); mAlbumsSpinner.setOnItemSelectedListener(this); mAlbumsSpinner.setSelectedTextView((TextView) findViewById(R.id.selected_album)); mAlbumsSpinner.setPopupAnchorView(findViewById(R.id.toolbar)); mAlbumsSpinner.setAdapter(mAlbumsAdapter); mAlbumCollection.onCreate(this, this); mAlbumCollection.onRestoreInstanceState(savedInstanceState); mAlbumCollection.loadAlbums(); }
Example 20
Source File: ImageDetailActivity.java From graphics-samples with Apache License 2.0 | 4 votes |
@Override public void onCreate(Bundle savedInstanceState) { if (BuildConfig.DEBUG) { Utils.enableStrictMode(); } super.onCreate(savedInstanceState); setContentView(R.layout.image_detail_activity); final Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); // Fetch screen height and width, to use as our max size when loading images as this // activity runs full screen final DisplayMetrics displayMetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); final int height = displayMetrics.heightPixels; final int width = displayMetrics.widthPixels; // For this sample we'll use half of the longest width to resize our images. As the // image scaling ensures the image is larger than this, we should be left with a // resolution that is appropriate for both portrait and landscape. For best image quality // we shouldn't divide by 2, but this will use more memory and require a larger memory // cache. final int longest = (height > width ? height : width) / 2; ImageCache.ImageCacheParams cacheParams = new ImageCache.ImageCacheParams(this, IMAGE_CACHE_DIR); cacheParams.setMemCacheSizePercent(0.25f); // Set memory cache to 25% of app memory // The ImageFetcher takes care of loading images into our ImageView children asynchronously mImageFetcher = new ImageFetcher(this, longest); mImageFetcher.addImageCache(getSupportFragmentManager(), cacheParams); mImageFetcher.setImageFadeIn(false); // Set up ViewPager and backing adapter ImagePagerAdapter mAdapter = new ImagePagerAdapter( getSupportFragmentManager(), Images.imageUrls.length ); mPager = findViewById(R.id.pager); mPager.setAdapter(mAdapter); mPager.setPageMargin((int) getResources().getDimension(R.dimen.horizontal_page_margin)); mPager.setOffscreenPageLimit(2); // Set up activity to go full screen getWindow().addFlags(LayoutParams.FLAG_FULLSCREEN); // Enable some additional newer visibility and ActionBar features to create a more // immersive photo viewing experience final ActionBar actionBar = getSupportActionBar(); // Hide title text and set home as up if (actionBar != null) { actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayHomeAsUpEnabled(true); // Hide and show the ActionBar as the visibility changes mPager.setOnSystemUiVisibilityChangeListener( new View.OnSystemUiVisibilityChangeListener() { @Override public void onSystemUiVisibilityChange(int vis) { if ((vis & View.SYSTEM_UI_FLAG_LOW_PROFILE) != 0) { actionBar.hide(); } else { actionBar.show(); } } }); // Start low profile mode and hide ActionBar mPager.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE); actionBar.hide(); } // Set the current item based on the extra passed in to this activity final int extraCurrentItem = getIntent().getIntExtra(EXTRA_IMAGE, -1); if (extraCurrentItem != -1) { mPager.setCurrentItem(extraCurrentItem); } }