Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Fab button dependency #17

Open
iamdeadman opened this issue Jun 17, 2018 · 2 comments
Open

Remove Fab button dependency #17

iamdeadman opened this issue Jun 17, 2018 · 2 comments

Comments

@iamdeadman
Copy link

iamdeadman commented Jun 17, 2018

Hi, I am trying to use this inside a fragment and I have tried setting the peek height like this -

dialogFrag = SelectItemsBottomSheetFragment.newInstance();
dialogFrag.setParentFab(filterFab);
filterFab.setVisibility(View.GONE);
dialogFrag.setPeekHeight(600);
dialogFrag.setAnimationDuration(100);
@Override
    public void setupDialog(Dialog dialog, int style) {
        View contentView = View.inflate(getContext(), R.layout.select_board_requirement, null);
        RelativeLayout rl_content = (RelativeLayout) contentView.findViewById(R.id.rl_content);
        LinearLayout ll_buttons = (LinearLayout) contentView.findViewById(R.id.ll_buttons);
        ....
        try {
            setAnimationDuration(100); //optional; default 500ms
            setPeekHeight(600); // optional; default 400dp
            setCallbacks((Callbacks) getActivity()); //optional; to get back result
            setViewgroupStatic(ll_buttons);
            setViewMain(rl_content); //necessary; main bottomsheet view
            setMainContentView(contentView); // necessary; call at end before super
        } catch(Exception ignored){}
        super.setupDialog(dialog, style); //call super at last
}

But, I am not observing any change in the initial height of the opened dialog.
Does the peek height has any restrictions w.r.t screen / viewport height.

Also, I wanted to use this with other form elements instead of simple dropdowns, but I don't understand why there is a requirement to setup the fab button to open it. I think with minimal refactoring we can open it from any View class.

----- Update ------

I tried again with peek height as 450 again and found it working so I guess it was a viewport height issue.

But, still I think the fab button dependency can be removed. I am not sure about what purpose does it serve in your library but if it is just to get the animation start position then I can submit a pull request for the same if you want.

@iamdeadman iamdeadman changed the title Set Peek height not changing both from inside fragment's setupDialog method or new instance Remove Fab button dependency Jun 17, 2018
@iamdeadman
Copy link
Author

so when I was trying to use a hidden fab to open the bottom sheet, because there is a setting to change fab visibility in your onStop method, the fab button is no longer hidden after I dismiss the bottom sheet, is there any way we could listen to when onStop is getting called and hide the fab once again after sheet is dismissed

@iamdeadman
Copy link
Author

Hi man, any updates on this please ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant