Java Code Examples for android.support.v7.app.ActionBarDrawerToggle#syncState()
The following examples show how to use
android.support.v7.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: BaseActivity.java From 10000sentences with Apache License 2.0 | 6 votes |
private void initNavigation() { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 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.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); setupMenuIcon(navigationView, R.id.nav_collections, FontAwesomeIcons.fa_list); setupMenuIcon(navigationView, R.id.nav_reload, FontAwesomeIcons.fa_refresh); setupMenuIcon(navigationView, R.id.nav_annotations, FontAwesomeIcons.fa_language); setupMenuIcon(navigationView, R.id.nav_stats, FontAwesomeIcons.fa_line_chart); setupMenuIcon(navigationView, R.id.nav_settings, FontAwesomeIcons.fa_toggle_on); setupMenuIcon(navigationView, R.id.nav_tts_settings, FontAwesomeIcons.fa_file_sound_o); setupMenuIcon(navigationView, R.id.nav_about, FontAwesomeIcons.fa_info); setupMenuIcon(navigationView, R.id.nav_help, FontAwesomeIcons.fa_question); setupCollectionsNavigation(navigationView); }
Example 2
Source File: HomescreenNew.java From Hillffair17 with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); initCollapsingToolbar(); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawer, toolbar, 0, 0); actionBarDrawerToggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); pref = new SharedPref(this); if(new Connection(this).isInternet()){ profileBasicInfo(pref.getUserId()); } }
Example 3
Source File: MainActivity.java From SimpleNews with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mToolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(mToolbar); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, mToolbar, R.string.drawer_open, R.string.drawer_close); mDrawerToggle.syncState(); mDrawerLayout.setDrawerListener(mDrawerToggle); mNavigationView = (NavigationView) findViewById(R.id.navigation_view); setupDrawerContent(mNavigationView); mMainPresenter = new MainPresenterImpl(this); switch2News(); }
Example 4
Source File: MainActivity.java From ShapedNavigationView with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); 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(); } }); 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.setDrawerListener(toggle); toggle.syncState(); navigationView = (ShapedNavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); }
Example 5
Source File: MainActivity.java From Modularity with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = getToolbar(); 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); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); getSupportFragmentManager() .beginTransaction() .replace(R.id.content_main, FragmentRouter.getFragment(RouterList.MEMORY_FRAG_MAIN)) .commit(); }
Example 6
Source File: HomeActivity.java From MangoBloggerAndroidApp with Mozilla Public License 2.0 | 5 votes |
private void setUpDrawer() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, mToolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); mToolbar.getNavigationIcon().setColorFilter(Color.BLACK, PorterDuff.Mode.MULTIPLY); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); mNavigationImageButton = getNavButtonView(mToolbar); }
Example 7
Source File: SelectionToolbar.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * Set up ActionBarDrawerToggle, a.k.a. hamburger button. */ private void initActionBarDrawerToggle() { // Sadly, the only way to set correct toolbar button listener for ActionBarDrawerToggle // is constructing, so we will need to construct every time we re-show this button. mActionBarDrawerToggle = new ActionBarDrawerToggle((Activity) getContext(), mDrawerLayout, this, R.string.accessibility_drawer_toggle_btn_open, R.string.accessibility_drawer_toggle_btn_close); mDrawerLayout.addDrawerListener(mActionBarDrawerToggle); mActionBarDrawerToggle.syncState(); }
Example 8
Source File: MainActivity.java From ZhihuDaily with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout); setSupportActionBar(toolbar); initFragment(); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, mDrawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); mDrawer.addDrawerListener(toggle); toggle.syncState(); }
Example 9
Source File: MainActivity.java From Muslim-Athkar-Islamic-Reminders 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); initializeAll(); playSound();//this method will play opening sound this.startService(mServiceIntent);//start IntentService for fetch data from online server final 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(); if (savedData.getIsAppFirstTimeOpen()){ fragment = new Settings(); changeSelectedNavBg(findViewById(R.id.navSettingRl)); } transaction.add(R.id.containerMain,fragment); transaction.commit(); }
Example 10
Source File: MainActivity.java From design-support-demo with Apache License 2.0 | 5 votes |
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); // load saved navigation state if present if (null == savedInstanceState) { mNavItemId = R.id.drawer_item_1; } else { mNavItemId = savedInstanceState.getInt(NAV_ITEM_ID); } // listen for navigation events NavigationView navigationView = (NavigationView) findViewById(R.id.navigation); navigationView.setNavigationItemSelectedListener(this); // select the correct nav menu item navigationView.getMenu().findItem(mNavItemId).setChecked(true); // set up the hamburger icon to open and close the drawer mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, toolbar, R.string.open, R.string.close); mDrawerLayout.setDrawerListener(mDrawerToggle); mDrawerToggle.syncState(); navigate(mNavItemId); }
Example 11
Source File: DrawerActivity.java From droidconat-2016 with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.drawer); setSupportActionBar(toolbar); actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.drawer_open, R.string.drawer_close); drawer.addDrawerListener(actionBarDrawerToggle); actionBarDrawerToggle.syncState(); navigationView.setNavigationItemSelectedListener(item -> { presenter.onNavigationItemSelected(item.getItemId()); return true; }); }
Example 12
Source File: MainActivity.java From AndResGuard with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Fabric.with(this, new Crashlytics(), new CrashlyticsNdk()); setContentView(R.layout.activity_main); 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(); } }); 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.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); }
Example 13
Source File: MainActivity.java From android-showcase-template with Apache License 2.0 | 5 votes |
/** * Keep track of the login task to ensure we can cancel it if requested. * * @param savedInstanceState - the saved instance state */ @Override protected void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); toolbar.setTitle(R.string.fragment_title_home); setSupportActionBar(toolbar); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); navigationView.setCheckedItem(R.id.nav_home); navigationView.setNavigationItemSelectedListener(this); restyleNavigationview(); // initialise the httphelper HttpHelper.init(); if (pushServiceProvider != null) { pushServiceProvider.registerDevice(); } testNetwork(); // load the main menu fragment if(getIntent().getStringExtra(UnifiedPushMessage.class.getName()) == null) { navigator.navigateToHomeView(this, getString(R.string.fragment_title_home)); } else { navigator.navigateToPushView(this, getString(R.string.nav_push_messages)); } }
Example 14
Source File: ActivityHome.java From Saiy-PS with GNU Affero General Public License v3.0 | 5 votes |
/** * Self explanatory utility */ private void setupDrawer() { if (DEBUG) { MyLog.i(CLS_NAME, "setupDrawer"); } 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(); }
Example 15
Source File: MainActivity.java From EvilsLive with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); setSupportActionBar(mToolbar); mPermissionsChecker = new PermissionsChecker(this); streamer = new EvilsLiveStreamer(this); // ViewGroup.LayoutParams layoutParams = mPreviewView.getLayoutParams(); // layoutParams.width = 640; // layoutParams.height = 480; // mPreviewView.setLayoutParams(layoutParams); SurfaceHolder holder = mPreviewView.getHolder(); holder.addCallback(this); audioCapture = new AudioCapture(); audioPlay = new AudioPlayer(); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, mToolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); ActivityComponent activityComponent = DaggerActivityComponent.builder() .activityModule(new ActivityModule(this)).build(); activityComponent.getActivity(); // CameraComponent cameraComponent = DaggerCameraComponent.builder().activityComponent(activityComponent). // cameraModule(new com.thinkkeep.videolib.di.modules.CameraModule(this)).build(); // cameraComponent.inject(this); }
Example 16
Source File: MainActivity.java From MaterialWpp with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); UmengUpdateAgent.update(this); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setTitle("专辑"); retrofit = new Retrofit.Builder() .baseUrl("http://client.pic.hiapk.com/index.php/") .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .addConverterFactory(GsonConverterFactory.create()) .build(); datas = new ArrayList<>(); mainAdapter = new MainAdapter(datas); staggeredGridLayoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL); mRecycler.setLayoutManager(staggeredGridLayoutManager); mRecycler.setAdapter(mainAdapter); mRecycler.setupMoreListener(this, 1); fetchAlbum = retrofit.create(FetchAlbum.class); if(NetWorkUtils.testNet(this)){ fetchAlbum.getAlbum(start, end) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Action1<Album>() { @Override public void call(Album album) { pagecount = Integer.valueOf(album.getTotalCount()) / end; datas.addAll(album.getData()); mainAdapter.notifyDataSetChanged(); } }, new Action1<Throwable>() { @Override public void call(Throwable throwable) { makeSnake("抱歉,出错了:"+throwable.toString()); } }); } fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { staggeredGridLayoutManager.scrollToPositionWithOffset(0, 2); } }); 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.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); }
Example 17
Source File: PlayActivity.java From firebase-android-client with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { ListView messageHistory; super.onCreate(savedInstanceState); setContentView(R.layout.activity_play); 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); channelMenu = navigationView.getMenu(); navigationView.setNavigationItemSelectedListener(this); initChannels(); GoogleSignInOptions.Builder gsoBuilder = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestIdToken(getString(R.string.default_web_client_id)) .requestEmail(); GoogleSignInOptions gso = gsoBuilder.build(); mGoogleApiClient = new GoogleApiClient.Builder(this) .enableAutoManage(this, this) .addApi(Auth.GOOGLE_SIGN_IN_API, gso) .build(); SignInButton signInButton = findViewById(R.id.sign_in_button); signInButton.setSize(SignInButton.SIZE_STANDARD); signInButton.setOnClickListener(this); channelLabel = findViewById(R.id.channelLabel); Button signOutButton = findViewById(R.id.sign_out_button); signOutButton.setOnClickListener(this); ImageButton microphoneButton = findViewById(R.id.microphone_button); microphoneButton.setOnClickListener(this); messages = new ArrayList<>(); messageAdapter = new SimpleAdapter(this, messages, android.R.layout.simple_list_item_2, new String[]{"message", "meta"}, new int[]{android.R.id.text1, android.R.id.text2}); messageHistory = findViewById(R.id.messageHistory); messageHistory.setOnItemClickListener(this); messageHistory.setAdapter(messageAdapter); messageText = findViewById(R.id.messageText); messageText.setOnKeyListener(this); fmt = new SimpleDateFormat("yy.MM.dd HH:mm z", Locale.US); status = findViewById(R.id.status); }
Example 18
Source File: MainActivity.java From MaterialQQLite with Apache License 2.0 | 4 votes |
@Override public void setUpViews() { ViewCompat.setElevation(mToolbar, getResources().getDimension(R.dimen.toolbar_elevation)); sp = getSharedPreferences("theme", MODE_PRIVATE); color_theme = sp.getInt("color", -12627531); ThemeSingleton.get().positiveColor = color_theme; ThemeSingleton.get().neutralColor = color_theme; ThemeSingleton.get().negativeColor = color_theme; ExitApplication.getInstance().addActivity(this); initView(); res = this.getResources(); mToolbar.inflateMenu(R.menu.menu_main); setSupportActionBar(mToolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer); // 實作 drawer toggle 並放入 toolbar drawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, mToolbar, R.string.drawer_open, R.string.drawer_close); drawerToggle.syncState(); mDrawerLayout.setDrawerListener(drawerToggle); mToolbar.setOnMenuItemClickListener(onMenuItemClick); tabHost = (MaterialTabHost) this.findViewById(R.id.tabHost); pager = (ViewPager) this.findViewById(R.id.pager); // init view pager pagerAdapter = new ViewPagerAdapter(getSupportFragmentManager()); pager.setAdapter(pagerAdapter); pager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { // when user do a swipe the selected tab change tabHost.setSelectedNavigationItem(position); } }); // insert all tabs from pagerAdapter data for (int i = 0; i < pagerAdapter.getCount(); i++) { tabHost.addTab( tabHost.newTab() .setIcon(getIcon(i)) .setTabListener(this) ); } tabHost.setPrimaryColor(color_theme); // getSupportActionBar().setBackgroundDrawable(new ColorDrawable(color_theme)); }
Example 19
Source File: ActivityBase.java From ghwatch with Apache License 2.0 | 4 votes |
/** * Init navigation drawer for activity. Layout xml file must be appropriate! * * @param selectedItem in drawer main menu which represents this activity, see <code>NAV_DRAWER_ITEM_xx</code> constants. */ protected void initNavigationDrawer(final int selectedItem) { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); // initialization of navigation drawer mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); if (mDrawerLayout != null) { mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.drawer_open, R.string.drawer_close) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { super.onDrawerClosed(view); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } }; // Set the drawer toggle as the DrawerListener mDrawerLayout.addDrawerListener(mDrawerToggle); mDrawerToggle.syncState(); mDrawerNavigationView = (NavigationView) findViewById(R.id.navigation_drawer_view); mDrawerNavigationView.setNavigationItemSelectedListener( new NavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(MenuItem item) { onDrawerMenuItemSelected(item); navigationDrawerClose(); return true; } }); if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES) { ColorStateList ndcl = ColorStateList.valueOf(getResources().getColor(R.color.light_grey)); mDrawerNavigationView.setItemTextColor(ndcl); mDrawerNavigationView.setItemIconTintList(ndcl); } navDrawerMenuSelectedItem = selectedItem; if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); } navigationDrawerShowUserInfo(); } }
Example 20
Source File: Fido2DemoActivity.java From android-fido with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_navigation); // START Google sign in API client // configure sign-in to request user info GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestEmail() .requestIdToken(Constants.SERVER_CLIENT_ID) .build(); // build client with access to Google Sign-In API and the options specified by gso googleApiClient = new GoogleApiClient.Builder(this) .enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */) .addApi(Auth.GOOGLE_SIGN_IN_API, gso) .build(); // END Google sign in API client // START prepare main layout Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); progressBar = findViewById(R.id.progressBar); swipeRefreshLayout = findViewById(R.id.swipe_container); swipeRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.colorAccent)); swipeRefreshLayout.setRefreshing(true); swipeRefreshLayout.setOnRefreshListener( new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { updateAndDisplayRegisteredKeys(); } }); recyclerView = findViewById(R.id.list); recyclerView.setLayoutManager(new LinearLayoutManager(this)); adapter = new SecurityTokenAdapter( new ArrayList<Map<String, String>>(), R.layout.row_token, Fido2DemoActivity.this); // END prepare main layout // START prepare drawer layout 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.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); navigationView.setItemIconTintList(null); View header = navigationView.getHeaderView(0); userEmailTextView = header.findViewById(R.id.userEmail); displayNameTextView = header.findViewById(R.id.displayName); Menu menu = navigationView.getMenu(); operationMenuItem = menu.findItem(R.id.nav_fido2Operations); signInMenuItem = menu.findItem(R.id.nav_signin); signOutMenuItem = menu.findItem(R.id.nav_signout); signInButton = findViewById(R.id.sign_in_button); signInButton.setSize(SignInButton.SIZE_WIDE); signInButton.setScopes(gso.getScopeArray()); signInButton.setOnClickListener(this); // END prepare drawer layout // request SignIn or load registered tokens updateUI(); }