Giter VIP home page Giter VIP logo

smoothswipeview's Introduction

SmoothSwipeView API

Small customizable view with smooth swipe. There's nothing extra. Supports different view's types.

View has view pool optimizations, dynamic addition/removing. Has fine performance. Supports multi-touch.

Project sample is above.

Work example

View params.

Parameter Description units
onCardBind Called when swipe card on screen should been drawn. Called once for each view and only when view added on screen View - view for initialization, Any - f.e data class with view initialization data (View, Any) -> Unit
onAllCardSwiped Called when card to swipe is running out () -> Unit
onCardSwiped Called for card that was swiped. View - view that was swiped, SwipeDirection - LEFT or RIGHT, Any - view initialization data from onCardBind. (View, Any?, SwipeDirection) -> Unit
onCardSwipingPercentChanged Called when you drag view. Float - is value from 0 to 1 where 0 - view on start position, 1 - view dragged enough for swipe if user release it. SwipeDirection - LEFT or RIGHT (Float, SwipeDirection?) -> Unit
fun swipe You can programatically call view swiping -
fun submitData Function for submit data to display -

Also view has several constants, which you can change for customize view behaviour

Parameter def. value description
MAX_DISTANCE_TO_MOVE_WITHOUT_RESTRICTION_X 150f * screenDensity Max distance where view follow toward finger without deceleration along x axis
MAX_DISTANCE_TO_MOVE_WITHOUT_RESTRICTION_Y 50f * screenDensity Max distance where view follow toward finger without deceleration along y axis
OVERSCREEN_SPACE_X Resources.getSystem().displayMetrics.widthPixels + 200f X position where swiped view removing
MIN_SWIPE_BARRIER_X 80f * screenDensity X position where view will be swiped if user release finger
MAX_ANGLE 20f Max view incline whilst swiping
MIN_DRAG_DECELERATION_SPEED_COEFFCIENT 0.7f Show how speed will be decrease after overcome MAX_DISTANCE_TO_MOVE_WITHOUT_RESTRICTION_X or MAX_DISTANCE_TO_MOVE_WITHOUT_RESTRICTION_Y bounds
COMPLETE_SWIPE_ANIMATION_DURATION_MS 300L Animation duration when view was swiped
AUTOSWIPE_ANIMATION_DURATION_MS 400L Animation duration when view was swiped programmatically
EXIT_FROM_SCREEN_CARD_ANIMATION_DURATION_MS 300L Animation duration that restoring start view position when it was released before reach swipe's bound
LAYOUT_CARD_STACK_SIZE 4 Permanent card quantity on screen. Should be more that 1. You need card for display when top view is swiping

smoothswipeview's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

sonpxp

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.