Git Product home page Git Product logo

maxkeppeler / sheets Goto Github PK

View Code? Open in Web Editor NEW
920.0 15.0 76.0 145.15 MB

⭐ ‎‎‎‏‏‎ ‎Offers a range of beautiful sheets (dialogs & bottom sheets) for quick use in your project. Includes many ways to customize sheets.

Home Page: https://maxkeppeler.github.io/sheets/

License: Apache License 2.0

Kotlin 100.00%
android bottomsheet design-patterns android-design bottomsheets bottomsheetdialogfragment bottomsheet-dialog bottomsheet-android android-bottomsheet material

sheets's Introduction

Sheets

Sheets Library

Sleek dialogs and bottom-sheets for quick use in your app. Choose one of the available sheets or build custom sheets on top of the existing functionality.

Version of Sheets library Codacy code quality of Sheets library GitHub Give this library a star Fork this library Watch this library Follow me on GitHub Share this library on Twitter Follow Maximilian Keppeler on Twitter

Sheets Library

Get started

The library is available for compose as well. Check out Sheets-Compose-Dialogs.

A sheet can dynamically be displayed as either a dialog or as a bottom-sheet. Check out the sample.

You have to use the core module as it is the foundation of any sheet.

In your top-level build.gradle file:

repositories {
  ...
  mavenCentral()
}

In your app build.gradle file:

Download

dependencies {
  ...
  implementation 'com.maxkeppeler.sheets:core:<latest-version>'
}

Use build to build a sheet and display it later.

val sheet = InfoSheet().build(context) {
  // build sheet
}

sheet.show() // Show sheet when ready

Use show if you want to build and then immediately display it.

InfoSheet().show(context) {
  // build sheet
} // Show sheet

Resources

📖 Get a better insight into the API
Sheets API Documentation

Info

Download

The Info Sheet lets you display information or warning.



Showcase as Dialog

Sheets InfoSheet Dialog
Sheets InfoSheet Dialog
Sheets InfoSheet Dialog
Sheets InfoSheet Dialog


Showcase as BottomSheet

Sheets InfoSheet
Sheets InfoSheet BottomSheet
Sheets InfoSheet BottomSheet
Sheets InfoSheet BottomSheet
dependencies {
  ...
  implementation 'com.maxkeppeler.sheets:info:<latest-version>'
}

Usage

For the default info sheet use it as following:

InfoSheet().show(context) {
  title("Do you want to install Awake?")
  content("Awake is a beautiful alarm app with morning challenges, advanced alarm management and more.")
  onNegative("No") {
    // Handle event
  }
  onPositive("Install") {
    // Handle event
  }
}

Option

Download

The Option Sheet lets you display a grid or list of options.



Showcase as Dialog Sheets OptionsSheet Dialog



Showcase as BottomSheet Sheets OptionsSheet BottomSheet



Showcase some variants as Dialogs

Sheets OptionsSheet Dialog
Sheets OptionsSheet
Sheets OptionsSheet




Showcase some variants as BottomSheets

Sheets OptionsSheet BottomSheet
Sheets OptionsSheet
Sheets OptionsSheet

dependencies {
  ...
  implementation 'com.maxkeppeler.sheets:info:<latest-version>'
}
dependencies {
  ...
  implementation 'com.maxkeppeler.sheets:option:<latest-version>'
}

Usage

For the default options sheet use it as following:

OptionSheet().show(context) {
  title("Text message")
  with(
    Option(R.drawable.ic_copy, "Copy"),
    Option(R.drawable.ic_translate, "Translate"),
    Option(R.drawable.ic_paste, "Paste")
  )
  onPositive { index: Int, option: Option ->
    // Handle selected option
  }
}

Clock

Download

The Clock Sheet lets you quickly pick a time.



Showcase as Dialog Sheets OptionsSheet Dialog



Showcase as BottomSheet Sheets OptionsSheet BottomSheet
dependencies {
  ...
  implementation 'com.maxkeppeler.sheets:clock:<latest-version>'
}

Usage

For the default clock time sheet, in 24-hours format, use it as following:

ClockSheet().show(context) {
  title("Wake-up time")
  onPositive { clockTimeInMillis: Long ->
    // Handle selected time
  }
}

Time

Download

The Duration Sheet lets you pick a duration time in a specific format.



Showcase as Dialog Sheets TimeSheet Dialog



Showcase as BottomSheet Sheets TimeSheet BottomSheet
dependencies {
  ...
  implementation 'com.maxkeppeler.sheets:duration:<latest-version>'
}

Usage

For the default time sheet use it as following:

DurationSheet().show(context) {
  title("Snooze time")
  onPositive { durationTimeInMillis: Long ->
    // Handle selected time
  }
}

Input

Download

The Input Sheet lets you display a form consisting of various inputs.



Showcase as Dialog Sheets InputSheet Dialog



Showcase as BottomSheet Sheets InputSheet BottomSheet



Showcase some variants as Dialogs

Sheets InputSheet Dialog




Showcase some variants as BottomSheets Sheets InputSheet BottomSheet
dependencies {
  ...
  implementation 'com.maxkeppeler.sheets:input:<latest-version>'
}

Usage

For the default input sheet use it as following:

InputSheet().show(context) {
    title("Short survey")
  with(InputEditText {
    required()
    label("Your favorite TV-Show")
    hint("The Mandalorian, ...")
    validationListener { value -> } // Add custom validation logic
    changeListener { value -> } // Input value changed
    resultListener { value -> } // Input value changed when form finished
  })
  with(InputCheckBox("binge_watching") { // Read value later by index or custom key from bundle
    label("Binge Watching")
    text("I'm regularly binge watching shows on Netflix.")
    // ... more options
  })
  with(InputRadioButtons() {
    required()
    label("Streaming service of your choice")
    options(mutableListOf("Netflix", "Amazon", "Other"))
  })
  // ... more input options
  onNegative { showToast("InputSheet cancelled", "No result") }
  onPositive { result ->
      showToastLong("InputSheet result", result.toString())
      val text = result.getString("0") // Read value of inputs by index
      val check = result.getBoolean("binge_watching") // Read value by passed key
  }
}                                  |

Calendar

Download

The Calendar Sheet lets you pick a date or date range. This type was build using the library CalendarView.



Showcase as Dialog Sheets CalendarSheet Dialog



Showcase as BottomSheet Sheets CalendarSheet BottomSheet
dependencies {
  ...
  implementation 'com.maxkeppeler.sheets:calendar:<latest-version>'
}

Usage

For the default time sheet use it as following:

