Java Code Examples for androidx.appcompat.app.ActionBarDrawerToggle#setDrawerIndicatorEnabled()
The following examples show how to use
androidx.appcompat.app.ActionBarDrawerToggle#setDrawerIndicatorEnabled() .
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: MainActivity.java From Android-Image-Cropper with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBarDrawerToggle( this, mDrawerLayout, R.string.main_drawer_open, R.string.main_drawer_close); mDrawerToggle.setDrawerIndicatorEnabled(true); mDrawerLayout.setDrawerListener(mDrawerToggle); if (savedInstanceState == null) { setMainFragmentByPreset(CropDemoPreset.RECT); } }
Example 2
Source File: MainActivity.java From arcgis-runtime-samples-android with Apache License 2.0 | 6 votes |
private void setupDrawer() { mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.drawer_open, R.string.drawer_close) { /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { super.onDrawerClosed(view); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } }; mDrawerToggle.setDrawerIndicatorEnabled(true); mDrawerLayout.addDrawerListener(mDrawerToggle); }
Example 3
Source File: MainActivity.java From arcgis-runtime-samples-android with Apache License 2.0 | 6 votes |
/** * Set up the navigation drawer */ private void setupDrawer() { mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.drawer_open, R.string.drawer_close) { /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); getSupportActionBar().setTitle(mActivityTitle); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { super.onDrawerClosed(view); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } }; mDrawerToggle.setDrawerIndicatorEnabled(true); mDrawerLayout.addDrawerListener(mDrawerToggle); }
Example 4
Source File: MainActivity.java From arcgis-runtime-samples-android with Apache License 2.0 | 6 votes |
private void setupDrawer() { mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.drawer_open, R.string.drawer_close) { // called when drawer has settled in an open state public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); // change the title to the nav bar getSupportActionBar().setTitle(getResources().getString(R.string.navbar_title)); // invalidate options menu invalidateOptionsMenu(); } // called when drawer has settled in a closed state public void onDrawerClosed(View view) { super.onDrawerClosed(view); // set title to the app getSupportActionBar().setTitle(mActivityTitle); // invalidate options menu invalidateOptionsMenu(); } }; // enable draw indicator mDrawerToggle.setDrawerIndicatorEnabled(true); // attach toggle to drawer layout mDrawerLayout.setDrawerListener(mDrawerToggle); }
Example 5
Source File: MainActivity.java From arcgis-runtime-samples-android with Apache License 2.0 | 6 votes |
/** * set up the drawer */ private void setupDrawer() { mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.drawer_open, R.string.drawer_close) { /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { super.onDrawerClosed(view); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } }; mDrawerToggle.setDrawerIndicatorEnabled(true); mDrawerLayout.addDrawerListener(mDrawerToggle); mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); }
Example 6
Source File: MainPage.java From Paginize with MIT License | 5 votes |
private void setupDrawerToggle() { ActionBarDrawerToggle mDrawerToggle = new ActionBarDrawerToggle( getContext(), mDrawerLayout, mTbHeaderBar, R.string.app_name, R.string.app_name ); mDrawerToggle.setDrawerIndicatorEnabled(true); mDrawerLayout.addDrawerListener(mDrawerToggle); mDrawerToggle.syncState(); }
Example 7
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 8
Source File: MainActivity.java From arcgis-runtime-samples-android with Apache License 2.0 | 4 votes |
/** * Creates a drawer to handle display of layers on the map. * * @param tiledLayer to display on the map * @param mapImageLayer to display on the map */ private void createDrawer(ArcGISTiledLayer tiledLayer, ArcGISMapImageLayer mapImageLayer) { ArcGISMap map = mMapView.getMap(); // set actions for drawer state - close/open mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.app_name, R.string.app_name) { // if the drawer is closed, get the checked items from LayerListView and add the checked layer @Override public void onDrawerClosed(View view) { getSupportActionBar().setTitle(getTitle()); map.addDoneLoadingListener(() -> { if (map.getLoadStatus() == LoadStatus.LOADED) { // if both items are checked, add them if (mLayerListView.getCheckedItemCount() > 1) { map.getOperationalLayers().clear(); map.getOperationalLayers().add(tiledLayer); map.getOperationalLayers().add(mapImageLayer); } else { // if any one item is checked, add as layer if (mLayerListView.isItemChecked(0)) { map.getOperationalLayers().clear(); map.getOperationalLayers().add(tiledLayer); } else if (mLayerListView.isItemChecked(1)) { map.getOperationalLayers().clear(); map.getOperationalLayers().add(mapImageLayer); } else { map.getOperationalLayers().clear(); } } } }); invalidateOptionsMenu(); } @Override public void onDrawerOpened(View drawerView) { getSupportActionBar().setTitle(mDrawerTitle); // calling onPrepareOptionsMenu() to hide action bar icons invalidateOptionsMenu(); } }; // handle clicks in the drawer mBasemapListView.setOnItemClickListener((parent, view, position, id) -> { mMapView.getMap().getOperationalLayers().clear(); switch (position) { case 0: mMapView.getMap().setBasemap(Basemap.createStreets()); break; case 1: mMapView.getMap().setBasemap(Basemap.createImagery()); break; case 2: mMapView.getMap().setBasemap(Basemap.createTopographic()); break; case 3: mMapView.getMap().setBasemap(Basemap.createOceans()); break; default: Toast.makeText(this, R.string.unsupported_option, Toast.LENGTH_SHORT).show(); } }); mDrawerToggle.setDrawerIndicatorEnabled(true); mDrawerLayout.addDrawerListener(mDrawerToggle); }
Example 9
Source File: MainActivity.java From arcgis-runtime-samples-android with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // get a reference to the map view mMapView = findViewById(R.id.mapView); // get a reference to the search instructions text view mSearchInstructionsTextView = findViewById(R.id.searchInstructionsTextView); // load a portal using arcgis.com mPortal = new Portal(getString(R.string.arcgis_url)); mPortal.loadAsync(); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); // get a reference to the drawer mDrawer = findViewById(R.id.drawer); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawer, R.string.app_name, R.string.app_name); mDrawerToggle.setDrawerIndicatorEnabled(true); mDrawer.addDrawerListener(mDrawerToggle); // setup recycler view mRecyclerView = findViewById(R.id.webmapRecyclerView); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); mRecyclerView.setLayoutManager(linearLayoutManager); DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mRecyclerView.getContext(), linearLayoutManager.getOrientation()); mRecyclerView.addItemDecoration(dividerItemDecoration); // on reaching the bottom mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); if (!recyclerView.canScrollVertically(1)) { // only get more results if some results have already been returned and no more results are currently being // returned if (mPortalQueryResultSet != null && mMoreResults.isDone()) { getMoreResults(); } } } }); }