content: package com.cpacm.demo.circularfloatingactionmenu_demo;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.widget.FrameLayout;
  import android.widget.ImageView;
  
  import com.cpacm.library.FloatingActionButton;
  import com.cpacm.library.FloatingActionMenu;
  import com.cpacm.library.SubActionButton;
  
  
  public class MenuWithFABActivity extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_menu_with_fab);
  
          // Set up the white button on the lower right corner
          // more or less with default parameter
          ImageView fabIconNew = new ImageView(this);
          fabIconNew.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_new_light));
          FloatingActionButton rightLowerButton = new FloatingActionButton.Builder(this)
                  .setContentView(fabIconNew)
                  .build();
  
          SubActionButton.Builder rLSubBuilder = new SubActionButton.Builder(this);
          ImageView rlIcon1 = new ImageView(this);
          ImageView rlIcon2 = new ImageView(this);
          ImageView rlIcon3 = new ImageView(this);
          ImageView rlIcon4 = new ImageView(this);
  
          rlIcon1.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_chat_light));
          rlIcon2.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_camera_light));
          rlIcon3.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_video_light));
          rlIcon4.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_place_light));
  
          // Build the menu with default options: light theme, 90 degrees, 72dp radius.
          // Set 4 default SubActionButtons
          FloatingActionMenu rightLowerMenu = new FloatingActionMenu.Builder(this)
                                                  .addSubActionView(rLSubBuilder.setContentView(rlIcon1).build())
                                                  .addSubActionView(rLSubBuilder.setContentView(rlIcon2).build())
                                                  .addSubActionView(rLSubBuilder.setContentView(rlIcon3).build())
                                                  .addSubActionView(rLSubBuilder.setContentView(rlIcon4).build())
                                                  .attachTo(rightLowerButton)
                                                  .build();
  
          // Set up the large red button on the center right side
          // With custom button and content sizes and margins
          int redActionButtonSize = getResources().getDimensionPixelSize(R.dimen.red_action_button_size);
          int redActionButtonMargin = getResources().getDimensionPixelOffset(R.dimen.action_button_margin);
          int redActionButtonContentSize = getResources().getDimensionPixelSize(R.dimen.red_action_button_content_size);
          int redActionButtonContentMargin = getResources().getDimensionPixelSize(R.dimen.red_action_button_content_margin);
          int redActionMenuRadius = getResources().getDimensionPixelSize(R.dimen.red_action_menu_radius);
          int blueSubActionButtonSize = getResources().getDimensionPixelSize(R.dimen.blue_sub_action_button_size);
          int blueSubActionButtonContentMargin = getResources().getDimensionPixelSize(R.dimen.blue_sub_action_button_content_margin);
  
          ImageView fabIconStar = new ImageView(this);
          fabIconStar.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_important));
  
          FloatingActionButton.LayoutParams starParams = new FloatingActionButton.LayoutParams(redActionButtonSize, redActionButtonSize);
          starParams.setMargins(redActionButtonMargin,
                                redActionButtonMargin,
                                redActionButtonMargin,
                                redActionButtonMargin);
          fabIconStar.setLayoutParams(starParams);
  
          FloatingActionButton.LayoutParams fabIconStarParams = new FloatingActionButton.LayoutParams(redActionButtonContentSize, redActionButtonContentSize);
          fabIconStarParams.setMargins(redActionButtonContentMargin,
                                      redActionButtonContentMargin,
                                      redActionButtonContentMargin,
                                      redActionButtonContentMargin);
  
          FloatingActionButton leftCenterButton = new FloatingActionButton.Builder(this)
                                                  .setContentView(fabIconStar, fabIconStarParams)
                                                  .setBackgroundDrawable(R.drawable.button_action_red_selector)
                                                  .setPosition(FloatingActionButton.POSITION_LEFT_CENTER)
                                                  .setLayoutParams(starParams)
                                                  .build();
  
          // Set up customized SubActionButtons for the right center menu
          SubActionButton.Builder lCSubBuilder = new SubActionButton.Builder(this);
          lCSubBuilder.setBackgroundDrawable(getResources().getDrawable(R.drawable.button_action_blue_selector));
  
          FrameLayout.LayoutParams blueContentParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
          blueContentParams.setMargins(blueSubActionButtonContentMargin,
                            blueSubActionButtonContentMargin,
                            blueSubActionButtonContentMargin,
                            blueSubActionButtonContentMargin);
          lCSubBuilder.setLayoutParams(blueContentParams);
          // Set custom layout params
          FrameLayout.LayoutParams blueParams = new FrameLayout.LayoutParams(blueSubActionButtonSize, blueSubActionButtonSize);
          lCSubBuilder.setLayoutParams(blueParams);
  
          ImageView lcIcon1 = new ImageView(this);
          ImageView lcIcon2 = new ImageView(this);
          ImageView lcIcon3 = new ImageView(this);
          ImageView lcIcon4 = new ImageView(this);
          ImageView lcIcon5 = new ImageView(this);
  
          lcIcon1.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_camera));
          lcIcon2.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_picture));
          lcIcon3.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_video));
          lcIcon4.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_location_found));
          lcIcon5.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_headphones));
  
          // Build another menu with custom options
          FloatingActionMenu leftCenterMenu = new FloatingActionMenu.Builder(this)
                  .addSubActionView(lCSubBuilder.setContentView(lcIcon1, blueContentParams).build())
                  .addSubActionView(lCSubBuilder.setContentView(lcIcon2, blueContentParams).build())
                  .addSubActionView(lCSubBuilder.setContentView(lcIcon3, blueContentParams).build())
                  .addSubActionView(lCSubBuilder.setContentView(lcIcon4, blueContentParams).build())
                  .addSubActionView(lCSubBuilder.setContentView(lcIcon5, blueContentParams).build())
                  .setRadius(redActionMenuRadius)
                  .setStartAngle(70)
                  .setEndAngle(-70)
                  .attachTo(leftCenterButton)
                  .build();
  
  
      }
  
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.menu_with_fab, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // Handle action bar item clicks here. The action bar will
          // automatically handle clicks on the Home/Up button, so long
          // as you specify a parent activity in AndroidManifest.xml.
          int id = item.getItemId();
          if (id == R.id.action_settings) {
              return true;
          }
          return super.onOptionsItemSelected(item);
      }
  }
  