CalendarSheet().show(this) { // Build and show
  title("What's your date of birth?") // Set the title of the sheet
  onPositive { dateStart, dateEnd ->
    // Handle date or range
  }                        |

Storage

Download

The Storage Sheet lets you pick one or more files or folders.



Showcase as Dialog Sheets StorageSheet Dialog



Showcase as BottomSheet Sheets StorageSheet BottomSheet
dependencies {
  ...
  implementation 'com.maxkeppeler.sheets:storage:<latest-version>'
}

Usage

For the default storage sheet use it as following:

StorageSheet().show(this) {
  fileDisplayMode(FileDisplayMode.HORIZONTAL)
  selectionMode(StorageSelectionMode.FILE)
  onPositive { files -> /* Handle files or folders */ }
}

Color

Download

The Color Sheet lets you pick a color. Display the default material colors or specify which colors can be choosen from. You can allow to chose a custom color as well.



Showcase as Dialog

Sheets ColorSheet Dialog
Sheets ColorSheet Dialog




Showcase as BottomSheet

Sheets ColorSheet BottomSheet
Sheets ColorSheet BottomSheet

dependencies {
  ...
  implementation 'com.maxkeppeler.sheets:color:<latest-version>'
}

Usage

For the default color sheet use it as following:

ColorSheet().show(context) {
  title("Background color")
  onPositive { color ->
    // Use color
  }
}

Custom

With just the 'core' module you are able to create your own sheet based on this library. You can use some components and styles within your own custom sheet automatically. By default the buttons and toolbar view with logic is ready to be used by your own implementation.



Showcase as Dialog Sheets Custom Dialog



Showcase as BottomSheet Sheets Custom BottomSheet
dependencies {
  ...
  implementation 'com.maxkeppeler.sheets:core:<latest-version>'
}

Get started

You can find a custom sheet implementation in the sample module.

  1. Step: Create a class and extend from the class Sheet.

    class CustomSheet : Sheet() {

  2. Step: Implement the method: onCreateLayoutView and pass your custom layout.

    override fun onCreateLayoutView(): View { return LayoutInflater.from(activity).inflate( R.layout.sheets_custom, null) }

All of the base functionality can be used and on top of that you can extend the logic and behavior as you wish.

Components

You are free to use the components this library uses for it's sheet types.

  • SheetsTitle
  • SheetsContent
  • SheetsDigit
  • SheetsNumericalInput
  • SheetsDivider
  • SheetsButton
  • SheetsEdit
  • SheetsRecyclerView
  • SheetsValue

Lottie

Download

The Lottie modules gives you the ability to use a Lottie animations as cover view.



Showcase as Dialog Sheets InfoSheet

Showcase as BottomSheet

Sheets InfoSheet
dependencies {
  ...
  implementation 'com.maxkeppeler.sheets:lottie:<latest-version>'
}

Usage

You can use the Lottie animation as a cover for any type of sheet.

InfoSheet().show(this) {
  title("Team Collaboration")
  content("In the world of software projects, it is inevitable...")
  ...
  withCoverLottieAnimation(LottieAnimation {
    setAnimation(R.raw.anim_lottie_business_team)
    ... Setup Lottie animation
  })
  ...
}

Appearance

By default, the library switches to either day or night mode depending on the attr textColorPrimary. By default it uses the activity's colorPrimary. The default highlightColor is generated based on the color sheetsPrimaryColor, or if not available colorPrimary.

Base

You want a different sheet background shape? Then just override the corner family and radius.

<item name="sheetsCornerRadius">12dp</item>
<item name="sheetsCornerFamily">cut</item>

Just overwrite the base colors, if you want to achieve a different look of the sheets than your app.

<item name="sheetsPrimaryColor">@color/customPrimaryColor</item>
<item name="sheetsHighlightColor">@color/customHighlightColor</item>
<item name="sheetsBackgroundColor">@color/customBackgroundColor</item>
<item name="sheetsDividerColor">@color/customDividerColor</item>
<item name="sheetsIconsColor">@color/customIconsColor</item>

You can override the basic style of a sheet. Instead of displaying the toolbar, you can just hide it and display the typical handle.

<item name="sheetsDisplayHandle">true</item>
<item name="sheetsDisplayToolbar">false</item>
<item name="sheetsDisplayCloseButton">false</item>

Change the appearance of the title.

<item name="sheetsTitleColor">@color/customTitleTextColor</item>
<item name="sheetsTitleFont">@font/font</item>
<item name="sheetsTitleLineHeight">@dimen/dimen</item>
<item name="sheetsTitleLetterSpacing">value</item>

Change the appearance of the content text.

<item name="sheetsContentColor">@color/customContentTextColor</item>
<item name="sheetsContentInverseColor">@color/customContentTextInverseColor</item>
<item name="sheetsContentFont">@font/font</item>
<item name="sheetsContentLineHeight">@dimen/dimen</item>
<item name="sheetsContentLetterSpacing">value</item>

Change the appearance of the value texts. (e.g. the time in the TimeSheet & ClockSheet or the selected date & period in the Calendarsheet.)

<item name="sheetsValueTextActiveColor">@color/customValueTextColor</item>
<item name="sheetsValueFont">@font/font</item>
<item name="sheetsValueLineHeight">@dimen/dimen</item>
<item name="sheetsValueLetterSpacing">value</item>

Change the appearance of the digit keys on the numerical input.

<item name="sheetsDigitColor">@color/customDigitTextColor</item>
<item name="sheetsDigitFont">@font/font</item>
<item name="sheetsDigitLineHeight">@dimen/dimen</item>
<item name="sheetsDigitLetterSpacing">value</item>

Buttons

Override the appearance of the button text.

<item name="sheetsButtonTextFont">@font/font</item>
<item name="sheetsButtonTextLetterSpacing">value</item>

Override the general appearance of the buttons (negative and positive button).

<item name="sheetsButtonColor">@color/customButtonColor<item>
<item name="sheetsButtonTextFont">@font/font<item>
<item name="sheetsButtonTextLetterSpacing">value<item>
<item name="sheetsButtonCornerRadius">12dp<item>
<item name="sheetsButtonCornerFamily">cut<item>
<item name="sheetsButtonWidth">match_content/wrap_content<item>

Override the appearance of the negative button.

<item name="sheetsNegativeButtonType">text_button/outlined_button/button<item>
<item name="sheetsNegativeButtonColor">color<item>
<item name="sheetsNegativeButtonCornerRadius">12dp<item>
<item name="sheetsNegativeButtonCornerFamily">cut<item>

Override the appearance of the positive button.

<item name="sheetsPositiveButtonType">text_button/outlined_button/button<item>
<item name="sheetsPositiveButtonColor">color<item>
<item name="sheetsPositiveButtonCornerRadius">12dp<item>
<item name="sheetsPositiveButtonCornerFamily">cut<item>

Override the border appearance of the outlined button.

<item name="sheetsButtonOutlinedButtonBorderColor">@color/borderColor<item>
<item name="sheetsButtonOutlinedButtonBorderWidth">1dp<item>

The corner family and radius is applied to the button shape or in the case of a outlined or text button, to the ripple background shape.

Fine control You can even define the corner family and radius of the negative and positive button for each corner.

<item name="sheetsNegativeButtonBottomLeftCornerRadius">4dp<item>
<item name="sheetsNegativeButtonBottomLeftCornerFamily">cut<item>
...
<item name="sheetsPositiveButtonBottomRightCornerRadius">8dp<item>
<item name="sheetsPositiveButtonBottomRightCornerFamily">rounded<item>

Handle

The size and the appearance of the handle can be changed like this:

<item name="sheetsHandleCornerRadius">8dp</item>
<item name="sheetsHandleCornerFamily">rounded</item>
<item name="sheetsHandleFillColor">?sheetPrimaryColor</item>
<item name="sheetsHandleBorderColor">?sheetPrimaryColor</item>
<item name="sheetsHandleBorderWidth">1dp</item>
<item name="sheetsHandleWidth">42dp</item>
<item name="sheetsHandleHeight">4dp</item>

OptionSheet

Override appearance of selected options.

<item name="sheetsOptionSelectedImageColor">@color/customSelectedOptionImageColor</item>
<item name="sheetsOptionSelectedTextColor">@color/customSelectedOptionTextColor</item>

Override appearance of disabled options.

<item name="sheetsOptionDisabledImageColor">@color/customDisabledOptionImageColor</item>s
<item name="sheetsOptionDisabledTextColor">@color/customDisabledOptionImageColor</item>
<item name="sheetsOptionDisabledBackgroundColor">@color/customDisabledOptionBackgColor</item>

InputSheet

Override the appearance of the TextInputLayout (used for the InputEditText).

<item name="sheetsTextInputLayoutCornerRadius">12dp</item>
<item name="sheetsTextInputLayoutBottomLeftCornerRadius">12dp</item>
... and for all other corners
<item name="sheetsTextInputLayoutEndIconColor">@color/customEndIconColor</item>
<item name="sheetsTextInputLayoutHelperTextColor">@color/customHelperTextColor</item>
<item name="sheetsTextInputLayoutBoxStrokeColor">@color/customBoxStrokeColor</item>
<item name="sheetsTextInputLayoutHintTextColor">@color/customHintTextColor</item>
<item name="sheetsTextInputLayoutBoxStrokeErrorColor">@color/customBoxStrokeErrorColor</item>
<item name="sheetsTextInputLayoutErrorTextColor">@color/customErrorTextColor</item>

Misc

Support this project

  • Leave a star and tell others about it
  • Watch for updates and improvements.
  • Open an issue if you see or got any error.
  • Leave your thanks here and showcase your implementation.
  • Donate me a coffee.

Contribute

  1. Open an issue to discuss what you would like to change.
  2. Fork the Project
  3. Create your feature branch (feature-[some-name])
  4. Commit your changes
  5. Push to the branch (origin feature-[some-name])
  6. Open a pull request

Donate

Show your appreciation by donating me a coffee. Thank you very much!

Buy Me a Coffee at ko-fi.com Buy Me A Coffee Donate on PaPal

Showcase

Check out some apps which are using this library.

  • Aquafy - Beautiful hydration tracker and reminder.

  • Awake - Intelligent alarms and wake-up challenges and sleep tracking to improve your daily sleep and day-time quality.

  • Sign for Spotify - Playlist and control widgets for Spotify content.

  • Buddha Quotes - Open Source Buddha Quotes.

License

Copyright 2020 Maximilian Keppeler https://maxkeppeler.com

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

sheets's People

Contributors

brh avatar btraas avatar enricocid avatar ff-bryan-mena avatar jackdevey avatar joymajumdar2001 avatar leejanghee avatar maxkeppeler avatar mena97villalobos avatar russellbanks avatar whitescent avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sheets's Issues

input bottomsheets auto dismiss need to be disable

Is your feature request related to a problem? Please describe.
I'm using input bottom sheet for change password functionality. If the user entered wrong details I'm able to validate and notify to the user. but Dialog automatically dismissing. again user has to enter the details again. so disable the dismiss will help me in ordered to rectify this problem.

Describe the solution you'd like
remove the functionality of dismissing. and add those functionalities to the developer.

InputEditText stroke and hint not visible in day mode

Describe the bug
InputEditText box stroke and hint are not visible in day mode. I tried to set all listed in documentation style items attributes, but InputEditText box stroke and hint are visible only when sheet is in dark mode. Another parts like title or buttons texts are visible as expected (dark texts in day mode and light texts in dark mode) and have color as I set in styles.xml.

Library Version:
2.0.0 and previous

To Reproduce
Steps to reproduce the behavior:

  1. Add InputSheet with InputEditText
  2. Set attributes in styles.xml :
<style name="AppTheme" parent="Theme.MaterialComponents.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="android:textColorPrimary">@color/darkGray</item>
        <item name="android:textColor">@color/darkGray</item>
        <item name="fontFamily">@font/poppins</item>

        <!-- Sheet theme customization -->
        <item name="sheetPrimaryColor">@color/darkGray</item>
        <item name="sheetHighlightColor">@color/colorPrimary</item>
        <item name="sheetBackgroundColor">@color/white</item>
        <item name="sheetDividerColor">@color/lightGray</item>
        <item name="sheetIconsColor">@color/darkGray</item>
        <item name="sheetTextInputLayoutBoxStrokeColor">@color/colorPrimary</item>
        <item name="sheetTextInputLayoutHintTextColor">@color/darkGray</item>

    </style>

where color values are:

<resources>
    <color name="colorPrimary">#ff598e</color>
    <color name="colorPrimaryDark">#fe5a5f</color>
    <color name="colorAccent">#1e1e1e</color>
    <color name="basicGray">#e6e6e6</color>
    <color name="colorPrimaryDarkPale">#ff8a8e</color>

    <color name="gray">#cccccc</color>
    <color name="lightGray">#f4f4f4</color>
    <color name="darkGray">#666665</color>
    <color name="white">#ffffff</color>
    <color name="transparent">#00ffffff</color>
</resources>
  1. See that InputEditText is not visible but works fine.

Expected behavior
I should see the InputEditText box stroke color and hint color as I set in sheetTextInputLayoutBoxStrokeColor and sheetTextInputLayoutHintTextColor parameters.

Screenshots
Problem is with InputEditText visibility so I am not able to show this at screenshot.

Affected Device(s):

  • Xiaomi Mi Mix 2S, Motorola One Vision (both with Android 10)

Additional context

Input Sheet validation bug

Describe the bug
On the Input Sheet, when a user inputs something that is invalid, the positive button goes invisible to indicate an invalid response, but the user is still able to press it and go through with the action.

Library Version:
1.1.0

To Reproduce
Steps to reproduce the behavior:

  1. Have an input into an input sheet that is deemed invalid by the validation listener.
  2. Click where the positive button would be.

Expected behavior
The user should not be able to go through with the action if the given input is invalid.

Screenshots
I've attached two videos here that show the issue. The first one is of an implementation in my app. The second is from the sample app.
Implementation in my app
Sample app

Additional context
This occurs on the sample app, too.

Crash when putting app into app switcher while sheet is open

Describe the bug
If you swipe the app into the app switcher while a sheet is open, when you return to it, the app will crash.

Library Version:
2.1.3

To Reproduce
Steps to reproduce the behavior:

  1. Open a sheet
  2. Swipe app into the app switcher
  3. Return to the app

Expected behavior
The user should be able to return to the app without it crashing and the sheet remain as it was.

Additional context
This also occurs in the sheets sample app.

Screenshots
I have attached a video of this happening in my app.

Sheets-crash-example.mp4

InputSheet transparent background

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'
}
  1. 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'                  
}
  1. 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;
                    }
                });
            }
        });
  1. 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'                  
}

Duplicate Value Merge Error

Describe the bug

  • What went wrong:
    Execution failed for task ':app:mergeDebugResources'.

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Android resource compilation failed
C:\Users\Maki.gradle\caches\transforms-2\files-2.1\2ccd1e7c841bb979159f85186e44dbc7\preference-1.1.1\res\values\values.xml:257:5-336:25: AAPT: error: duplicate value for resource 'attr/defaultValue' with config ''.

 C:\Users\Maki\.gradle\caches\transforms-2\files-2.1\2ccd1e7c841bb979159f85186e44dbc7\preference-1.1.1\res\values\values.xml:257:5-336:25: AAPT: error: resource previously defined here.

Library Version:
2.0.0

Expected behavior
Should Compile.

Support android:supportsRtl="false"

Describe the bug
If RTL support is disabled application-wide, text alignment doesn't work properly (text is all left-aligned, android:textAlignment="center" is ignored)

This can be resolved by setting the android:gravity="center" attribute on SheetContent items (and probably others).

Library Version:
2.0.0

To Reproduce
Steps to reproduce the behavior:

  1. Set android:supportsRtl="false" in Manifest.xml
  2. Display an OptionsSheet grid

Expected behavior
Option label text should be centered.

Unable to locate 2.1.3 version

Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/maxkeppeler/bottomsheets/core/2.1.3/core-2.1.3.pom
       - https://jcenter.bintray.com/com/maxkeppeler/bottomsheets/core/2.1.3/core-2.1.3.pom
       - https://repo.maven.apache.org/maven2/com/maxkeppeler/bottomsheets/core/2.1.3/core-2.1.3.pom
       - https://jitpack.io/com/maxkeppeler/bottomsheets/core/2.1.3/core-2.1.3.pom
       - https://dl.bintray.com/kotlin/kotlin-eap/com/maxkeppeler/bottomsheets/core/2.1.3/core-2.1.3.pom
       - https://plugins.gradle.org/m2/com/maxkeppeler/bottomsheets/core/2.1.3/core-2.1.3.pom

allProjects {
         repositories {
             google()
             jcenter()
             mavenCentral()
             dependencies { apply from: "$rootProject.rootDir/version-groups.gradle" }
             maven { url "https://jitpack.io" } // add this line
             maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
             maven { url "https://plugins.gradle.org/m2/" }
         }
}

Any more repos I am missing out 😀

No custom styles for disabled options

It would be really helpful to be able to style the disabled options, specifically the text color or opacity, icon color or opacity, and possibly remove the "selectableItemBackground" for disabled options.

When using the default android gray button colors (light mode), it's not immediately clear which option (white or gray) is enabled or disabled, because the disabled option looks similar to the default (enabled) android button style. Being able to change the disabled text color would make it more clear.

image

TimeSheet zero values

I'm not sure if this is a bug or working as intended.
The TimeSheet doesn't allow selecting zero seconds as a value. It used to work in version 1.0.6 by setting the min value to 0 when initializing the TimeSheet. In version 2.0.0 this workaround doesn't seem to work anymore.

RTL support

Is your feature request related to a problem? Please describe.
well first of all thanks for quick fix on #24

Right to Left support is the feature that I think it would nice to have on this lib
currently if we try using this library on languages like farsi or arabic, the position of buttons, text, horizontal recycler view, and ... are not appropriate

