SlidingDrawer


Source link: https://github.com/PierfrancescoSoffritti/SlidingDrawer

SlidingDrawer

A custom View implementing the bottom sheet pattern.
This ViewGroup can have only 2 children. The 1st one is the non slidable view ; the 2nd is the slidable view, which can slide over the non slidable view.

The substantial difference from all other implementations is that in this case is easy to position the slidable view relative to the non slidable view.
In other implementations the only way to control the position of the slidable view, when collapsed, is by using a peek factor.
Here instead the slidable view is placed exactly below the non slidable view, just like in a vertical LinearLayout. The slidable view is conceptually part of the hierarchy and it's not above it.

Download the sample app here

Apps using this library: Shuffly


Download

Add this to you project-level build.gradle:

allprojects {

repositories {

  ...
  maven {
 url "https://jitpack.io" 
}

}
 
}
 

Add this to your module-level build.gradle:

dependencies {

compile 'com.github.PierfrancescoSoffritti:SlidingDrawer:0.10' 
}
 

Usage

<com.pierfrancescosoffritti.slidingdrawer.SlidingDrawer
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:elevation="4dp" >

<LinearLayout

 android:id="@id/non_slidable_view"

 android:layout_width="match_parent"

 android:layout_height="wrap_content" >

  <TextView

  android:layout_width="wrap_content"

  android:layout_height="100dp"

  android:text="non slidable content" />

  </LinearLayout>
 <FrameLayout

 android:id="@id/slidable_view"

 android:layout_width="match_parent"

 android:layout_height="match_parent" >

  <TextView

  android:id="@+id/drag_view"

  android:layout_width="match_parent"

  android:layout_height="100dp"

  android:text="drag me"

  android:clickable="true" />
 </FrameLayout>  </com.pierfrancescosoffritti.slidingdrawer.SlidingDrawer> 

It's important to set the id attribute to android:id="@id/non_slidable_view" for the non slidable view and to android:id="@id/slidable_view" for the slidable view.

When you use this ViewGroup remember to always add a drag view slidingDrawer.setDragView(view);
The drag view is the only surface from which the slidable view can be dragged. The drag view must be clickable.

In case the slidable view has different views when collapsed ( collapsed view) or expanded ( expanded view), and the collapsed view isn't a List (or equivalent), it should have the id android:id="@id/sliding_drawer_collapsed_view", so the SlidingDrawer can adjust the view's paddingBottom to prevent its content from going offscreen.

Resources

Thin wrapper for managing periodic sync with ContentResolver.

Just another logging framework. Multiple combinable logging classes. Combine local logging with rolling file logging with Crashlytics with NewRelic...

Android UI Automator to JUnit Format Converter.

Reads Android UI automator file outout and write a JUNIT Xml file. For example for usage in CI server as Jenkins.

Write less code! Don't inflate views, menus, preferences manually anymore!

A software analytics tool suite used by developers, ops, and software companies to understand how your applications are performing in development and production.

The main Gravatar-android feature is a simple and fluid API. It fully supports Gravatar image requests as described in the official documentation and automatically computes the request URL.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes