PullableView


Source link: https://github.com/marcorighini/PullableView

PullableView

Enhanced Pull-To-Action layout

Demo

Dependency

Add this in your root build.gradle file ( not your module build.gradle file):

allprojects {
  repositories {

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

  
}
 
}

Then, add the library to your module build.gradle

dependencies {

  compile 'com.github.marcorighini:PullableView:latest.release.here' 
}

Features

  • Pull gesture in UP, DOWN or BOTH directions
  • Scroll thresholding. Bound views are snapped to anchor position if scroll over threshold else are reset to default position
  • Bind views for animating (alpha and translation for now) them in respect to scroll

Usage

There is a sample provided which shows how to use the library. For completeness, here is all that is required to get PullableView working:

<com.marcorighini.lib.PullableView
  android:id="@+id/pullable_view"
  android:layout_width="match_parent"
  android:layout_height="wrap_content">
  .... </com.marcorighini.lib.PullableView>

Attributes

Attributes that may be added to PullableView xml tag or changed programmatically through PullableView properties:

  • anchorOffsetUp : integer corresponding to the anchor point for UP direction pull action. It's represented through the offset compared to the pullable_view top. It must be <= 0. Default: -pullable_view_top
  • anchorOffsetDown : integer corresponding to the anchor point for DOWN direction pull action. It's represented through the offset compared to the pullable_view bottom. It must be >= 0. Default: screen_height - pullable_view_bottom
  • scrollThresholdUp : integer corresponding to the threshold of the UP direction pull action. It must be <= 0. If scroll amount (negative) is below (greater in absolute value) this value bound views will animate to snap value (translation or alpha) else bound views will reset to default values. Default: anchorOffsetUp/2
  • scrollThresholdDown : integer corresponding to the threshold of the DOWN direction pull action. It must be >= 0. If scroll amount is above this value bound views will animate to snap value (translation or alpha) else bound views will reset to default values. Default: anchorOffsetBottom/2
  • direction : enum string value (UP,DOWN,BOTH) enabling pull directions. Default: BOTH

Bound Views and animations

PullableView has the property

var boundViews = listOf<BoundView>()

This represents the views that are animated accordingly to the scroll amount. For example you can change the alpha or translation of these bound views. Note that tipically you have to add pullable_view to this list to have pull-to-refresh like gesture over it.

Check the sample for usage.

Listener

Pullable View has the property

interface PullListener {
  fun onReset()

fun onPullStart()

fun onAnchor() 
}
 var listener: PullListener? = null

Ideally when bound views are snapped to anchor you want to perform some tasks. When tasks are finished you have to call

fun resetAnimated() fun resetImmediate()

over pullable_view for resetting bound views to default positions

License

Copyright 2017 Marco Righini  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. 

Resources

Fontometrics is an Android library which help to use customs font with just writing one line of code avoiding all the hassle to add the .ttf/.otf font files in the assests folder.

Library to help developers build full MVP apps.

A showcase to demonstrate how to use MVP with RXAndroid.

Android floating action button (fab) with text.

Simple and flexible router library for Android platform.

This library is inspired from Zane David's Animation Transition Work on Dribbble.

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