app/src/main/java/com/mensa/zhmensa/activities/MainActivity.java
/**
     * Sets up sidebar navigation. Adds items and listener to it
     */
Sets up sidebar navigation. Adds items and listener to it
Sets up sidebar navigation . Adds items and listener to it
private void populateExpandableList() {
        expandableListAdapter = new NavigationExpandableListAdapter(this);
        expandableListView.setAdapter(expandableListAdapter);
        expandableListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
            @Override
            public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
                if (expandableListAdapter.getGroup(groupPosition).isStandaloneItem()) {
                    DrawerLayout drawer = findViewById(R.id.drawer_layout);
                    drawer.closeDrawer(GravityCompat.START);
                    selectMensa(MensaManager.getFavoritesMensa());
                }
                return false;
            }
        });
        expandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
            @Override
            public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
                NavigationMenuChild model = expandableListAdapter.getChild(groupPosition, childPosition);
                if (model != null) {
                    selectMensa(model.mensa);
                    DrawerLayout drawer = findViewById(R.id.drawer_layout);
                    drawer.closeDrawer(GravityCompat.START);
                } else {
                    Log.e("MainAct.onchildclick", "Model for position group: " + groupPosition + " child " + childPosition + " was empty");
                }
                return false;
            }
        });
    }
private void populateExpandableList ( ) { expandableListAdapter = new NavigationExpandableListAdapter ( this ) ; expandableListView . setAdapter ( expandableListAdapter ) ; expandableListView . setOnGroupClickListener ( new ExpandableListView . OnGroupClickListener ( ) { @ Override public boolean onGroupClick ( ExpandableListView parent , View v , int groupPosition , long id ) { if ( expandableListAdapter . getGroup ( groupPosition ) . isStandaloneItem ( ) ) { DrawerLayout drawer = findViewById ( R . id . drawer_layout ) ; drawer . closeDrawer ( GravityCompat . START ) ; selectMensa ( MensaManager . getFavoritesMensa ( ) ) ; } return false ; } } ) ; expandableListView . setOnChildClickListener ( new ExpandableListView . OnChildClickListener ( ) { @ Override public boolean onChildClick ( ExpandableListView parent , View v , int groupPosition , int childPosition , long id ) { NavigationMenuChild model = expandableListAdapter . getChild ( groupPosition , childPosition ) ; if ( model != null ) { selectMensa ( model . mensa ) ; DrawerLayout drawer = findViewById ( R . id . drawer_layout ) ; drawer . closeDrawer ( GravityCompat . START ) ; } else { Log . e ( "MainAct.onchildclick" , "Model for position group: " + groupPosition + " child " + childPosition + " was empty" ) ; } return false ; } } ) ; }
Sets up sidebar navigation.
Sets up sidebar navigation .
// -------- Navigation Drawer ------------- // Add click listener for favorite // Add click listener for Mensas