@Override protected void onCreate(@Nullable Bundle savedInstanceState) { findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content).getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); super.onCreate(savedInstanceState); setContentView(R.layout.activity_sample); // Handle Toolbar Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setTitle(R.string.sample_diff_util); //style our ui new MaterializeBuilder().withActivity(this).build(); //create our FastAdapter which will manage everything fastItemAdapter = new FastItemAdapter<>(); //get our recyclerView and do basic setup RecyclerView rv = findViewById(R.id.rv); rv.setLayoutManager(new LinearLayoutManager(this)); rv.setItemAnimator(new AlphaInAnimator()); rv.setAdapter(fastItemAdapter); //fill with some sample data setData(); //set the back arrow in the toolbar getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(false); //restore selections (this has to be done after the items were added fastItemAdapter.withSavedInstanceState(savedInstanceState); }
@Override protected void setTitle() { try { String[] title = {""}; if (colIsOpen()) { title = getCol().getDecks().current().getString("name").split("::"); } else { Timber.e("Could not set title in reviewer because collection closed"); } getSupportActionBar().setTitle(title[title.length - 1]); super.setTitle(title[title.length - 1]); } catch (JSONException e) { throw new RuntimeException(e); } getSupportActionBar().setSubtitle(""); }
Colors colors = (Colors) bundle.getSerializable(Libs.BUNDLE_COLORS); if (colors != null) { ab.setBackgroundDrawable(new ColorDrawable(colors.appBarColor)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow().setStatusBarColor(colors.statusBarColor); ab.setBackgroundDrawable(null); ab.setDisplayHomeAsUpEnabled(true); ab.setDisplayShowTitleEnabled(!TextUtils.isEmpty(title)); ab.setTitle(title);
@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); } }
@Override protected void onCreate(Bundle savedInstanceState) { Themes.setThemeLegacy(this); super.onCreate(savedInstanceState); // Add a home button to the actionbar getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.about_activity); ButterKnife.bind(this); getSupportActionBar().setDisplayHomeAsUpEnabled(true); String version = getString(R.string.about_version_format, BuildConfig.VERSION_NAME); mVersionText.setText(version); mGithubText.setMovementMethod(LinkMovementMethod.getInstance()); }
? mOptions.activityTitle : getResources().getString(R.string.crop_image_activity_title); actionBar.setTitle(title); actionBar.setDisplayHomeAsUpEnabled(true);
private void setupView() { Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); actionBar = getSupportActionBar(); if (actionBar != null) { final Drawable arrowDrawable = ViewUtils.getArrowIcon(this); final int arrowColor = config.getArrowColor(); if (arrowColor != ImagePickerConfig.NO_COLOR && arrowDrawable != null) { arrowDrawable.setColorFilter(arrowColor, PorterDuff.Mode.SRC_ATOP); } actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeAsUpIndicator(arrowDrawable); actionBar.setDisplayShowTitleEnabled(true); } }
@SuppressWarnings("ConstantConditions") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fragment); boolean isFragmentX = getIntent().getExtras().getBoolean("IS_FRAGMENT_X"); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setSubtitle(isFragmentX ? "Fragment V4" : "Fragment"); } if (isFragmentX) { if (savedInstanceState == null) { androidx.fragment.app.Fragment fragment = androidx.fragment.app.Fragment.instantiate(this, SecondFragmentX.class.getName()); getSupportFragmentManager().beginTransaction() .add(R.id.container, fragment, SECOND_FRAGMENT_X) .commit(); } } else { if (savedInstanceState == null) { android.app.Fragment fragment = android.app.Fragment.instantiate(this, SecondFragment.class.getName()); getFragmentManager().beginTransaction() .add(R.id.container, fragment, SECOND_FRAGMENT) .commit(); } } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.demo_screen); views = new ViewHolder(this); setSupportActionBar(views.toolbar); getSupportActionBarNotNull().setDisplayHomeAsUpEnabled(true); getSupportActionBarNotNull().setDisplayShowTitleEnabled(false); initDecorMargins(); initTopImage(); initGrid(); initPager(); initPagerAnimator(); if (savedPagerPosition != NO_POSITION) { // A photo was shown in the pager, we should switch to pager mode instantly applyFullPagerState(1f, false); } }
@Override protected void setTitle() { getSupportActionBar().setTitle(R.string.preview_title); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); supportRequestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayShowTitleEnabled(false); actionBar.setHomeButtonEnabled(false); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setBackgroundDrawable( new ColorDrawable(ContextCompat.getColor(this, android.R.color.transparent))); } mGamesFragment = PlayGamesFragment.getInstance(this, this); mApiClient = new GoogleApiClient.Builder(this).addApi(AppIndex.APP_INDEX_API).build(); // add App Indexing API BASE_APP_URI = Uri.parse( "android-app://" + getApplicationContext().getPackageName() + "/" + getResources() .getString(R.string.santa_tracker_deep_link_prefix)); ImmersiveModeHelper.setImmersiveSticky(getWindow()); ImmersiveModeHelper.installSystemUiVisibilityChangeListener(getWindow()); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_content_highlight); if (getSupportActionBar() != null) { getSupportActionBar().hide(); } publication = (Publication) getIntent().getSerializableExtra(Constants.PUBLICATION); mConfig = AppUtil.getSavedConfig(this); mIsNightMode = mConfig != null && mConfig.isNightMode(); initViews(); }
private void restoreActionBar() { ActionBar ab = getSupportActionBar(); if (ab != null) { ab.setDisplayShowTitleEnabled(true); ab.setTitle(mTitle); } }
private void updateSubtitleText() { int count = mModelIds.size(); mActionBar.setSubtitle(getResources().getQuantityString(R.plurals.model_browser_types_available, count, count)); }
public static void toggleActionBar(AppCompatActivity actionBarActivity, ViewPager viewPager) { try { if (actionBarActivity == null || actionBarActivity.getSupportActionBar() == null) return; FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) viewPager .getLayoutParams(); if (lp == null) return; if (actionBarActivity.getSupportActionBar().isShowing()) { actionBarActivity.getSupportActionBar().hide(); lp.topMargin = 0; viewPager.setLayoutParams(lp); } else { actionBarActivity.getSupportActionBar().show(); lp.topMargin = getActionBarHeightCompat(actionBarActivity); viewPager.setLayoutParams(lp); } } catch (Throwable t) { Log.e("DilbertFragmentActivity", "Toggle ActionBar failed", t); } }
protected ActionBar readyActionBarToCustomView () { ActionBar ab = getSupportActionBar(); ab.setDisplayShowHomeEnabled(false); ab.setDisplayShowTitleEnabled(false); ab.setDisplayShowCustomEnabled(true); return ab; }
ActionBar mActionBar = getSupportActionBar(); if (mActionBar != null) { mActionBar.setDisplayShowTitleEnabled(false);
@Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); getSupportActionBarNotNull().setDisplayHomeAsUpEnabled(true); }