futuredapp / hauler Goto Github PK
View Code? Open in Web Editor NEWLibrary with swipe to dismiss Activity gesture implementation
License: MIT License
Library with swipe to dismiss Activity gesture implementation
License: MIT License
disable: transparent navigation bar onDismiss() ? I don't want it to be transparent
I have the following layout:
<?xml version="1.0" encoding="utf-8"?>
<com.thefuntasty.hauler.HaulerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/haulerView"
app:dragUpEnabled="true"
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">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:fitsSystemWindows="true">
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/dismiss_click_view"
android:background="@color/details_preview_dialog_background" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintWidth_percent="@dimen/details_preview_width_ratio_percentage"
app:layout_constraintHeight_percent="@dimen/details_preview_height_ratio_percentage"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
>
<androidx.cardview.widget.CardView
android:id="@+id/cardView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="8dp"
app:cardCornerRadius="@dimen/details_preview_rounding"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent" >
<androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/totalNumberOfPhotosTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="2/1234"
android:textSize="9sp"
android:layout_margin="-50dp"
android:gravity="center"
android:height="@dimen/badge_size"
android:minWidth="@dimen/badge_size"
android:textColor="@color/badgeTextColor"
android:elevation="10dp"
android:background="@drawable/badge_secondary"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<ProgressBar
android:id="@+id/loadingProgressBar"
style="@style/Widget.AppCompat.ProgressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:elevation="10dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
</com.thefuntasty.hauler.HaulerView>
So a HaulerView with it's NestedScrollView, which contaisn a ViewPager.
It works, but the ViewPager needs to be scrolled exactly in a horizontal way in order to swipe to the next item, otherwise the HaulerView takes the wipe moved a bit up/down.
it there a way of defining the angle or a treshold or something to make the horizontal scroll prior to the vertical scroll, depending on the angle or something?
EDIT: With a maps fragment inside, I can't scroll the map anymore.
I'm not using androidx and get this exception:
2019-01-04 11:18:06.646 8158-8158/com.tandoo.android E/InputEventReceiver: Exception dispatching input event. 2019-01-04 11:18:06.646 8158-8158/com.tandoo.android E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback 2019-01-04 11:18:06.648 8158-8158/com.tandoo.android E/MessageQueue-JNI: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/core/view/animation/PathInterpolatorCompat; at com.thefuntasty.hauler.HaulerView.onStopNestedScroll(HaulerView.kt:115) at android.support.v4.view.ViewParentCompat.onStopNestedScroll(ViewParentCompat.java:258) at android.support.v4.view.NestedScrollingChildHelper.stopNestedScroll(NestedScrollingChildHelper.java:188) at android.support.v4.widget.NestedScrollView.stopNestedScroll(NestedScrollView.java:226) at android.support.v4.widget.NestedScrollView.onInterceptTouchEvent(NestedScrollView.java:783) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2511) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2990) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657) at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:448) at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1829) at android.app.Activity.dispatchTouchEvent(Activity.java:3307) at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69) at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:410) at android.view.View.dispatchPointerEvent(View.java:12015) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4795) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4609) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4147) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4200) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4166) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4293) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4174) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4350) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4147) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4200) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4166) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4174) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4147) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6661) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6635) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6596) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6764) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:186) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:325) at android.os.Looper.loop(Looper.java:142) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.core.view.animation.PathInterpolatorCompat" on path: DexPathList[[zip file "/data/app/com.tandoo.android-s5o0WtJeASia7aIJ0JMucw==/base.apk", zip file "/data/app/com 2019-01-04 11:18:06.648 8158-8158/com.tandoo.android D/AndroidRuntime: Shutting down VM
I would like to totally disable swipe up
Hi,
I am working in a project using java, I want to know how to call this kotlin based interface in my JAVA activity?
Any help would be appreciated
Hi!
My activity uses a ConstraintLayout that should be scrollable. Expected behavior is that when scrolling down in the activity the rest of the constraintLayout content should become visible, however, the hauler view displays the not-drag-dismissable animation.
Here is the view:
<com.thefuntasty.hauler.HaulerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/dragDownDismissView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@style/AppTheme.Draggable"
app:dragUpEnabled="false">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<--rest of view -->
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
</com.thefuntasty.hauler.HaulerView>
When the scale background activity white
It would be great to have possibility to set a drag listener and swipe sensitivity
Hi!
Is it possible to use Hauler together with a Collapsing Toolbar from Material Components? I'm experiencing issues with propagating the scroll event to both Hauler and the toolbar. Seems like one of them will consume the event.
If possible, I would very much like to see an example with best practices.
Thanks.
Thank you for your wonderful library. It works perfectly on smartphones, but it kinda looks problematic on tablets. After dragging activity to dismiss it, foreground activity goes to the right and disappears (while we expect it to go to the bottom not the right). Samsung Galaxy Tab A 10.1 (2016) shows this weird behavior. Is there any workaround for it? Also when i set android:fillViewport="true" in my nestedScrollView, it destroys layout all together.
Hi!
I just started using Hauler and implemented a basic prototype according to the instructions in the readme. On first open it works as expected, but if switching app and going back (going to the multitask app picker and select my app again) the status bar gets black and the navigation bar gets black or starts blinking. I've not used black anywhere in the theme, and the blinking is definitely not supposed to happen. :)
I can provide screenshots and code if neccessary. Tested on Pixel 4XL, android 10.
Thanks for making this excellent library! :)
Today JFrog announced that they're sunsetting Bintray/JCenter - the last day to access these repositories will be 1. May 2021
Alternatives:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.