Java Code Examples for android.support.v7.app.ActionBarDrawerToggle.setDrawerIndicatorEnabled()

The following are Jave code examples for showing how to use setDrawerIndicatorEnabled() of the android.support.v7.app.ActionBarDrawerToggle class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: lurkerhn   File: MainActivity.java   Source Code and License Vote up 7 votes
private void prepareDrawerToggle() {
    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.drawer_open, R.string.drawer_close) {
        public void onDrawerOpened(View drawerView) {
            super.onDrawerOpened(drawerView);
            getSupportActionBar().setTitle(mActivityTitle);
            invalidateOptionsMenu();
        }

        public void onDrawerClosed(View view) {
            super.onDrawerClosed(view);
            getSupportActionBar().setTitle(mActivityTitle);
            invalidateOptionsMenu();
        }
    };

    mDrawerToggle.setDrawerIndicatorEnabled(true);
    mDrawerLayout.setDrawerListener(mDrawerToggle);
}
 
Example 2
Project: SimpleBible   File: MainActivity.java   Source Code and License Vote up 7 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    NavigationView navigationView = findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);
    navigationView.bringToFront();
    navigationView.requestLayout();

    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.setDrawerIndicatorEnabled(true);
    toggle.syncState();
}
 
Example 3
Project: Android-Demo_ImageCroper   File: MainActivity.java   Source Code and License Vote up 7 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 4
Project: Hotspot-master-devp   File: HotspotMainActivity.java   Source Code and License Vote up 6 votes
@Override
public void setViews() {
    setSupportActionBar(mToolBar);
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    mActionBarDrawerToggle = new ActionBarDrawerToggle(
            this, mDrawerLayout, mToolBar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    mDrawerLayout.addDrawerListener(mActionBarDrawerToggle);
    mActionBarDrawerToggle.setHomeAsUpIndicator(R.drawable.ic_home_menu);
    mActionBarDrawerToggle.setDrawerIndicatorEnabled(false);
    mActionBarDrawerToggle.syncState();
    size.setText(ImageCacheUtils.getCacheSize());
    version_code.setText("V"+mSession.getVersionName());
    //getVersionCode()
    mFragmentList = new ArrayList<>();
    mTitleList = new ArrayList<>();

    initIndicator();
}
 
Example 5
Project: firebase-chat-android-architecture-components   File: InboxActivity.java   Source Code and License Vote up 6 votes
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    binding = DataBindingUtil.setContentView(this, R.layout.main_activity);
    if (savedInstanceState == null) {
        navigationController.navigateToInbox();
    }

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
            this, drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    toggle.setDrawerIndicatorEnabled(true);
    drawer.addDrawerListener(toggle);

    binding.setSignOutCallback(() -> {
        FirebaseAuth.getInstance().signOut();
        startActivity(ProfileActivity.class, true);
        // TODO: signout facebook/google ?
    });
}
 
Example 6
Project: GlossikaSchedule   File: MainActivity.java   Source Code and License Vote up 6 votes
private void setupNavigationDrawer() {
	getSupportActionBar().setDisplayHomeAsUpEnabled(true);
	getSupportActionBar().setHomeButtonEnabled(true);
	drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.drawer_open, R.string.drawer_close) {
		public void onDrawerClosed(View view) {
			super.onDrawerClosed(view);
			invalidateOptionsMenu();
		}

		public void onDrawerOpened(View drawerView) {
			super.onDrawerOpened(drawerView);
			invalidateOptionsMenu();
		}
	};
	drawerToggle.syncState();
	drawerToggle.setDrawerIndicatorEnabled(true);
	drawerLayout.setDrawerListener(drawerToggle);
	RecyclerView recyclerView = (RecyclerView) findViewById(R.id.navigationRecyclerView);
	navigationAdapter = new NavigationAdapter(this, schedules, schedules.indexOf(loadedSchedule));
	recyclerView.setAdapter(navigationAdapter);
	RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this);
	recyclerView.setLayoutManager(layoutManager);
}
 
Example 7
Project: lockit   File: HomeActivity.java   Source Code and License Vote up 5 votes
@AfterViews
void setupNavigationView() {
    mDrawerToggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.app_name, R.string.app_name);
    mDrawerToggle.setDrawerIndicatorEnabled(true);
    drawer.setDrawerListener(mDrawerToggle);
    navigation.setNavigationItemSelectedListener(this::navigationItemSelected);
    navigation.getMenu().getItem(0).setChecked(true);
}
 
Example 8
Project: trvlr-android   File: BaseDrawerActivity.java   Source Code and License Vote up 5 votes
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    super.setContentView(R.layout.activity_base_drawer);

    appController = (AppController) this.getApplicationContext();

    mFrameLayout = (FrameLayout) findViewById(R.id.content_frame);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerToggle = new ActionBarDrawerToggle(
            this,
            mDrawerLayout,
            R.string.navigation_drawer_open,
            R.string.navigation_drawer_close
    );
    mDrawerToggle.setDrawerIndicatorEnabled(true);
    mDrawerLayout.addDrawerListener(mDrawerToggle);
    mDrawerToggle.syncState();

    mNavigationView = (NavigationView) findViewById(R.id.nav_view);
    mNavigationView.setNavigationItemSelectedListener(this);
    menu = mNavigationView.getMenu();
    rebuildMenu();
    loadTravelerId();
}
 
Example 9
Project: Divertio   File: BaseListActivity.java   Source Code and License Vote up 5 votes
protected void initMenu() {

        // Create the menu drawer
        menuDrawerLayout = (RelativeLayout) findViewById(R.id.menu_drawer_layout);
        menuDrawer = (DrawerLayout) findViewById(R.id.menu_drawer);
        menuList = (ListView) findViewById(R.id.menu_drawer_list);
        menuTitleArr = new String[]{"Library", "Playlists", "Albums", "Artists", "Genres", "Now Playing"};
        menuIconArr = new int[]{R.drawable.ic_library, R.drawable.ic_menu_playlist, R.drawable.ic_album, R.drawable.ic_artist, R.drawable.ic_genre, R.drawable.ic_menu_play};
        menuList.setAdapter(new MenuDrawerAdapter(this, menuTitleArr, menuIconArr));
        menuDrawer.closeDrawers();
        drawerOpen = false;

        // Add hamburger icon to menu drawer
        ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, menuDrawer, mainBar, R.string.dialog_confirm, R.string.dialog_cancel);
        menuDrawer.setDrawerListener(toggle);
        toggle.setDrawerIndicatorEnabled(true);
        toggle.syncState();
        mainBar.setTitleTextColor(Color.WHITE);
        mainBar.showOverflowMenu();

        // Set listener
        menuList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                selectMenuItem(i);
            }
        });
    }
 
Example 10
Project: BloomReader   File: ShelfActivity.java   Source Code and License Vote up 5 votes
@Override
protected void configureActionBar(ActionBarDrawerToggle toggle) {
    toggle.setDrawerIndicatorEnabled(false);
    toggle.setToolbarNavigationClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            finish();
        }
    });
}
 
Example 11
Project: MaterialDesignColors   File: MainActivity.java   Source Code and License Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerToggle = new ActionBarDrawerToggle(
            this, drawerLayout, R.string.navigation_drawer_open, R.string.navigation_drawer_close
    );

    mDrawerToggle.setDrawerIndicatorEnabled(true);
    drawerLayout.addDrawerListener(mDrawerToggle);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);

    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);

    FragmentTransaction transaction = getFragmentManager().beginTransaction();
    transaction.replace(R.id.fragment_container, new ColorPaletteFragment());
    transaction.commit();


}