content: package com.andremion.floatingnavigationview.sample;
  
  import android.os.Bundle;
  import android.view.MenuItem;
  import android.view.View;
  
  import com.andremion.floatingnavigationview.FloatingNavigationView;
  import com.google.android.material.navigation.NavigationView;
  import com.google.android.material.snackbar.Snackbar;
  
  import androidx.appcompat.app.AppCompatActivity;
  import androidx.appcompat.widget.Toolbar;
  
  public class MainActivity extends AppCompatActivity {
  
      private FloatingNavigationView mFloatingNavigationView;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
  
          mFloatingNavigationView = (FloatingNavigationView) findViewById(R.id.floating_navigation_view);
          mFloatingNavigationView.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  mFloatingNavigationView.open();
              }
          });
          mFloatingNavigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
              @Override
              public boolean onNavigationItemSelected(MenuItem item) {
                  Snackbar.make((View) mFloatingNavigationView.getParent(), item.getTitle() + " Selected!", Snackbar.LENGTH_SHORT).show();
                  mFloatingNavigationView.close();
                  return true;
              }
          });
      }
  
      @Override
      public void onBackPressed() {
          if (mFloatingNavigationView.isOpened()) {
              mFloatingNavigationView.close();
          } else {
              super.onBackPressed();
          }
      }
  
  }
  