use of com.github.clans.fab.FloatingActionMenu in project FloatingActionButton by Clans.
the class MenusFragment method onActivityCreated.
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
menus.add(menuDown);
menus.add(menuRed);
menus.add(menuYellow);
menus.add(menuGreen);
menus.add(menuBlue);
menus.add(menuLabelsRight);
menuYellow.setOnMenuToggleListener(new FloatingActionMenu.OnMenuToggleListener() {
@Override
public void onMenuToggle(boolean opened) {
String text;
if (opened) {
text = "Menu opened";
} else {
text = "Menu closed";
}
Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show();
}
});
fab1.setOnClickListener(clickListener);
fab2.setOnClickListener(clickListener);
fab3.setOnClickListener(clickListener);
int delay = 400;
for (final FloatingActionMenu menu : menus) {
mUiHandler.postDelayed(new Runnable() {
@Override
public void run() {
menu.showMenuButton(true);
}
}, delay);
delay += 150;
}
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
fabEdit.show(true);
}
}, delay + 150);
menuRed.setOnMenuButtonClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (menuRed.isOpened()) {
Toast.makeText(getActivity(), menuRed.getMenuButtonLabelText(), Toast.LENGTH_SHORT).show();
}
menuRed.toggle(true);
}
});
createCustomAnimation();
}
use of com.github.clans.fab.FloatingActionMenu in project Remindy by abicelis.
the class TaskFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_task, container, false);
//Grab task argument
if (getArguments().containsKey(TASK_ARGUMENT)) {
mTask = (Task) getArguments().get(TASK_ARGUMENT);
} else {
BaseTransientBottomBar.BaseCallback<Snackbar> callback = new BaseTransientBottomBar.BaseCallback<Snackbar>() {
@Override
public void onDismissed(Snackbar transientBottomBar, int event) {
super.onDismissed(transientBottomBar, event);
getActivity().setResult(RESULT_CANCELED);
getActivity().finish();
}
};
Log.e(TAG, "Missing TASK_ARGUMENT argument in TaskFragment.");
SnackbarUtil.showSnackbar(mContainer, SnackbarUtil.SnackbarType.ERROR, R.string.error_unexpected, SnackbarUtil.SnackbarDuration.LONG, callback);
}
mHeaderBasicInfo = (RelativeLayout) rootView.findViewById(R.id.fragment_task_header_basic_info);
((TextView) mHeaderBasicInfo.findViewById(R.id.item_task_header_title)).setText(R.string.fragment_task_header_basic_info);
mHeaderAttachments = (RelativeLayout) rootView.findViewById(R.id.fragment_task_header_attachments);
((TextView) mHeaderAttachments.findViewById(R.id.item_task_header_title)).setText(R.string.fragment_task_header_attachments);
mContainer = (RelativeLayout) rootView.findViewById(R.id.fragment_task_container);
mContainerBasicInfo = (LinearLayout) rootView.findViewById(R.id.fragment_task_basic_info_container);
mTaskTitle = (TextView) rootView.findViewById(R.id.fragment_task_title);
mTaskTitle.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
mAttachmentsFabMenu.close(true);
}
}
});
mTaskDescription = (TextView) rootView.findViewById(R.id.fragment_task_description);
mTaskDescription.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
mAttachmentsFabMenu.close(true);
}
}
});
mTaskCategory = (Spinner) rootView.findViewById(R.id.fragment_task_category);
mAttachmentsFabHint = (TextView) rootView.findViewById(R.id.fragment_task_add_attachment_hint);
if (mTask.getAttachments().size() == 0) {
mAttachmentsFabHint.setVisibility(View.VISIBLE);
mAddAttachmentHintVisible = true;
} else {
fadeInHeaders();
mHeadersVisible = true;
}
mAttachmentsFabMenu = (FloatingActionMenu) rootView.findViewById(R.id.fragment_task_add_attachment);
mAttachmentsFabMenu.setOnMenuToggleListener(new FloatingActionMenu.OnMenuToggleListener() {
@Override
public void onMenuToggle(boolean opened) {
//Hide keyboard
((InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(mContainer.getWindowToken(), 0);
if (mAddAttachmentHintVisible) {
//Slide out FAB hint
TransitionManager.beginDelayedTransition(mContainer, new Slide(Gravity.START));
mAttachmentsFabHint.setVisibility(View.INVISIBLE);
}
}
});
mAttachmentsFabList = (FloatingActionButton) rootView.findViewById(R.id.fragment_task_add_list_attachment);
mAttachmentsFabText = (FloatingActionButton) rootView.findViewById(R.id.fragment_task_add_text_attachment);
mAttachmentsFabLink = (FloatingActionButton) rootView.findViewById(R.id.fragment_task_add_link_attachment);
mAttachmentsFabImage = (FloatingActionButton) rootView.findViewById(R.id.fragment_task_add_image_attachment);
mAttachmentsFabAudio = (FloatingActionButton) rootView.findViewById(R.id.fragment_task_add_audio_attachment);
mAttachmentsFabList.setOnClickListener(this);
mAttachmentsFabText.setOnClickListener(this);
mAttachmentsFabLink.setOnClickListener(this);
mAttachmentsFabImage.setOnClickListener(this);
mAttachmentsFabAudio.setOnClickListener(this);
//Hide keyboard
((InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(mContainer.getWindowToken(), 0);
mRecyclerView = (RecyclerView) rootView.findViewById(R.id.fragment_task_recycler);
mNoItemsContainer = (RelativeLayout) rootView.findViewById(R.id.fragment_task_no_items_container);
setUpRecyclerView();
setupSpinners();
setTaskValues();
return rootView;
}
Aggregations