Search in sources :

Example 1 with ProfileFragment

use of in.ac.iitb.gymkhana.iitbapp.fragment.ProfileFragment in project IITB-App by wncc.

the class MainActivity method updateNavigationView.

private void updateNavigationView() {
    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);
    View header = navigationView.getHeaderView(0);
    header.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            Bundle bundle = new Bundle();
            bundle.putString(Constants.USER_ID, currentUser.getUserID());
            ProfileFragment profileFragment = new ProfileFragment();
            profileFragment.setArguments(bundle);
            updateFragment(profileFragment);
            DrawerLayout drawer = findViewById(R.id.drawer_layout);
            drawer.closeDrawer(GravityCompat.START);
        }
    });
    TextView nameTextView = header.findViewById(R.id.user_name_nav_header);
    TextView rollNoTextView = header.findViewById(R.id.user_rollno_nav_header);
    ImageView profilePictureImageView = header.findViewById(R.id.user_profile_picture_nav_header);
    nameTextView.setText(currentUser.getUserName());
    rollNoTextView.setText(currentUser.getUserRollNumber());
    Picasso.with(this).load(currentUser.getUserProfilePictureUrl()).into(profilePictureImageView);
}
Also used : NavigationView(android.support.design.widget.NavigationView) Bundle(android.os.Bundle) TextView(android.widget.TextView) ProfileFragment(in.ac.iitb.gymkhana.iitbapp.fragment.ProfileFragment) ImageView(android.widget.ImageView) DrawerLayout(android.support.v4.widget.DrawerLayout) NavigationView(android.support.design.widget.NavigationView) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView)

Aggregations

Bundle (android.os.Bundle)1 NavigationView (android.support.design.widget.NavigationView)1 DrawerLayout (android.support.v4.widget.DrawerLayout)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 ProfileFragment (in.ac.iitb.gymkhana.iitbapp.fragment.ProfileFragment)1