Source:
private void registerFabUploadListeners() { getFabUpload().setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log_OC.e(TAG,"Clicked" + getContext().toString()); final View uploadBottomSheet = getLayoutInflater().inflate(R.layout.upload_bottom_sheet_fragment,null); final BottomSheetDialog dialog = new BottomSheetDialog(getContext()); dialog.setContentView(uploadBottomSheet); LinearLayout uploadFilesLinearLayout = (LinearLayout) uploadBottomSheet.findViewById(R.id.files_linear_layout); LinearLayout uploadFromCameraLinearLayout = (LinearLayout) uploadBottomSheet.findViewById(R.id.upload_from_camera_linear_layout); TextView uploadToTextView = (TextView) uploadBottomSheet.findViewById(R.id.upload_to_text_view); uploadFilesLinearLayout.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { UploadFilesActivity.startUploadActivityForResult(getActivity(), ((FileActivity) getActivity()) .getAccount(), FileDisplayActivity.REQUEST_CODE__SELECT_FILES_FROM_FILE_SYSTEM); dialog.hide(); return false; } }); uploadFromCameraLinearLayout.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { UploadFilesActivity.startUploadActivityForResult(getActivity(),((FileActivity) getActivity()).getAccount(), FileDisplayActivity.REQUEST_CODE__UPLOAD_FROM_CAMERA); dialog.hide(); return false; } }); uploadToTextView.setText(String.format(getResources().getString(R.string.upload_to),getResources().getString(R.string.app_name))); final BottomSheetBehavior uploadBottomSheetBehavior = BottomSheetBehavior.from((View) uploadBottomSheet.getParent()); uploadBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); dialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { uploadBottomSheetBehavior.setPeekHeight(uploadBottomSheet.getMeasuredHeight()); } }); dialog.show(); getFabMain().collapse(); recordMiniFabClick(); } }); getFabUpload().setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { showSnackMessage(R.string.actionbar_upload); return true; } }); }

Target:
private void registerFabUploadListeners() { getFabUpload().setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log_OC.e(TAG,"Clicked" + getContext().toString()); final View uploadBottomSheet = getLayoutInflater().inflate(R.layout.upload_bottom_sheet_fragment,null); final BottomSheetDialog dialog = new BottomSheetDialog(getContext()); dialog.setContentView(uploadBottomSheet); LinearLayout uploadFilesLinearLayout = (LinearLayout) uploadBottomSheet.findViewById(R.id.files_linear_layout); LinearLayout uploadFromCameraLinearLayout = (LinearLayout) uploadBottomSheet.findViewById(R.id.upload_from_camera_linear_layout); TextView uploadToTextView = (TextView) uploadBottomSheet.findViewById(R.id.upload_to_text_view); uploadFilesLinearLayout.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { UploadFilesActivity.startUploadActivityForResult(getActivity(), ((FileActivity) getActivity()) .getAccount(), FileDisplayActivity.REQUEST_CODE__SELECT_FILES_FROM_FILE_SYSTEM); dialog.hide(); return false; } }); uploadFromCameraLinearLayout.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { UploadFilesActivity.startUploadActivityForResult(getActivity(),((FileActivity) getActivity()).getAccount(), FileDisplayActivity.REQUEST_CODE__UPLOAD_FROM_CAMERA); dialog.hide(); return false; } }); uploadToTextView.setText(String.format(getResources().getString(R.string.upload_to),getResources().getString(R.string.app_name))); final BottomSheetBehavior uploadBottomSheetBehavior = BottomSheetBehavior.from((View) uploadBottomSheet.getParent()); dialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { uploadBottomSheetBehavior.setPeekHeight(uploadBottomSheet.getMeasuredHeight()); } }); dialog.show(); getFabMain().collapse(); recordMiniFabClick(); } }); getFabUpload().setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { showSnackMessage(R.string.actionbar_upload); return true; } }); }