Giter Site home page Giter Site logo

bottomsheet-1's Introduction

#BottomSheet Android Arsenal

screenshot screenshot screenshot screenshot

#Features

  • Both list and grid style
  • Light and Dark theme as well as custom themeing options
  • XML style support
  • Tablet support
  • API 14+

#Using BottomSheet To get started using BottomSheet, first you'll need to create a menu resource file with the defined actions.

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">

    <item
        android:id="@+id/share"
        android:icon="@drawable/ic_share_grey_600_24dp"
        android:title="Share" />

    <item
        android:id="@+id/upload"
        android:icon="@drawable/ic_cloud_upload_grey_600_24dp"
        android:title="Upload" />

    <item
        android:id="@+id/copy"
        android:icon="@drawable/ic_content_copy_grey_600_24dp"
        android:title="Copy" />

    <item
        android:id="@+id/print"
        android:icon="@drawable/ic_print_grey_600_24dp"
        android:title="Print" />

</menu>

Then create a BottomSheet via the Builder interface

new BottomSheet.Builder(getActivity(), R.menu.bottom_sheet)
  .setTitle(R.string.options)
  .setListener(myListener)
  .show();

##Aditional Builder Fields

// Sets the BottomSheet to use the grid style
grid()

// Sets the BottomSheet to use the dark theme
dark()

// If the BottomSheet can be dismiss via the back button or pressing outside 
setCancelable(boolean)

// Sets the menu resource to be used
setSheet(@MenuRes int sheetItems)

// Sets the style 
setStyle(@StyleRes int style)

#Styling BottomSheet comes with both a Light and Dark theme to accomidate most scenarios. However, if you want to customize the color more, you can create your own style and supply it to the builder.

<style name="MyBottomSheetStyle" parent="@style/BottomSheet">
        <item name="bottom_sheet_bg_color">@color/my_color</item>
        <item name="bottom_sheet_title_color">@color/my_color_2</item>
        <item name="bottom_sheet_list_item_color">@color/my_color_3</item>
        <item name="bottom_sheet_grid_item_color">@color/my_color_4</item>
</style>
new BottomSheet.Builder(getActivity(), R.menu.bottom_sheet, R.style.MyBottomSheetStyle)
  .setTitle(R.string.options)
  .setListener(myListener)
  .show();

##Icon Based on the Material Design Guidelines, icons for a linear list styled BottomSheet should be 24dp, where as a grid styled BottomSheet should be 48dp.

#Callbacks BottomSheet uses the BottomSheetListener for callbacks

// Called when the BottomSheet it first displayed
onSheetShown()

// Called when the BottomSheet has been dismissed
onSheetDismissed()

// Called when an item is selected from the BottomSheet
onSheetItemSelected(MenuItem item)

#Including in your project To include BottomSheet in your project, make the following changes to your build.gradle file

Add repository

repositories {
    maven { url 'https://dl.bintray.com/kennyc1012/maven' }
}

Add dependency

dependencies {
    compile 'com.kennyc:bottomsheet:1.1.1'
}

#Contribution Pull requests are welcomed and encouraged. If you experience any bugs, please file an issue

License

Copyright 2015 Kenny Campagna

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.

bottomsheet-1's People

Contributors

kennyc1012 avatar

Watchers

 avatar  avatar

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.