Describe the solution you'd like
also it's easy to implement
just add another copy of layout with tag (android:layoutDirection="rtl") on root layout or kotlin code (window.decorView.layoutDirection = View.LAYOUT_DIRECTION_RTL)

Additional context
I think this link is super helpful
https://material.io/design/usability/bidirectionality.html

Do I need to enable Databinding for this library to work??

java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/databinding/DataBinderMapperImpl;
        at androidx.databinding.DataBindingUtil.<clinit>(DataBindingUtil.java:32)
        at androidx.databinding.DataBindingUtil.getDefaultComponent(DataBindingUtil.java:65)
        at com.maxkeppeler.bottomsheets.databinding.BottomSheetsViewButtonsBinding.bind(BottomSheetsViewButtonsBinding.java:81)
        at com.maxkeppeler.bottomsheets.databinding.BottomSheetsBaseBinding.bind(BottomSheetsBaseBinding.java:71)
        at com.maxkeppeler.bottomsheets.databinding.BottomSheetsBaseBinding.inflate(BottomSheetsBaseBinding.java:57)
        at com.maxkeppeler.bottomsheets.core.BottomSheet.onCreateView(BottomSheet.kt:255)

Error using hilt

I'm getting :
java.lang.IllegalStateException: Context has no window attached. at com.maxkeppeler.bottomsheets.core.BottomSheet.show(BottomSheet.kt:412) at com.maxkeppeler.bottomsheets.time_clock.ClockTimeSheet.show(ClockTimeSheet.kt:120)

when using ClockTimeSheet().show(requireContext()){... with Hilt in a PreferenceFragmentCompat

Library Version:
1.0.6

Additional context
When not using hilt on the PreferenceFragmentCompat it works fine.

Color Sheet disableSwitchColorView icon remains

Describe the bug
On the color sheet, disableSwitchColorView() disables the ability to switch to the custom color view. However, the icon still remains - it just doesn't do anything.

Library Version:
1.1.0

To Reproduce
Steps to reproduce the behavior:

  1. Add disableSwitchColorView() to the code
  2. The icon to switch the color view remains

Expected behavior
The icon should go away if disableSwitchColorView() is enabled.

Screenshots
I've attached a video showing this bug in the sample app

20-01-01-18-15-00.mp4

InputSheet Password Validation

Just a quick thing I noticed from the Sample App (1.1.2)
Once the password validation gives an ok, any updates to the input are not allowed.
I also think having an active cursor would be helpful.

InputSheet Enhancements

Could we also get the switch added to the InputSheet Options? Given that we already have radio buttons. I think we should have the switch as a standard option as well.

Another great idea would be adding some haptic feedback to the inputs, triggered upon input selection.

Let me know what you think.

Rename peekHeight to peakHeight

If I understand correctly setting the peekHeight will set the maximum height of the bottom sheet. The correct term would be peak in that case.

Bottom Sheet Handle Drawable

Describe the solution you'd like
An additional view which displays a drawable acting as a handle to indicate that this bottom sheet can be slide up and down.

Additional context
Seen in official Google apps as well, e.g. here

Quick actions for input has strange background

Library Version:
2.1.3

To Reproduce
Steps to reproduce the behavior:

  1. Add InputSheet with InputEditText
  2. Try to Paste some text

Expected behavior
Shadow and background actions should be correct.

Video

screen-20210316-150630.mp4

InputSheet Password

Not sure if you have this planned already. I think also having a fingerprint option would be great. If the user places a finger on the fingerprint sensor, you could also give some feedback. A fingerprint icon with a green check mark for an approved print, and maybe a fingerprint icon with a red cross mark for anything unrecognized.

You also need an InputSheet to register new user passwords/fingerprints.

📖 Guest Book 👌

This guest book serves as a place to leave comments about this bottom-sheets-library.
If it helped you out and you appreciate it, let me know that! :)

You can also mention & link an app, which is using it. I will mention some here.

Thanks! 😁

Inspired by nisrulz.

Colors get added to the bottom of example colors on color sheet

