Java Code Examples for androidx.drawerlayout.widget.DrawerLayout#addDrawerListener()
The following examples show how to use
androidx.drawerlayout.widget.DrawerLayout#addDrawerListener() .
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: DrawerActions.java From android-test with Apache License 2.0 | 6 votes |
@Override public final void perform(UiController uiController, View view) { DrawerLayout drawer = (DrawerLayout) view; if (!checkAction().matches(drawer)) { return; } Object tag = drawer.getTag(TAG); IdlingDrawerListener idlingListener; if (tag instanceof IdlingDrawerListener) { idlingListener = (IdlingDrawerListener) tag; } else { idlingListener = new IdlingDrawerListener(); drawer.setTag(TAG, idlingListener); drawer.addDrawerListener(idlingListener); IdlingRegistry.getInstance().register(idlingListener); } performAction(uiController, drawer); uiController.loopMainThreadUntilIdle(); IdlingRegistry.getInstance().unregister(idlingListener); drawer.removeDrawerListener(idlingListener); drawer.setTag(TAG, null); }
Example 2
Source File: MainActivity.java From busybox with GNU General Public License v2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); PrefStore.setLocale(this); setContentView(R.layout.activity_main); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } DrawerLayout drawer = findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.addDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); output = findViewById(R.id.outputView); scroll = findViewById(R.id.scrollView); // enable context clickable output.setMovementMethod(LinkMovementMethod.getInstance()); }
Example 3
Source File: MainActivity.java From android with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); ButterKnife.bind(this); DrawerLayout drawer = findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.addDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); }
Example 4
Source File: BaseActivity.java From privacy-friendly-interval-timer with GNU General Public License v3.0 | 6 votes |
@Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); if(getSupportActionBar() == null) { setSupportActionBar(toolbar); } mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, mDrawerLayout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); mDrawerLayout.addDrawerListener(toggle); toggle.syncState(); mNavigationView = (NavigationView) findViewById(R.id.nav_view); mNavigationView.setNavigationItemSelectedListener(this); selectNavigationItem(getNavigationDrawerID()); View mainContent = findViewById(R.id.main_content); if (mainContent != null) { mainContent.setAlpha(0); mainContent.animate().alpha(1).setDuration(MAIN_CONTENT_FADEIN_DURATION); } }
Example 5
Source File: MainActivity.java From ui with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); fragmentManager = getSupportFragmentManager(); DrawerLayout drawer = findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.addDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); //add the first one as the default fragment. fragmentManager.beginTransaction().replace(R.id.container, new SupportDialogFragment()).commit(); }
Example 6
Source File: Utils.java From onpc with GNU General Public License v3.0 | 5 votes |
@SuppressWarnings("deprecation") public static void setDrawerListener(DrawerLayout mDrawerLayout, ActionBarDrawerToggle mDrawerToggle) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { mDrawerLayout.removeDrawerListener(mDrawerToggle); mDrawerLayout.addDrawerListener(mDrawerToggle); } else { mDrawerLayout.setDrawerListener(mDrawerToggle); } }
Example 7
Source File: DrawerNavigation.java From WiFiAnalyzer with GNU General Public License v3.0 | 5 votes |
DrawerNavigation(@NonNull MainActivity mainActivity, @NonNull Toolbar toolbar) { DrawerLayout drawer = mainActivity.findViewById(R.id.drawer_layout); drawerToggle = create( mainActivity, toolbar, drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.addDrawerListener(drawerToggle); syncState(); }
Example 8
Source File: DrawerActivity.java From materialistic with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.setContentView(R.layout.activity_drawer); mDrawer = findViewById(R.id.drawer); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerAccount = (TextView) findViewById(R.id.drawer_account); mDrawerLogout = findViewById(R.id.drawer_logout); mDrawerUser = findViewById(R.id.drawer_user); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.open_drawer, R.string.close_drawer) { @Override public void onDrawerClosed(View drawerView) { super.onDrawerClosed(drawerView); if (drawerView.equals(mDrawer) && mPendingNavigation != null) { final Intent intent = new Intent(DrawerActivity.this, mPendingNavigation); if (mPendingNavigationExtras != null) { intent.putExtras(mPendingNavigationExtras); mPendingNavigationExtras = null; } // TODO M bug https://code.google.com/p/android/issues/detail?id=193822 intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intent); mPendingNavigation = null; } } }; mDrawerLayout.addDrawerListener(mDrawerToggle); PreferenceManager.getDefaultSharedPreferences(this) .registerOnSharedPreferenceChangeListener(mLoginListener); setUpDrawer(); setUsername(); }
Example 9
Source File: MainActivity.java From GooglePlayCloned with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); CustomViewPager viewPager = findViewById(R.id.mainViewPager); setupViewPager(viewPager); TabLayout tabLayout = findViewById(R.id.tabs); tabLayout.setupWithViewPager(viewPager); final FloatingSearchView mSearchView = findViewById(R.id.search_view); mSearchView.setOnQueryChangeListener(new FloatingSearchView.OnQueryChangeListener() { @Override public void onSearchTextChanged(String oldQuery, final String newQuery) { } }); final DrawerLayout drawer = findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, null, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.addDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = findViewById(R.id.nav_view); navigationView.setItemIconTintList(null); de.hdodenhof.circleimageview.CircleImageView profileImageView = navigationView.getHeaderView(0).findViewById(R.id.profile_image); Glide.with(this) .load(R.drawable.profile_image) .into(profileImageView); mSearchView.attachNavigationDrawerToMenuButton(drawer); }
Example 10
Source File: MainActivity.java From Daedalus with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { if (Daedalus.isDarkTheme()) { setTheme(R.style.AppTheme_Dark_NoActionBar_TransparentStatusBar); } super.onCreate(savedInstanceState); instance = this; setContentView(R.layout.activity_main); Toolbar toolbar = findViewById(R.id.toolbar); //setSupportActionBar(toolbar); //causes toolbar issues DrawerLayout drawer = findViewById(R.id.main_drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.addDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); ((TextView) navigationView.getHeaderView(0).findViewById(R.id.textView_nav_version)).setText(getString(R.string.nav_version) + " " + BuildConfig.VERSION_NAME); ((TextView) navigationView.getHeaderView(0).findViewById(R.id.textView_nav_git_commit)).setText(getString(R.string.nav_git_commit) + " " + BuildConfig.GIT_COMMIT); updateUserInterface(getIntent()); }
Example 11
Source File: MainUI.java From Busybox-Installer-No-Root with GNU General Public License v2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_ui); context = getApplicationContext(); MobileAds.initialize(this); mAdView = findViewById(R.id.adView); mAdView.loadAd(new AdRequest.Builder().build()); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); DrawerLayout drawer = findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.addDrawerListener(toggle); toggle.syncState(); navigationView = findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); mAdView.setAdListener(new AdListener() { @Override public void onAdClosed() { mAdView.loadAd(new AdRequest.Builder().build()); } }); if(savedInstanceState == null){ MenuItem selected = navigationView.getMenu().findItem(R.id.method1); selected.setCheckable(true); selected.setChecked(true); newFragment(0); } }
Example 12
Source File: MainActivity.java From VyAPI with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); DrawerLayout drawer = findViewById(R.id.drawer_layout); NavigationView navigationView = findViewById(R.id.nav_view); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.addDrawerListener(toggle); toggle.syncState(); navigationView.setNavigationItemSelectedListener(this); // Set Default Fragment getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new HomeFragment()).commit(); // Get an instance of ContactViewModel contactViewModel = new ViewModelProvider(this).get(ContactViewModel.class); // Reference to Adapter final ContactAdapter adapter = new ContactAdapter(); Toast.makeText(this, "Welcome " + AWSMobileClient.getInstance().getUsername() + "!", Toast.LENGTH_LONG).show(); //Allowing Strict mode policy for Nougat support StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.setVmPolicy(builder.build()); }
Example 13
Source File: MainActivity.java From MaterialTapTargetPrompt with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = findViewById(R.id.fab); fab.setOnClickListener(view -> { if (mFabPrompt != null) { mFabPrompt.finish(); mFabPrompt = null; } Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); }); DrawerLayout drawer = findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.addDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); }
Example 14
Source File: MainActivity.java From Easer with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); localeDelegate.onCreate(this); PreferenceManager.setDefaultValues(this, R.xml.preferences, false); setContentView(R.layout.activity_main); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); DrawerLayout drawer = findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.addDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); if (savedInstanceState == null){ navigationView.setCheckedItem(R.id.nav_outline); Fragment fragment = new OutlineFragment(); getSupportFragmentManager().beginTransaction() .replace(R.id.content_main, fragment, FRAGMENT_OUTLINE) .commit(); } Info.INSTANCE.welcome(this); Version.INSTANCE.dataVersionChange(this); Version.INSTANCE.nearFutureChange(this); }
Example 15
Source File: SampleActivity.java From EasyPhotos with Apache License 2.0 | 5 votes |
private void initView() { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.openDrawer(GravityCompat.START); drawer.clearAnimation(); drawer.setAnimation(null); drawer.setLayoutAnimation(null); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.addDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); navigationView.clearAnimation(); navigationView.setAnimation(null); navigationView.setLayoutAnimation(null); bitmapView = findViewById(R.id.iv_image); bitmapView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { bitmapView.setVisibility(View.GONE); } }); rvImage = (RecyclerView) findViewById(R.id.rv_image); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false); adapter = new MainAdapter(this, selectedPhotoList); rvImage.setLayoutManager(linearLayoutManager); rvImage.setAdapter(adapter); SnapHelper snapHelper = new PagerSnapHelper(); snapHelper.attachToRecyclerView(rvImage); }
Example 16
Source File: NavigationDrawerFragment.java From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 | 4 votes |
private void initDrawerLayout(View rootView, Toolbar toolbar) { DrawerLayout drawerLayout = rootView.findViewById(R.id.drawer_layout); ActionBarDrawerToggle drawerToggle = new ActionBarDrawerToggle(getActivity(), drawerLayout, toolbar, R.string.app_name, R.string.app_name); drawerLayout.addDrawerListener(drawerToggle); drawerToggle.syncState(); }
Example 17
Source File: FeaturesActivity.java From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_features); final Toolbar toolbar = findViewById(R.id.toolbar_actionbar); setSupportActionBar(toolbar); // ensure that Bluetooth exists if (!ensureBLEExists()) finish(); final DrawerLayout drawer = drawerLayout = findViewById(R.id.drawer_layout); drawer.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); // Set the drawer toggle as the DrawerListener drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.drawer_open, R.string.drawer_close) { @Override public void onDrawerSlide(final View drawerView, final float slideOffset) { // Disable the Hamburger icon animation super.onDrawerSlide(drawerView, 0); } }; drawer.addDrawerListener(drawerToggle); // setup plug-ins in the drawer setupPluginsInDrawer(drawer.findViewById(R.id.plugin_container)); // configure the app grid final GridView grid = findViewById(R.id.grid); grid.setAdapter(new AppAdapter(this)); grid.setEmptyView(findViewById(android.R.id.empty)); getSupportActionBar().setDisplayHomeAsUpEnabled(true); final Intent intent = getIntent(); if (intent.hasExtra(EXTRA_APP) && intent.hasExtra(EXTRA_ADDRESS)) { final String app = intent.getStringExtra(EXTRA_APP); switch (app) { case "HRM": final Intent newIntent = new Intent(this, HRActivity.class); newIntent.putExtra(EXTRA_ADDRESS, intent.getByteArrayExtra(EXTRA_ADDRESS)); newIntent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); startActivity(newIntent); break; default: // other are not supported yet break; } } }
Example 18
Source File: MainActivity.java From NekoSMS with GNU General Public License v3.0 | 4 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mCoordinatorLayout = (CoordinatorLayout)findViewById(R.id.main_coordinator); mDrawerLayout = (DrawerLayout)findViewById(R.id.main_drawer); mNavigationView = (NavigationView)findViewById(R.id.main_navigation); mToolbar = (Toolbar)findViewById(R.id.toolbar); mFloatingActionButton = (FloatingActionButton)findViewById(R.id.main_fab); // Load preferences mInternalPrefs = getSharedPreferences(PreferenceConsts.FILE_INTERNAL, MODE_PRIVATE); mInternalPrefs.edit().putInt(PreferenceConsts.KEY_APP_VERSION, VERSION_CODE).apply(); // Setup toolbar setSupportActionBar(mToolbar); getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); // Setup navigation drawer mNavigationView.setNavigationItemSelectedListener(this); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, mToolbar, R.string.open_drawer, R.string.close_drawer); mDrawerToggle.setDrawerIndicatorEnabled(true); mDrawerLayout.addDrawerListener(mDrawerToggle); mDrawerToggle.syncState(); // This is used to cache displayed snackbars, so we can // dismiss them when switching between fragments. mSnackbars = Collections.newSetFromMap(new WeakHashMap<Snackbar, Boolean>()); // Create the notification channel immediately so user can // configure them immediately without needing to receive // a notification first NotificationHelper.createNotificationChannel(this); // Don't do this if the activity is being re-created (e.g. // after a screen rotation), since it will cause the fragment // to be created twice (see http://stackoverflow.com/a/13306633/) if (savedInstanceState == null) { // Process intent. If an action was taken, don't do the rest. if (handleIntent(getIntent())) { return; } // Show info dialogs as necessary if (!XposedUtils.isModuleEnabled()) { if (XposedUtils.isXposedInstalled(this)) { showEnableModuleDialog(); } else { // We should probably show a different dialog if the // user doesn't even have Xposed installed... showEnableModuleDialog(); } } else if (XposedUtils.isModuleUpdated()) { showModuleUpdatedDialog(); } else { showTaskKillerDialogIfNecessary(); } // Set the section that was selected previously String section = mInternalPrefs.getString(PreferenceConsts.KEY_SELECTED_SECTION, EXTRA_SECTION_BLACKLIST_RULES); setContentSection(section); } }
Example 19
Source File: MainActivity.java From InviZible with GNU General Public License v3.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { setDayNightTheme(); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayShowTitleEnabled(false); } DrawerLayout drawer = findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.addDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = findViewById(R.id.nav_view); navigationView.setBackgroundColor(getResources().getColor(R.color.colorBackground)); navigationView.setNavigationItemSelectedListener(this); changeDrawerWithVersionAndDestination(navigationView); viewPager = findViewById(R.id.viewPager); if (viewPager != null) { viewPager.setOffscreenPageLimit(4); ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager(), ViewPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT); MainFragment mainFragment = new MainFragment(); DNSCryptRunFragment dnsCryptRunFragment = new DNSCryptRunFragment(); TorRunFragment torRunFragment = new TorRunFragment(); ITPDRunFragment itpdRunFragment = new ITPDRunFragment(); adapter.addFragment(new ViewPagerAdapter.ViewPagerFragment("Main", mainFragment)); adapter.addFragment(new ViewPagerAdapter.ViewPagerFragment("DNS", dnsCryptRunFragment)); adapter.addFragment(new ViewPagerAdapter.ViewPagerFragment("Tor", torRunFragment)); adapter.addFragment(new ViewPagerAdapter.ViewPagerFragment("I2P", itpdRunFragment)); viewPager.setAdapter(adapter); TabLayout tabLayout = findViewById(R.id.tabs); tabLayout.setupWithViewPager(viewPager); viewPager.setCurrentItem(viewPagerPosition); } modulesStatus = ModulesStatus.getInstance(); startAppExitDetectService(); }
Example 20
Source File: MainActivity.java From proofmode with GNU General Public License v3.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setTitle(""); mPrefs = PreferenceManager.getDefaultSharedPreferences(this); View rootView = findViewById(R.id.root); layoutOn = rootView.findViewById(R.id.layout_on); layoutOff = rootView.findViewById(R.id.layout_off); /* layoutOn.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { setProofModeOn(false); return true; } }); layoutOff.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { setProofModeOn(true); return true; } });*/ if (mPrefs.getBoolean("firsttime",true)) { startActivityForResult(new Intent(this, OnboardingActivity.class), REQUEST_CODE_INTRO); } //Setup drawer drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawerToggle = new ActionBarDrawerToggle( this, drawer, toolbar, 0, 0); drawer.addDrawerListener(drawerToggle); drawerToggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); ImageButton btnSettings = findViewById(R.id.btnSettings); btnSettings.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { openSettings(); } }); updateOnOffState(false); }