@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionbar = getSupportActionBar(); actionbar.setDisplayHomeAsUpEnabled(true); actionbar.setHomeAsUpIndicator(R.drawable.ic_menu); mDrawerLayout = findViewById(R.id.drawer_layout); NavigationView navigationView = findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener( new NavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(MenuItem menuItem) { // set item as selected to persist highlight menuItem.setChecked(true); // close drawer when item is tapped mDrawerLayout.closeDrawers(); // Add code here to update the UI based on the item selected // For example, swap UI fragments here return 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); } }
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); } photoPreview = findViewById(R.id.photo_preview); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); disableRefresh(); findViewById(R.id.wizard_start_layout).requestFocus(); if (getSupportActionBar() != null) { Drawable closeIcon = ContextCompat.getDrawable(this, R.drawable.ic_clear); if (closeIcon != null) { int color = ContextCompat.getColor(this, R.color.color_primary); closeIcon.setTint(color); } getSupportActionBar().setHomeAsUpIndicator(closeIcon); } nextButton = findViewById(R.id.next_button); lrzIdEditText = findViewById(R.id.lrz_id); lrzIdEditText.addTextChangedListener(this); String lrzId = Utils.getSetting(this, Const.LRZ_ID, ""); lrzIdEditText.setText(lrzId); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_timetable_widget_configure); // Setup toolbar and save button setSupportActionBar(findViewById(R.id.main_toolbar)); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); Drawable closeIcon = ContextCompat.getDrawable(this, R.drawable.ic_check); if (closeIcon != null) { int color = ContextCompat.getColor(this, R.color.color_primary); closeIcon.setTint(color); } getSupportActionBar().setHomeAsUpIndicator(closeIcon); } // Get appWidgetId from intent Bundle extras = getIntent().getExtras(); if (extras != null) { appWidgetId = extras.getInt( AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); } ListView listViewLectures = findViewById(R.id.activity_timetable_lectures); // Initialize stations adapter CalendarController calendarController = new CalendarController(this); List<CalendarItem> lectures = calendarController.getLecturesForWidget(this.appWidgetId); listViewLectures.setAdapter(new LectureListSelectionAdapter(this, lectures, this.appWidgetId)); listViewLectures.requestFocus(); }
private void setupToolbar() { activity.setSupportActionBar(toolbar); if (activity.getSupportActionBar() != null) { activity.getSupportActionBar().setDisplayHomeAsUpEnabled(true); activity.getSupportActionBar().setHomeAsUpIndicator(R.drawable.dragdismiss_ic_close); activity.getSupportActionBar().setTitle(toolbarTitle); } if (!shouldShowToolbar) { toolbar.setVisibility(View.GONE); } int statusBarHeight = StatusBarHelper.getStatusBarHeight(activity); statusBar.getLayoutParams().height = statusBarHeight; if (appBarLayout == null) { ((CoordinatorLayout.LayoutParams) toolbar.getLayoutParams()).topMargin = statusBarHeight; } else { ((CoordinatorLayout.LayoutParams) appBarLayout.getLayoutParams()).topMargin = statusBarHeight; } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); PreferenceManager.setDefaultValues(this, R.xml.preferences, false); setContentView(R.layout.activity_main); ButterKnife.bind(this); setSupportActionBar(toolbar); ActionBar actionbar = getSupportActionBar(); actionbar.setDisplayHomeAsUpEnabled(true); actionbar.setHomeAsUpIndicator(R.drawable.ic_menu_white_24dp); viewPager.setAdapter(new MainPageAdapter(getSupportFragmentManager())); viewPager.addOnPageChangeListener(this); searchView.setOnQueryTextListener(this); searchView.setIconified(false); searchView.setIconifiedByDefault(false); navigationView.setNavigationItemSelectedListener(this::onNavigationItemSelected); onPageSelected(viewPager.getCurrentItem()); }
if (closeIcon != null) { closeIcon.setTint(color); getSupportActionBar().setHomeAsUpIndicator(closeIcon);
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); // bind button click Button mEmailSignInButton = findViewById(R.id.email_sign_in_button); mEmailSignInButton.setOnClickListener(view -> attemptLogin()); mEmailView = findViewById(R.id.email); mPasswordView = findViewById(R.id.password); // Attaching the layout to the toolbar object Toolbar toolbar = findViewById(R.id.tool_bar_login); // Setting toolbar as the ActionBar with setSupportActionBar() call setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeAsUpIndicator( new IconicsDrawable(this, FontAwesome.Icon.faw_chevron_left).actionBar() ); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_me); // Attaching the layout to the toolbar object Toolbar toolbar = findViewById(R.id.tool_bar_me); // Setting toolbar as the ActionBar with setSupportActionBar() call setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeAsUpIndicator( new IconicsDrawable(this, FontAwesome.Icon.faw_chevron_left).actionBar() ); init(); }
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle(displayNameAndHost); getSupportActionBar().setHomeAsUpIndicator( new IconicsDrawable(this, FontAwesome.Icon.faw_chevron_left).actionBar() );