Describe the bug
Adding colors onto a color sheet just appends the colors onto the example colors already provided.

Library Version:
1.1.1

To Reproduce
Steps to reproduce the behavior:

  1. Pass a set of colors through colors()

Expected behavior
The colors that are passed through colors() should be the only ones shown in the bottom sheet

Screenshots
I have attached a video showing this bug in my app. As you can see, I have added 12 colors which have just been appended to the bottom of the example colors.

20-01-03-17-17-36.mp4

Additional context
The sample app doesn't seem to pass anything through colors() but still shows the example colors

InfoSheet Text Scroll Missing

I'm using the latest version 2.0.0. Can we add a scroll view for the text content? or even better have an option for max height for the bottom sheet along with the scroll view. I'm using the InfoSheet to display Text and sometimes the content comes in different size. Let me know what you think.

No option to disable icons for options sheet.

Sometimes, there are no icons to be used for list of options, and I just want the use the options sheet to be able to display a list of options.

There should be a way to disable icons, and left align the options. Currently not settings icons, leaves a significant blank space to the left of the options text.

Change dialog and bottomSheet width

It's useful to have a builder parameter to customize the Dialog/BottomSheet width.
It's not visually appealing to have a full-width bottom sheet when on tablets with landscape orientation.

Clock bottom-sheet giving wrong time

The result time is not same as of the selection in clock bottom-sheet. Also when using disableTimeline(TimeLine.PAST) in Calendar bottom-sheets the dates are still selectable

[Color Sheet] Accept Hex code colors also

Consider accepting Hex code strings for colors. Sometimes colors might be loaded from a database and user gets to choose one. It'll be easier to store the string value in the database rather than @Res value

No focus in InputEditText or unable to input anything

Describe the bug
Hello, I have faced several issues according to InputSheet functionality.

  • This code sample works as expected
InputSheet().show(this) {
            style(getSheetStyle())
            title("Survey")
            with(InputEditText {
                required()
                label("My label")
                inputType(InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_MULTI_LINE)
                defaultValue("test")
            })
}
screen-20210408-154220.1.mp4
  • Another case without label: the input field lose the focus, but I'm able to input text
InputSheet().show(this) {
            style(getSheetStyle())
            title("Survey")
            with(InputEditText {
                required()
                inputType(InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_MULTI_LINE)
                defaultValue("test")
            })
}
screen-20210409-103502.1.mp4
  • And the last case, I need to input only digits: in this case I'm not able to input anything at all
InputSheet().show(this) {
            style(getSheetStyle())
            title("Survey")
            with(InputEditText {
                required()
                inputType(InputType.TYPE_CLASS_NUMBER or InputType.TYPE_TEXT_FLAG_MULTI_LINE)
                defaultValue("1000")
            })
}
screen-20210409-103806.1.mp4

Library Version:
2.1.4

Expected behavior
User able to input text / digits and see the focus in the fields

Affected Device(s):
Tested on Google Pixel 3a

Multiple Instances with Fragments

For some reason I'm getting multiple instances of the OptionSheet. For instance, if I open up FragmentX & then open up the OptionSheet, the next time I open up another instance FragmentX & open up the OptionSheet again. I will have have to deal with 2 instances of the OptionSheet.

Input Bottom Sheet - Ability to disable positive button programatically

Is your feature request related to a problem? Please describe.
I've been migrating from Aiden Follestad's bottom sheets to this library and one thing I was able to do from that was if an input is incorrect, I could disable the positive button. For example, I need to ensure in my app that the input does not contain the characters "//". I had achieved this previously by doing:
if input.contains("//") { dialog.getActionButton(WhichButton.POSITIVE).isEnabled = false }

Describe the solution you'd like
The ability to disable the positive button programatically

crashes on configuration change

Describe the bug
the sample app crashes on configuration change while showing some bottom-sheets

Library Version:
1.1.1

To Reproduce
open a multipleChoices bottom-sheet and rotate phone

Expected behavior
the app should not crash and also app should maintain state of bottom-sheet and selected options

Additional context
maybe some navigationComponent-ish changes could help

The time displayed is wrong with HH_MM formating

Describe the bug
When using the following code, the time displayed is incorrect :

TimeSheet().show(context) {
            title(title)
            currentTime(TimeUnit.HOURS.toSeconds(0).plus(TimeUnit.MINUTES.toSeconds(50)))
            format(TimeFormat.HH_MM)
            onPositive { durationTimeInSeconds: Long ->
                // Handle selected time
            }
            onNegative {
            }
        }

Library Version:
2.0.0

To Reproduce
Steps to reproduce the behavior:

  1. By using the above displayed code, the time displayed is not 00h50m but 50h00m.

Expected behavior

  1. By using the above displayed code, the time displayed would be 00h50m.

Screenshots

Affected Device(s):

Additional context

InfoSheet General Cleanup

