Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

An Android library for display list and be able to select the item as BottomSheet.

License

NotificationsYou must be signed in to change notification settings

minibugdev/SheetSelection

Repository files navigation

Jitpack SheetSelectionAndroid ArsenalGitHub license

SheetSelection is an Android library for display list and be able to select the item as aBottomSheet.

Sheet Selection

Installation

Add it in yourrootbuild.gradle at the end of repositories:

repositories {..    maven { url'https://jitpack.io' }}

Add the dependency

dependencies {    implementation'com.github.minibugdev:sheetselection:0.0.3'}

How to use

Sheet Selection

val items=listOf(SheetSelectionItem("1","Item #1",R.drawable.ic_extension),SheetSelectionItem("2","Item #2",R.drawable.ic_nature),SheetSelectionItem("3","Item #3",R.drawable.ic_fingerprint),SheetSelectionItem("4","Item #4",R.drawable.ic_face))SheetSelection.Builder(context)    .title("Sheet Selection")    .items(items)    .selectedPosition(2)    .showDraggedIndicator(true)    .searchEnabled(true)    .searchNotFoundText("Nothing!!")    .onItemClickListener { item, position->// DO SOMETHING    }    .show()

Configurations

  • Set title byBuilder.title(String). It will hide when set toNULL orempty string.
  • Set items byBuilder.items(List<SheetSelectionItem>).
  • Set selected item byBuilder.selectedPosition(Int). default isSheetSelection.NO_SELECT
  • Show dragged indicator byBuilder.showDraggedIndicator(Boolean). default isfalse
  • Set search enabled byBuilder.searchEnabled(Boolean). default isfalse
  • Set search not found text byBuilder.searchNotFoundText(String). default isSearch not found.
  • Set custom theme byBuilder.theme(@StyleRes).
  • To handle the item click listener byBuilder.onItemClickListener().

Customize your own style

Sheet Selection

1.Define your theme and style

Add your theme and style tostyles.xml or wherever you want.

1. Title text styleparent must beWidget.SheetSelection.Title eg.

<stylename="Widget.Custom.SheetSelection.Title"parent="@style/Widget.SheetSelection.Title">    <itemname="android:textAppearance">@style/TextAppearance.MaterialComponents.Headline5</item>    <itemname="android:gravity">center</item></style>

2. Item text styleparent must beWidget.SheetSelection.Item eg.

<stylename="Widget.Custom.SheetSelection.Item"parent="@style/Widget.SheetSelection.Item">    <itemname="android:textAppearance">@style/TextAppearance.MaterialComponents.Caption</item>    <itemname="drawableTint">@color/colorPrimary</item></style>

3. Indicator styleparent must beWidget.SheetSelection.Indicator eg.

<stylename="Widget.Custom.SheetSelection.Indicator"parent="@style/Widget.SheetSelection.Indicator">    <itemname="android:layout_marginTop">48dp</item></style>

Finally, override SheetSelection attributes by setting your styles to yourTheme (parent must beTheme.SheetSelection)

<!-- Customize SheetSelection theme--><stylename="Theme.Custom.SheetSelection"parent="@style/Theme.SheetSelection">    <itemname="sheetSelection_titleStyle">@style/Widget.Custom.SheetSelection.Title</item>    <itemname="sheetSelection_itemStyle">@style/Widget.Custom.SheetSelection.Item</item>    <itemname="sheetSelection_indicatorStyle">@style/Widget.Custom.SheetSelection.Indicator</item>    <itemname="sheetSelection_indicatorColor">@color/colorAccent</item></style>

2. Apply your Theme to SheetSelection

SheetSelection.Builder(this)    .theme(R.style.Theme_Custom_SheetSelection)..    .show()

License

MIT LicenseCopyright (c) 2020 Teeranai.PPermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.

About

An Android library for display list and be able to select the item as BottomSheet.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp