maxkeppeler / sheets

⭐ ‎‎‎‏‏‎ ‎Offers a range of beautiful sheets (dialogs & bottom sheets) for quick use in your project. Includes many ways to customize sheets.
https://maxkeppeler.github.io/sheets/
Apache License 2.0
923 stars 77 forks source link

InputSheet transparent background #39

Closed SunnerLi closed 3 years ago

SunnerLi commented 3 years ago

Actually It's not a bug. I still report the problem which I encounter, and how I solve it. Recently, I see the works which are created by @maxkeppeler . I decide to combine several packages into single project. However, the background of InputSheet might not show. In my setting, the language I use is Jave. I guess the reason which cause this problem is some dependency issue (?).

How to reproduce?

  1. Just create a new project. For example, a basic activity with floating action button.
  2. Add dependency of bottomsheets into gradle, and sync it right away.
    dependencies {
    implementation 'com.maxkeppeler.bottomsheets:options:1.1.2'
    }
  3. Add dependency of InputSheet into gradle, and sync it.
    dependencies {
    implementation 'com.maxkeppeler.bottomsheets:options:1.1.2'    // We have add it previously
    implementation 'com.maxkeppeler.sheets:input:2.0.0'                  
    }
  4. Add the InputSheet. For example, I add it in the FAB listener.
    fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
                InputSheet inputSheet = new InputSheet();
                inputSheet.show(MainActivity.this, new Function1<InputSheet, Unit>() {
                    @Override
                    public Unit invoke(InputSheet inputSheet) {
                        inputSheet.title("Just a simple example");
                        inputSheet.with(
                                new InputEditText("location", new Function1<InputEditText, Unit>() {
                                    @Override
                                    public Unit invoke(InputEditText inputEditText) {
                                        return null;
                                    }
                                })
                        );
                        return null;
                    }
                });
            }
        });
  5. Then we can see the dialog with transparent background.

How to solve this bug?

Just add core library into gradle, and build gradle from scratch again.

dependencies {
    implementation 'com.maxkeppeler.bottomsheets:options:1.1.2' 
    implementation 'com.maxkeppeler.sheets:core:2.0.0'                   // Add this one
    implementation 'com.maxkeppeler.sheets:input:2.0.0'                  
}
maxkeppeler commented 3 years ago

Hey SunnerLi!

I didn't actually test, if it even works to use the modules without the coremodule - in theory it should not. That's because it's the coremodule is the base of all the other sheet types. It's always necessary to add the core module. However, it's optional, which other modules you want to use. (You are also free to use just the coremodule to build your own sheets with already available functionality.)

So this "works" as intended.

The dependencies 'com.maxkeppeler.bottomsheets:module:x.x.x' are deprecated, since the library & repo was renamed to just sheets. That represents the use cases for this library, since sheets can now be displayed as dialogs or bottom-sheets with the method style(SheetStyle.DIALOG). From now on better use the 'com.maxkeppeler.sheets:module:x.x.x' dependencies.

If you have any other questions, bugs etc. just let me know. :)