Some minor cleanup issues I noticed:

  • Image Cropping:
    Can we get options for the image display? I think you have the image set to center crop. Sometimes I think it all depends on the image, sometimes a top crop is better than a center crop.

  • Lottie Display:
    While this is working well, I think adding an option to blow up or scale the image horizontally to fill all the space would look great. It seems like anything I pull in is stuck in the center with white side bars.

  • Text Color:
    Do we have a way to modify the title color besides the hardcoding stuff in the styles.xml? If not, this could be a great quick option to set the color dynamically

  • Button Boarder:
    Can we also get borders around the buttons at the bottom of the sheet as an option? + a color option for the boarder.

  • Text Font
    If you could also provide a Font Option to dynamically set the font for your text, that would be a another great addition.

After all this, I'll be buying you coffee :)

There should be a drawable argument that is actually a drawable and not a resource

Currently the InfoSheet for example takes a resource for drawable, beside the fact that this is misleading, it limits the usage of this library.
In many cases drawables are loaded at run time and have no resource id.

I believe the default behavior should be to take an actual drawable as an argument, and add an option to supply a drawable resource as a different argument if you think it's necessary

InfoSheet Enhancements

Describe the solution you'd like
Request to add more features to the InfoSheet:

  1. InfoSheet with Lottie Animation, and text at the bottom
  2. InfoSheet with an image (url source or drawable) at the top, and text at the bottom.

*Url sources cover dynamic pictures, and the drawable covers icons + other static pictures

Bottom Sheet for loading/waiting view.

Describe the solution you'd like
A bottom sheet to indicate loading/processing. Ideally, there should be two modes, determinate progress (percentage progress) and indeterminate progress. The bottom sheet should also be able to specify a title and a message (progress, or any other message).

OptionsSheet automatically runs action

Describe the bug
The first time it is opened you can proceed with the action perfectly fine, however every other subsequent you open it, it will
run the same action again instantly.

Library Version:
1.1.2

To Reproduce
Steps to reproduce the behavior:

  1. Create an OptionsSheet with the following code
// Builds the options bottom sheet
        val moreOptions = OptionsSheet().build(requireContext()) {
            displayMode(DisplayMode.LIST)
            title("More")
            closeButtonDrawable(R.drawable.ic_down_arrow)
            with(
                Option(R.drawable.ic_share, "Share"),
                Option(R.drawable.ic_add_circle, "Add to list")
            )
            onPositive { index: Int, option: Option ->
                binding.root.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY)
                if (index == 0) {
                    val sendIntent: Intent = Intent().apply {
                        action = Intent.ACTION_SEND
                        val text = binding.quote.text.toString() + "\n\n~Gautama Buddha"
                        putExtra(Intent.EXTRA_TEXT, text)
                        type = "text/plain"
                    }
                    val shareIntent = Intent.createChooser(sendIntent, null)
                    startActivity(shareIntent)
                } else {
                    dismiss()
                    //This is the indented action. We haven't coded the rest yet
                }
            }
        }

Expected behavior
Subsequent times you open the bottom sheet, it should act like the first time rather than running the previous action

Screenshots
https://user-images.githubusercontent.com/38474124/103697114-5c2c5f80-4f97-11eb-95c0-e98cf1d56ebb.mp4

Affected Device(s):

  • OnePlus 6
  • OnePlus Nord
  • Pixel 3a (emulated)

Additional context
We use other variations of the option sheet in our app and haven't come across this issue. This happens on either option the user chooses.

Using the new Kotlin JVM IR with Sheets causes a compilation error

Describe the bug
The Kotlin team have rewritten the JVM compiler and this becomes default in Kotlin 1.5.0. However, attempting to use Sheets on an app that uses either the new IR on Kotlin 1.4.32 or Kotlin 1.5.0 where the new IR becomes the default compiler for Kotlin throws TypeAliasDescriptor expected: class NegativeListener (not found).

Not knowing that Sheets was causing the issue, I commented on an issue on JetBrains YouTrack to which an employee responded showing the cause of the error. I have attached this under additional context. I have also attached two pipelines that show the thrown error on my project, the line in Sheets that causes the error and another issue that has more information about the problem in depth.

Library Version:
2.1.4

To Reproduce
Steps to reproduce the behavior:

  1. Add useIR = true under kotlinOptions{} in Gradle or use Kotlin 1.5.0 where the new IR is default.

Expected behavior
The app should be able to compile with the new IR while using Sheets.

Additional context

Button Option Enhancements

Describe the solution you'd like
Request to add more features for the Buttons:

  1. Buttons with border off
  2. Buttons with border on + circular shape + radius + border color + custom background on or off
  3. Buttons with border on + rectangular shape + corner radius + border color + custom background on or off

I think you have text color already, so that's covered for the buttons. The custom background can just be a custom color configuration.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.