All Projects → maxkeppeler → Sheets

maxkeppeler / Sheets

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

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Sheets

Material Backdrop
A simple solution for implementing Backdrop pattern for Android
Stars: ✭ 221 (-49.89%)
Mutual labels:  design-patterns, material-design, material
Material Framework
[Unmaintained] An easy to use material design based framework.
Stars: ✭ 383 (-13.15%)
Mutual labels:  material-design, material
Svelte Materialify
A Material UI Design Component library for Svelte heavily inspired by vuetify.
Stars: ✭ 351 (-20.41%)
Mutual labels:  material-design, material
Materialtimelineview
With MaterialTimelineView you can easily create a material looking timeline.
Stars: ✭ 443 (+0.45%)
Mutual labels:  material-design, material
React Native Material Ripple
Base component for touchable elements
Stars: ✭ 359 (-18.59%)
Mutual labels:  material-design, material
Material Foundation
Material Design version of Foudation for Sites by Zurb
Stars: ✭ 361 (-18.14%)
Mutual labels:  material-design, material
Blueprint
Free, feature-rich, easily customizable Android dashboard for icon packs
Stars: ✭ 389 (-11.79%)
Mutual labels:  material-design, material
Zoonavigator
Web-based ZooKeeper UI / editor / browser
Stars: ✭ 326 (-26.08%)
Mutual labels:  material-design, material
Frames
Free, feature-rich, easily customizable Android dashboard for wallpapers apps
Stars: ✭ 396 (-10.2%)
Mutual labels:  material-design, material
Material Auto Rotating Carousel
Introduce users to your app with this Material-style carousel.
Stars: ✭ 400 (-9.3%)
Mutual labels:  material-design, material
Material Kit React Native
Material Kit React Native
Stars: ✭ 424 (-3.85%)
Mutual labels:  material-design, material
Modalbottomsheetdialogfragment
Modal bottom sheet dialog based on the Material Guidelines
Stars: ✭ 421 (-4.54%)
Mutual labels:  material-design, bottomsheet
React Native Material Menu
Pure JavaScript material menu component for React Native
Stars: ✭ 327 (-25.85%)
Mutual labels:  material-design, material
Android Extensions
An Android library with modules to quickly bootstrap an Android application.
Stars: ✭ 356 (-19.27%)
Mutual labels:  material-design, material
Quasar
Quasar Framework - Build high-performance VueJS user interfaces in record time
Stars: ✭ 20,090 (+4455.56%)
Mutual labels:  material-design, material
Samples
Sample projects using Material, Graph, and Algorithm.
Stars: ✭ 386 (-12.47%)
Mutual labels:  material-design, material
Mdb Ui Kit
Bootstrap 5 & Material Design 2.0 UI KIT
Stars: ✭ 21,830 (+4850.11%)
Mutual labels:  material-design, material
Material Components Vue
Material Design styled components for Vue.js
Stars: ✭ 316 (-28.34%)
Mutual labels:  material-design, material
Ngx Materialize
Angular wrap around Materialize library
Stars: ✭ 322 (-26.98%)
Mutual labels:  material-design, material
Md2
Angular2 based Material Design components, directives and services are Accordion, Autocomplete, Collapse, Colorpicker, Datepicker, Dialog(Modal), Menu, Multiselect, Select, Tabs, Tags(Chips), Toast and Tooltip.
Stars: ✭ 389 (-11.79%)
Mutual labels:  material-design, material

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

Read in Deutsch or 简体中文.

sheets Library

Table of Contents

Get started

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>'
}

Base functions
Following functions can be called from any type of sheet.

Function Action
style() Display as dialog or bottom-sheet.
title() Set the title text.
titleColor() Set the title text color.
titleColorRes() Set the title text color by a resource.
withCoverImage() Add a cover image.
topStyle() Specify the style of the cover image and top bar.
positiveButtonStyle() Define the style of the positive button (Text, Filled, Outlined).
negativeButtonStyle() Define the style of the negative button (Text, Filled, Outlined).
withIconButton() Add up to 3 icon buttons to the top bar.
closeIconButton() Set a custom close icon button.
displayHandle() Display the handle.
displayCloseButton() Display close icon button.
displayToolbar() Display toolbar. (Close icon button, title, divider and icon buttons)
peekHeight() Set the peek height. (Only bottom-sheet)
cornerRadius() Set corner radius.
cornerFamily() Set corner family. (Cut or rounded)
borderWidth() Set the border width.
borderColor() Set the border color.
cancelableOutside() Make sheet cancelable outside of the dialog view.
onNegative() Set the negative button text and listener.
onPositive() Set the positive button text and listener.
onDismiss() Set a listener that is invoked when the sheet is dismissed.
onCancel() Set a listener that is invoked when the sheet is cancelled (only if cancelable).
onClose() Set a listener that is invoked when the sheet is closed.
show() show the sheet.

Each sheet has an extension function called build and show.

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

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
  }
}
Function Action
content() Set content text.
drawable() Set drawable.
drawableColor() Set drawable color.

