Java Code Examples for androidx.appcompat.app.ActionBarDrawerToggle#syncState()
The following examples show how to use
androidx.appcompat.app.ActionBarDrawerToggle#syncState() .
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: OverScrollDemoActivity.java From overscroll-decor with BSD 2-Clause "Simplified" License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_overscroll_demo); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitle(R.string.recycler_view_demo_title); setSupportActionBar(toolbar); DrawerLayout drawer = (DrawerLayout) 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.drawer_nav); navigationView.setNavigationItemSelectedListener(this); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.fragment_placeholder, new RecyclerViewDemoFragment()) .commit(); } }
Example 2
Source File: MainActivity.java From android-biometricprompt 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); FloatingActionButton fab = findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @SuppressLint("WrongConstant") @Override public void onClick(View view) { 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 3
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 4
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 5
Source File: DrawerActivity.java From smart-farmer-android with Apache License 2.0 | 5 votes |
/** * 如果需要关联toolbar左侧button */ protected void setToggleButton(Toolbar toolbar) { ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, mDrawerLayout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); toggle.getDrawerArrowDrawable().setColor(Color.WHITE); mDrawerLayout.addDrawerListener(toggle); toggle.syncState(); }
Example 6
Source File: AdvanceDrawer6Activity.java From Drawer-Behavior with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_advance6); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); drawer = (AdvanceDrawerLayout) findViewById(R.id.drawer_layout); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { ViewCompat.setLayoutDirection(drawer, View.LAYOUT_DIRECTION_RTL); } 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); drawer.setViewScale(GravityCompat.START, 0.9f); drawer.setRadius(GravityCompat.START, 35); drawer.setViewElevation(GravityCompat.START, 20); }
Example 7
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 8
Source File: Advance3DDrawer1Activity.java From Drawer-Behavior with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_advance_3d_1); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); drawer = (Advance3DDrawerLayout) 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); drawer.setViewScale(GravityCompat.START, 0.96f); drawer.setRadius(GravityCompat.START, 20); drawer.setViewElevation(GravityCompat.START, 8); drawer.setViewRotation(GravityCompat.START, 15); }
Example 9
Source File: MessagesActivity.java From android with MIT License | 5 votes |
private void initDrawer() { setSupportActionBar(toolbar); navigationView.setItemIconTintList(null); 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); View headerView = navigationView.getHeaderView(0); TextView user = headerView.findViewById(R.id.header_user); user.setText(settings.user().getName()); TextView connection = headerView.findViewById(R.id.header_connection); connection.setText( getString(R.string.connection, settings.user().getName(), settings.url())); TextView version = headerView.findViewById(R.id.header_version); version.setText( getString(R.string.versions, BuildConfig.VERSION_NAME, settings.serverVersion())); ImageButton refreshAll = headerView.findViewById(R.id.refresh_all); refreshAll.setOnClickListener(this::onRefreshAll); }
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: DriverHome.java From UberClone with MIT License | 5 votes |
public void initDrawer(){ DrawerLayout drawer = (DrawerLayout) 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); View navigationHeaderView=navigationView.getHeaderView(0); TextView tvName=(TextView)navigationHeaderView.findViewById(R.id.tvDriverName); TextView tvStars=(TextView)navigationHeaderView.findViewById(R.id.tvStars); CircleImageView imageAvatar=(CircleImageView) navigationHeaderView.findViewById(R.id.imageAvatar); tvName.setText(Common.currentUser.getName()); if(Common.currentUser.getRates()!=null && !TextUtils.isEmpty(Common.currentUser.getRates())) tvStars.setText(Common.currentUser.getRates()); if(isLoggedInFacebook) Picasso.get().load("https://graph.facebook.com/" + Common.userID + "/picture?width=500&height=500").into(imageAvatar); else if(account!=null) Picasso.get().load(account.getPhotoUrl()).into(imageAvatar); if(Common.currentUser.getAvatarUrl()!=null && !TextUtils.isEmpty(Common.currentUser.getAvatarUrl())) Picasso.get().load(Common.currentUser.getAvatarUrl()).into(imageAvatar); }
Example 12
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 13
Source File: MainActivity.java From TemplateAppProject with Apache License 2.0 | 5 votes |
protected void initListeners() { ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawerLayout.addDrawerListener(toggle); toggle.syncState(); //侧边栏点击事件 navView.setNavigationItemSelectedListener(menuItem -> { if (menuItem.isCheckable()) { drawerLayout.closeDrawers(); return handleNavigationItemSelected(menuItem); } else { switch (menuItem.getItemId()) { case R.id.nav_settings: openNewPage(SettingsFragment.class); break; case R.id.nav_about: openNewPage(AboutFragment.class); break; default: XToastUtils.toast("点击了:" + menuItem.getTitle()); break; } } return true; }); //主页事件监听 viewPager.addOnPageChangeListener(this); bottomNavigation.setOnNavigationItemSelectedListener(this); }
Example 14
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 15
Source File: MainActivity.java From FlexibleAdapter with Apache License 2.0 | 5 votes |
private void initializeDrawer() { mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, mDrawer, mToolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); mDrawer.addDrawerListener(toggle); toggle.syncState(); mNavigationView = (NavigationView) findViewById(R.id.nav_view); mNavigationView.setNavigationItemSelectedListener(this); // Version TextView appVersion = mNavigationView.getHeaderView(0).findViewById(R.id.app_version); appVersion.setText(getString(R.string.about_version, Utils.getVersionName(this))); }
Example 16
Source File: AdvanceDrawer1Activity.java From Drawer-Behavior with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_advance1); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); drawer = (AdvanceDrawerLayout) 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); drawer.useCustomBehavior(Gravity.START); drawer.useCustomBehavior(Gravity.END); }
Example 17
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 18
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 19
Source File: NavigationActivity.java From MTweaks-KernelAdiutorMOD with GNU General Public License v3.0 | 4 votes |
private void init(Bundle savedInstanceState) { setContentView(R.layout.activity_navigation); Toolbar toolbar = getToolBar(); setSupportActionBar(toolbar); mDrawer = findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, mDrawer, toolbar, 0, 0); mDrawer.addDrawerListener(toggle); toggle.syncState(); mNavigationView = findViewById(R.id.nav_view); mNavigationView.setNavigationItemSelectedListener(this); mNavigationView.setOnFocusChangeListener((v, hasFocus) -> { if (hasFocus) { v.clearFocus(); } }); if (savedInstanceState != null) { mSelection = savedInstanceState.getInt(INTENT_SECTION); } appendFragments(false); String section = getIntent().getStringExtra(INTENT_SECTION); if (section != null) { for (Map.Entry<Integer, Class<? extends Fragment>> entry : mActualFragments.entrySet()) { Class<? extends Fragment> fragmentClass = entry.getValue(); if (fragmentClass != null && fragmentClass.getCanonicalName().equals(section)) { mSelection = entry.getKey(); break; } } getIntent().removeExtra(INTENT_SECTION); } if (mSelection == 0 || mActualFragments.get(mSelection) == null) { mSelection = firstTab(); } onItemSelected(mSelection, false); if (AppSettings.isDataSharing(this)) { startService(new Intent(this, Monitor.class)); } }
Example 20
Source File: CamerasActivity.java From evercam-android with GNU Affero General Public License v3.0 | 4 votes |
private void initNavigationDrawer() { mNavSettingsItemLayout = (FrameLayout) findViewById(R.id.navigation_drawer_items_settings_layout); mNavFeedbackItemLayout = (FrameLayout) findViewById(R.id.navigation_drawer_items_feedback_layout); // mNavScanLayout = (FrameLayout) findViewById(R.id.navigation_drawer_items_scan_layout); // mNavExploreLayout = (FrameLayout) findViewById(R.id.navigation_drawer_items_explore_layout); mNavTitleLayout = (FrameLayout) findViewById(R.id.navigation_drawer_title_layout); mNavBodyScrollView = (ScrollView) findViewById(R.id.drawer_body_scroll_view); mNavBodyAccountView = (FrameLayout) findViewById(R.id.drawer_body_account_view); mNavAddAccountLayout = (FrameLayout) findViewById(R.id.drawer_account_items_add_layout); mNavManageAccountLayout = (FrameLayout) findViewById(R.id.drawer_account_items_manage_layout); mUserNameTextView = (TextView) findViewById(R.id.navigation_drawer_title_user_name); mUserEmailTextView = (TextView) findViewById(R.id.navigation_drawer_title_user_email); mTriangleImageView = (ImageView) findViewById(R.id.image_view_triangle); mCircleImageView = (CircleImageView) findViewById(R.id.navigation_drawer_account_profile_image); mAccountListView = (ListView) findViewById(R.id.list_view_account_email); /*FrameLayout offlineLayout = (FrameLayout) findViewById(R.id.navigation_drawer_items_offline_layout); final CheckBox offlineSwitch = (CheckBox) findViewById(R.id.checkbox_offline); offlineSwitch.setChecked(PrefsManager.showOfflineCameras(this)); offlineSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { PrefsManager.setShowOfflineCamera(getApplicationContext(), isChecked); removeAllCameraViews(); addAllCameraViews(false, true); } }); offlineLayout.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { offlineSwitch.setChecked(!offlineSwitch.isChecked()); } });*/ mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBarDrawerToggle( this, mDrawerLayout, mToolbar, R.string.navigation_drawer_opened, R.string.navigation_drawer_closed ) { @Override public void onDrawerSlide(View drawerView, float slideOffset) { // Disables the burger/arrow animation by default super.onDrawerSlide(drawerView, 0); // Update user account info when it's completely open if (slideOffset > 0 && !mIsDrawerUpdated) { // Always hide the account menu by default showAccountView(false); //And update account info updateNavDrawerUserInfo(); mIsDrawerUpdated = true; } if (slideOffset == 0) { mIsDrawerUpdated = false; } } }; mDrawerLayout.setDrawerListener(mDrawerToggle); mDrawerToggle.syncState(); // Nav Drawer item click listener mNavSettingsItemLayout.setOnClickListener(this); mNavFeedbackItemLayout.setOnClickListener(this); // mNavScanLayout.setOnClickListener(this); // mNavExploreLayout.setOnClickListener(this); mNavAddAccountLayout.setOnClickListener(this); mNavManageAccountLayout.setOnClickListener(this); mNavTitleLayout.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mTriangleImageView.getRotation() == 0) { showAccountView(true); } else if (mTriangleImageView.getRotation() == 180) { showAccountView(false); } } }); updateUserListInNavDrawer(); bindAccountList(mUserListInNavDrawer); }