All Projects → futuredapp → Hauler

futuredapp / Hauler

Licence: mit
Library with swipe to dismiss Activity gesture implementation

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Hauler

Viewtooltip
A fluent tooltip for Android
Stars: ✭ 1,029 (+216.62%)
Mutual labels:  view, activity
Android Toy
不积跬步 无以至千里
Stars: ✭ 54 (-83.38%)
Mutual labels:  view, activity
drag-to-close
Android library that provides a view group which allows to finish an activity by dragging a view.
Stars: ✭ 69 (-78.77%)
Mutual labels:  view, activity
FigmaConvertXib
FigmaConvertXib is a tool for exporting design elements from figma.com and generating files to a projects iOS .xib / Android .xml
Stars: ✭ 111 (-65.85%)
Mutual labels:  view
MessageView
MessageView helps you to create chat message view or a social media message view quickly like a typical chatting application or social post view Its a container view, so you can add any type of message or social post such as TextView or any customize TextView, ImageView, etc.
Stars: ✭ 21 (-93.54%)
Mutual labels:  view
Slidingrootnav
DrawerLayout-like ViewGroup, where a "drawer" is hidden under the content view, which can be shifted to make the drawer visible.
Stars: ✭ 2,939 (+804.31%)
Mutual labels:  view
Androidcomponentplugin
Android上简单实现四大组件的插件化,供学习使用
Stars: ✭ 316 (-2.77%)
Mutual labels:  activity
ActivityManager
一个管理所有Activity的库,可以任意处关闭任意Activity
Stars: ✭ 17 (-94.77%)
Mutual labels:  activity
Supertextview
Hi,Developer,Welcome to use SuperTextView !
Stars: ✭ 3,170 (+875.38%)
Mutual labels:  view
Shapeofview
Give a custom shape to any android view, Material Design 2 ready
Stars: ✭ 2,977 (+816%)
Mutual labels:  view
Inlineactivityresult
Receive the activity result directly after the startActivityForResult with InlineActivityResult
Stars: ✭ 264 (-18.77%)
Mutual labels:  activity
ViewGardiumLeviosa
Makes a view fluctuate.
Stars: ✭ 22 (-93.23%)
Mutual labels:  view
Rskcollectionviewretractablefirstitemlayout
A light-weight UICollectionViewFlowLayout subclass that allows the first item to be retractable.
Stars: ✭ 281 (-13.54%)
Mutual labels:  view
sho
Experimental post-framework view library
Stars: ✭ 47 (-85.54%)
Mutual labels:  view
Stevia
🍃 Concise Autolayout code
Stars: ✭ 3,182 (+879.08%)
Mutual labels:  view
mvp with dagger
How presenters survive Activity recreations on configuration changes with Dagger2
Stars: ✭ 29 (-91.08%)
Mutual labels:  activity
Uumarqueeview
[iOS]Customizable marquee view. #Marquee,MarqueeView,跑马灯,滚屏,上翻,左滑,多行,自定义
Stars: ✭ 295 (-9.23%)
Mutual labels:  view
Incrementproductview
Interesting concept of products incrementation
Stars: ✭ 262 (-19.38%)
Mutual labels:  view
Uilibrary
平时项目开发中写的自定义Drawable、View和Shape
Stars: ✭ 260 (-20%)
Mutual labels:  view
Android Toggle
Custom Switches for Android
Stars: ✭ 266 (-18.15%)
Mutual labels:  view

Hauler

Download minSdk:21 Android Arsenal Check Master License

Hauler is an Android library containing custom layout which enables to easily create swipe to dismiss Activity. Implementation is based on code from project Plaid.

Alt text

Installation

dependencies {
    implementation("com.thefuntasty.hauler:core:latestVersion")

    // optional dependency with set of Data Binding adapters
    implementation("com.thefuntasty.hauler:core:databinding:latestVersion")
}

Features

Hauler library comes with highly customizable HaulerView which provides swipe to dismiss functionality. It also ships with databinding module which contains Binding Adapters for smoother experience with Android Data Binding implementation.

Usage

Activity which is meant to be dismissed must contain HaulerView as a root view and NestedScrollView (or other View what supports nested scroll) as its child. Make sure your NestedScrollview's attribute android:fillViewport is set to true otherwise it might not behave as expected:

<com.thefuntasty.hauler.HaulerView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/haulerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    <androidx.core.widget.NestedScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fillViewport="true">
            
            <!-- your layout-->
            
    </androidx.core.widget.NestedScrollView>
</com.thefuntasty.hauler.HaulerView>           

Secondly, define translucent floating Theme and assign it to the Activity you want to give dismiss ability:

<style name="AppTheme.Draggable" parent="Theme.AppCompat.Light.NoActionBar">
       <item name="android:colorBackgroundCacheHint">@null</item>
       <item name="android:windowContentOverlay">@null</item>
       <item name="android:windowIsFloating">false</item>
       <item name="android:windowIsTranslucent">true</item>
       <item name="android:windowNoTitle">true</item>
       <item name="android:windowBackground">@color/dark_gray</item>
</style>
<activity
        android:name=".draggable.SimpleUsageActivity"
        android:theme="@style/AppTheme.Draggable"/>

Set onDragDismissListener to react properly to user dismiss request. Example implementation might look like this:

    override fun onCreate(savedInstanceState: Bundle?) {
        // ...

        haulerView.setOnDragDismissedListener {
            finish() // finish activity when dismissed
        }
    }

Customization

There are few styleable attributes you might want to use to customize your HaulerView:

<com.thefuntasty.hauler.HaulerView
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       app:dragDismissDistance="112dp"
       app:dragDismissFraction="0.9"
       app:dragElasticity="0.7"
       app:dragDismissScale="0.95"/>
Attribute name Type Default value Description
app:dragDismissDistance dimen 100dp Distance which should be View swiped to consider Activity as dismissed
app:dragDismissFraction float unspecified <0;1> - Fraction of View's height we should reach swiping to consider Activity as dismissed
app:dragElasticity float 0.8 <0;1> - Toughness of swipe. Higher value indicates more rigid feeling
app:dragDismissScale float 0.95 <0;1> - Scale factor of View while performing swipe action
app:dragUpEnabled boolean false Flag indicating if drag up dismiss gesture is enabled
app:fadeSystemBars boolean true Flag indicating if system bars (status & navigation) fades while dismiss is in progress

Attributes dragDismissDistance and dragDismissFraction are exclusive. Do not use them together.

License

Hauler is available under the MIT license. See the LICENSE file for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].