Options

Download

The Options 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:options:<latest-version>'
}

Usage

For the default options sheet use it as following:

OptionsSheet().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
  }
}
Function Action
multipleChoices() Allow multiple choices content.
displayMultipleChoicesInfo() Display info of the multiple choices.
maxChoicesStrictLimit() Specify that the max choices is strict and more choices can't be selected temporarily.
minChoices()  Set the minimum amount of choices.
maxChoices() Set the maximum amount of choices.
onPositiveMultiple() Set listener for multiple choices.
displayButtons() Display buttons and require a positive button click for selection.
displayMode() Display options in a list or a vertical/ horizontal growing scrollable grid.

Option

Function Action
selected() Preselect an option.
disable() Disable an option.

Note: Preselected options automatically increase the current selection while disabled options decrease the maximum amount of choices.

Clock Time

Download

The Clock Time Sheet lets you quickly pick a time.



Showcase as Dialog Sheets OptionsSheet Dialog


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

Usage

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

ClockTimeSheet().show(context) {
  title("Wake-up time")
  onPositive { clockTimeInMillis: Long ->
    // Handle selected time
  }
}
Function Action
format24Hours() Use 24-hours or 12-hours format.
currentTime() Set the current time in milliseconds.

Time

Download

The Time 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:time:<latest-version>'
}

Usage

For the default time sheet use it as following:

TimeSheet().show(context) {
  title("Snooze time")
  onPositive { durationTimeInMillis: Long ->
    // Handle selected time
  }
}
Function Action
format() Select the time format. (hh:mm:ss, mm:ss, ...)
currentTime() Set the current time in seconds.
minTime() Set the minimum time.
maxTime()` Set the maximum 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")
    content("We would like to ask you some questions reading your streaming platform usage.")
  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
  }
}
Function Action
with() Add an input. (see input options)
content() Set content text. (e. g. to explain a survey)

Input options:

  • InputEditText
  • InputCheckBox
  • InputRadioButtons
  • InputSpinner

Input

Function Action
label() Set the label text.
drawable() Set the drawable.
required() Mark input as required.
changeListener() Set listener to observe changes.
resultListener() Set listener for final value.

InputEditText

Function Action
hint() Set the hint text.
defaultValue() Set default text.
inputType() Set the android.text.InputType's.
inputFilter() Set the android.text.inputFilter
maxLines() Set the max amount of lines.
endIconMode() Set TextInputLayout.EndIconMode.
endIconActivated() Set the EndIcon activated.
passwordVisible() Make the password initially visible or invisible.
validationListener() Validate the text input with your own logic.

InputCheckBox

Function Action
text() Set the text.
defaultValue() Set default value.

InputRadioButtons

Function Action
options() Set a list of RadioButton options.
selected() Set a selected index.

InputSpinner

Function Action
noSelectionText() Set the text that is displayed, when nothing is selected.
options() Set a list of options.
selected() Set a selected index.

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📆<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
  }
Function Action
selectionMode() Choose the selection mode (date or range).
calendarMode() Choose the calendar mode (week with various rows or month-view).
disableTimeline()  Disable either past or future dates.
rangeYears() Set the range of years into past and future.
disable() Pass a Calendar object to disable various dates for selection.
displayButtons() Show or hide the buttons view.

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
  }
}
Function Action
defaultView() Select the default color view (Colors from templates or custom).
disableSwitchColorView() Disable to switch between color views.
defaultColor() Set default selected color.
colors() Pass all colors to be displayed in the color templates view.
disableAlpha() Disable alpha colors for custom colors.

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.

  • SheetTitle
  • SheetContent
  • SheetDigit
  • SheetNumericalInput
  • SheetDivider
  • SheetButton
  • SheetEdit
  • SheetRecyclerView
  • SheetValue

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
  })
  ...
}
Function Action
playCoverAnimation() Play the animation.
resumeCoverAnimation() Resume the animation.
pauseCoverAnimation() Pause the animation.
cancelCoverAnimation() Cancel the 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 sheetPrimaryColor, or if not available colorPrimary.

Base

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

<item name="sheetCornerRadius">12dp</item>
<item name="sheetCornerFamily">cut</item>

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

<item name="sheetPrimaryColor">@color/customPrimaryColor</item>
<item name="sheetHighlightColor">@color/customHighlightColor</item>
<item name="sheetBackgroundColor">@color/customBackgroundColor</item>
<item name="sheetDividerColor">@color/customDividerColor</item>
<item name="sheetIconsColor">@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="sheetDisplayHandle">true</item>
<item name="sheetDisplayToolbar">false</item>
<item name="sheetDisplayCloseButton">false</item>

Change the appearance of the title.

<item name="sheetTitleColor">@color/customTitleTextColor</item>
<item name="sheetTitleFont">@font/font</item>
<item name="sheetTitleLineHeight">@dimen/dimen</item>
<item name="sheetTitleLetterSpacing">value</item>

Change the appearance of the content text.

<item name="sheetContentColor">@color/customContentTextColor</item>
<item name="sheetContentInverseColor">@color/customContentTextInverseColor</item>
<item name="sheetContentFont">@font/font</item>
<item name="sheetContentLineHeight">@dimen/dimen</item>
<item name="sheetContentLetterSpacing">value</item>

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

<item name="sheetValueTextActiveColor">@color/customValueTextColor</item>
<item name="sheetValueFont">@font/font</item>
<item name="sheetValueLineHeight">@dimen/dimen</item>
<item name="sheetValueLetterSpacing">value</item>

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

<item name="sheetDigitColor">@color/customDigitTextColor</item>
<item name="sheetDigitFont">@font/font</item>
<item name="sheetDigitLineHeight">@dimen/dimen</item>
<item name="sheetDigitLetterSpacing">value</item>

Buttons

Override the appearance of the button text.

<item name="sheetButtonTextFont">@font/font</item>
<item name="sheetButtonTextLetterSpacing">value</item>

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

<item name="sheetButtonColor">@color/customButtonColor<item>
<item name="sheetButtonTextFont">@font/font<item>
<item name="sheetButtonTextLetterSpacing">value<item>
<item name="sheetButtonCornerRadius">12dp<item>
<item name="sheetButtonCornerFamily">cut<item>
<item name="sheetButtonWidth">match_content/wrap_content<item>

Override the appearance of the negative button.

<item name="sheetNegativeButtonType">text_button/outlined_button/button<item>
<item name="sheetNegativeButtonCornerRadius">12dp<item>
<item name="sheetNegativeButtonCornerFamily">cut<item>

Override the appearance of the positive button.

<item name="sheetPositiveButtonType">text_button/outlined_button/button<item>
<item name="sheetPositiveButtonCornerRadius">12dp<item>
<item name="sheetPositiveButtonCornerFamily">cut<item>

Override the border appearance of the outlined button.

<item name="sheetButtonOutlinedButtonBorderColor">@color/borderColor<item>
<item name="sheetButtonOutlinedButtonBorderWidth">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="sheetNegativeButtonBottomLeftCornerRadius">4dp<item>
<item name="sheetNegativeButtonBottomLeftCornerFamily">cut<item>
...
<item name="sheetPositiveButtonBottomRightCornerRadius">8dp<item>
<item name="sheetPositiveButtonBottomRightCornerFamily">rounded<item>

Handle

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

<item name="sheetHandleCornerRadius">8dp</item>
<item name="sheetHandleCornerFamily">rounded</item>
<item name="sheetHandleFillColor">?sheetPrimaryColor</item>
<item name="sheetHandleBorderColor">?sheetPrimaryColor</item>
<item name="sheetHandleBorderWidth">1dp</item>
<item name="sheetHandleWidth">42dp</item>
<item name="sheetHandleHeight">4dp</item>

OptionsSheet

Override appearance of selected options.

<item name="sheetOptionSelectedImageColor">@color/customSelectedOptionImageColor</item>
<item name="sheetOptionSelectedTextColor">@color/customSelectedOptionTextColor</item>

Override appearance of disabled options.

<item name="sheetOptionDisabledImageColor">@color/customDisabledOptionImageColor</item>s
<item name="sheetOptionDisabledTextColor">@color/customDisabledOptionImageColor</item>
<item name="sheetOptionDisabledBackgroundColor">@color/customDisabledOptionBackgColor</item>

InputSheet

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

<item name="sheetTextInputLayoutCornerRadius">12dp</item>
<item name="sheetTextInputLayoutBottomLeftCornerRadius">12dp</item>
... and for all other corners
<item name="sheetTextInputLayoutEndIconColor">@color/customEndIconColor</item>
<item name="sheetTextInputLayoutHelperTextColor">@color/customHelperTextColor</item>
<item name="sheetTextInputLayoutBoxStrokeColor">@color/customBoxStrokeColor</item>
<item name="sheetTextInputLayoutHintTextColor">@color/customHintTextColor</item>
<item name="sheetTextInputLayoutBoxStrokeErrorColor">@color/customBoxStrokeErrorColor</item>
<item name="sheetTextInputLayoutErrorTextColor">@color/customErrorTextColor</item>

Misc

Showcase

Check out some real apps which use this library.
Feel free to hit me up to include your app here.

  • Sign for Spotify - Playlist and control widgets for Spotify on your home screen. (Uses: Info, Options, Input, Color)

  • Buddha Quotes - A collaborative project to create a Free and Open Source Buddha Quotes app for Android with a focus on privacy. (Uses: Options, Input, Color, Time)

Support this project

  • Leave a Star and tell other devs 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.

Motivation

I created several sheets for my apps Sign for Spotify and Awake in the recent months. I especially wanted to have a 'writable' clock time and duration time picker in form of a sheet This is my first library - I'm happy about any feedback, tips etc. I hope you like it and can make use of it. :)

Credits

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].