Animate your activity!

Related tags

Layout Dragger
Overview

Logo 1

Build Status Android Arsenal JitPack Join the chat at https://gitter.im/ppamorim/Dragger

Warning

This library is not in development anymore, but we are accepting PRs or successors if anyone is interested.


If you want to use these transitions with fragments, take a look at PrismView library!

The library was created in order to provide new animations for activities on Android. Using the ViewDragHelper class, it is possible to create smooth animations that allow full control of the view by the user.

This new component has been created using some concepts described on Flavien Laurent Blog and Denevell Blog.

Dragger now uses Rebound(tiny, 41.7kb) from Facebook to provide more realistic animations and improve performance for old devices.

This library should work on API 10 (but not tested yet).

Demo 1

Usage

You can use this library like a view, you just need to do the following:

    1. Add ''DraggerView'' view to your root layout and add two layouts inside it. You can add a shadow view if you want (the first one) and it needs to be invisible.
<com.github.ppamorim.library.DraggerView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    dragger_layout:drag_view_id="@+id/drag_view"
    dragger_layout:shadow_view_id="@+id/shadow_view"
    dragger_layout:drag_position="top">

    <FrameLayout
          android:id="@+id/shadow_view"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:background="@color/transparent"
          android:visibility="invisible"/>

    <LinearLayout
          android:id="@+id/drag_view"
          android:layout_width="match_parent"
          android:layout_height="match_parent"/>

</com.github.ppamorim.library.DraggerView>

In your ''styles'' file, you need a config like this:

<style name="YourTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="android:windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="android:windowAnimationStyle">@null</item>
</style>

And your ''manifest'':

<activity
    android:name="com.github.dragger.BaseActivity"
    android:theme="@style/YourTheme"/>

Or, if you need it to be fast:

public class YourActivity extends DraggerActivity {
  @Override public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setShadowView(R.layout.custom_shadow); // It is not necessary, use if you want.
    setContentView(R.layout.layout_content);
  }
}

Now you can control the slide of the view, just use the method expand() when you want.

Some methods that you can use:

setDraggerCallback(DraggerCallback) //Interface that's provides some infos of the animation.
setSlideEnabled(boolean) //Enable or disable the drag, useful to use with ScrollViews.
setHorizontalDragRange(float) //Draggable distance that the draggableView can use, horizontally.
setVerticalDragRange(float) //Draggable distance that the draggableView can use, vertically.
setRunAnimationOnFinishInflate(boolean) //Run the initial animation, useful if you only want the drag function.
setDraggerLimit(float) //Set the max limit drag, default is 0.5 (center of the screen).
setDraggerPosition(DraggerPosition) //Set the position of archor.
setTension(float) //Tension of the animation. This represent with the friction, how much time the animation will be executed.
setFriction(float) //Friction of the animation. This represent with the tension, how much friction is applied at the tension animation.
show() //Show the drag view with Rebound animation.
closeActivity() //Simply close the activity with Rebound animation, based of the DraggerPosition choosen.

Sample

Get it on Google Play

Import dependency

This library use appcompat-v7:23.1.0.

But why not to add in MavenCentral? Because it is so much bureaucratic.

JitPack is there and is the future!

Into your build.gradle:

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

dependencies {
  implementation 'com.github.ppamorim:dragger:1.2'
}

Will you use with lists(RecyclerView, List/GridView, ScrollView)?

I decided that need to be Out-Of-Box, then... You must use the Android-ObservableScrollView, like this:

dependencies {
  implementation 'com.github.ksoichiro:android-observablescrollview:VERSION'
}
public void configRecyclerView() {
  ...
  recyclerView.setScrollViewCallbacks(onObservableScrollViewCallbacks);
}

private ObservableScrollViewCallbacks onObservableScrollViewCallbacks =
    new ObservableScrollViewCallbacks() {
  @Override public void onScrollChanged(int scrollY, boolean firstScroll,
      boolean dragging) {
    draggerView.setSlideEnabled(scrollY != 0);
  }
  @Override public void onDownMotionEvent() { }
  @Override public void onUpOrCancelMotionEvent(ScrollState scrollState) { }
};

Contributors

This was only possible because Pedro Vicente Gómez Sánchez helped me and I am very grateful for that! Thank you. :) And thank you Facebook for provide Rebound library!

Developed By

Add me to Linkedin

Libraries used on the sample project

License

Copyright 2015 Pedro Paulo de Amorim

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.
Comments
  • Problems with Jitpack Dependency

    Problems with Jitpack Dependency

    When I add dependecie Jitpack I get this error in Android Studio.

    Error:A problem occurred configuring project ':app'.

    Artifact 'appcompat-v7.jar (com.android.support:appcompat-v7:22.1.0)' not found. Searched in the following locations: https://jitpack.io/com/android/support/appcompat-v7/22.1.0/appcompat-v7-22.1.0.jar

    opened by LuizGadao 14
  • Error:Could not find com.github.ppamorim:dragger:1.2.

    Error:Could not find com.github.ppamorim:dragger:1.2.

    Below code is repositories of my build.gradle(project)

    repositories { maven { url "https://jitpack.io" } mavenCentral() jcenter() maven { url 'http://ksoap2-android.googlecode.com/svn/m2-repo' } // <-- added for ksoap maven { url "https://oss.sonatype.org/content/repositories/snapshots" } }

    opened by zeshaoaaa 4
  • demo app is incompatible

    demo app is incompatible

    I have a Nexus7 and a Nexus 4 both running lollipop (5.0.2) and your demo app is incompatible. I wanted to check out the sample app before trying this library.

    opened by prashantwosti 4
  • Fix the slide workaround when activity start

    Fix the slide workaround when activity start

    Fix the slide workaround! When start activity, I've to hide the view, slide it to requested position, show this view again and do the correct animation. Can be possible to set to slide position without animation and slide it with ViewDragHelper?

    https://github.com/ppamorim/Dragger/blob/master/library/src/main/java/com/github/ppamorim/library/DraggerView.java#L296-314

    opened by ppamorim 2
  • startActivity from DraggerActitiy is not working

    startActivity from DraggerActitiy is not working

    My app have 3 Activities

    • Main : android.support.v7.app.AppCompatActivity
    • Second : DraggerActivity
    • Third : android.support.v7.app.AppCompatActivity

    When I call

     Intent intent = new Intent(MainActivity.this, SecondActivity.class);
     startActivity(intent);
    

    second is correctly lunched by when I call

     Intent intent = new Intent(SecondActivity,this, ThirdActivity.class);
     startActivity(intent);
    

    it doesn't work. any thoughts?

    opened by rkmax 1
  • Android package was not found in the current repository

    Android package was not found in the current repository

    Project didn't compile when adding the following repository

    repositories {
      maven {
        url "https://github.com"
      }
    }
    

    It worked however switching to Jitpack , details here : https://jitpack.io/#ppamorim/Dragger

    opened by amaboura 1
  • Conflict with view pager

    Conflict with view pager

    I set dragger position to DraggerPosition.TOP inside my activity which also has a view pager, swiping the view pager left and right conflicts with the sliding effect of the dragger, which makes it very hard to swipe the pages of the view pager.

    help wanted 
    opened by silviahisham 1
  • error in gradle

    error in gradle

    Today when I put 'compile 'com.github.ppamorim:dragger:1.1' in my dependencies, It show me this Error:(23, 13) Failed to resolve: com.github.ppamorim:dragger:1.1 Show in File
    Show in Project Structure dialog

    Is that some wrong in my AS or?

    opened by HyperSimon 1
  • GitHub release

    GitHub release

    Hi! Cool to see you're using JitPack! Would be a bit easier to use if Dragger had a GitHub release https://github.com/ppamorim/Dragger/releases

    then that could be used as a version instead of a commit id.

    opened by jitpack-io 1
  • Will this work with targerSdkVersion 27 ?

    Will this work with targerSdkVersion 27 ?

    My minSdkVersion is 21 and targerSdkVersion is 27. Will this work with my project ?

    About 1 month ago tried to use this in my project. And when gradle build ran, got an error.

    Today, I tried again and got the same error which is Failed to resolve: com.github.ppamorim:dragger:1.2.

    I am done with this now. Please help.

    opened by DetainedDeveloper 0
  • Error:Execution failed for task ':app:compileDebugJavaWithJavac'. > java.lang.NoClassDefFoundError: dagger/Provides

    Error:Execution failed for task ':app:compileDebugJavaWithJavac'. > java.lang.NoClassDefFoundError: dagger/Provides

    I get this exception when I try to build project. I have posted it on stackoverflow . I am posting it here as well for help. I am stuck at this issue and need help.

    opened by manju115 0
  • IllegalArgumentException: Pointer index out of range

    IllegalArgumentException: Pointer index out of range

    Hello, I get this error randomly in my log files, do you have any idea why does it happen? Thanks.

    Fatal Exception: java.lang.IllegalArgumentException: pointerIndex out of range pointerIndex=-1 pointerCount=1 at android.view.MotionEvent.nativeGetAxisValue(MotionEvent.java) at android.view.MotionEvent.getX(MotionEvent.java:2072) at android.support.v4.view.MotionEventCompatEclair.getX(MotionEventCompatEclair.java:32) at android.support.v4.view.MotionEventCompat$EclairMotionEventVersionImpl.getX(MotionEventCompat.java:110) at android.support.v4.view.MotionEventCompat.getX(MotionEventCompat.java:462) at com.github.ppamorim.dragger.ViewDragHelper.processTouchEvent(ViewDragHelper.java:1161) at com.github.ppamorim.dragger.DraggerView.onTouchEvent(DraggerView.java:198) at android.view.View.dispatchTouchEvent(View.java:9399) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2549) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2240) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2555) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2555) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2555) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2555) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2555) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254) at com.android.internal.policy.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2469) at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1785) at android.app.Activity.dispatchTouchEvent(Activity.java:2867) at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60) at com.android.internal.policy.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2430) at android.view.View.dispatchPointerEvent(View.java:9619) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4471) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4337) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3869) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3922) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3888) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4014) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3896) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4071) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3869) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3922) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3888) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3896) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3869) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6170) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6144) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6105) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6286) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:192) at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(InputEventReceiver.java) at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:181) at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:6244) at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:6317) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:886) at android.view.Choreographer.doCallbacks(Choreographer.java:698) at android.view.Choreographer.doFrame(Choreographer.java:627) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:872) at android.os.Handler.handleCallback(Handler.java:743) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:150) at android.app.ActivityThread.main(ActivityThread.java:5665) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:822) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:712)

    opened by silviahisham 1
  • Disable opening activity animation

    Disable opening activity animation

    Hi, how can i disable animation when i opening activity or panel? i want to have animation of swipe to close when i want to close activity or panel,

    Thanks

    opened by pishguy 0
  • Edge width for sliding

    Edge width for sliding

    Is there a way to define the width of the edge (to slide)? Currently I am able to drag and close activity from any part of the screen. If edge can be fixed, only a part of screen can be dragged.

    opened by seshuvinay 1
  • custome size activity

    custome size activity

    Hi thanks for the library :) would you please help me on how to create a custom size activity with dragger? something like popup! I changed the width and height and its ok! but the problem is the darker shaddow behind the activity! how to remove the shadow? I want to resize my activity in tablet size...

    thanks in advance...

    opened by MohsenShafiee 2
Releases(1.2)
Owner
Pedro Paulo Amorim
Pedro Paulo Amorim
SwipeBack is an android library that can finish a activity by using gesture.

SwipeBack SwipeBack is a android library that can finish a activity by using gesture. You can set the swipe direction,such as left,top,right and botto

Eric 1.7k Nov 21, 2022
Navigation Drawer Activity with material design style and simplified methods

MaterialNavigationDrawer Navigation Drawer Activity with material design style and simplified methods       It requires 10+ API and android support v7

Fabio Biola 1.6k Dec 30, 2022
ViewHelper to provide one activity applications

PrismView provides animations for your views, similar to Dragger, but with fragments! You can change the fragment of the PrismView any time. Usage Ext

Pedro Paulo Amorim 149 Apr 24, 2022
Android Activity 滑动返回。支持微信滑动返回样式、横屏滑动返回、全屏滑动返回

?? BGASwipeBackLayout-Android ?? 强烈建议与 StatusBarUtil 结合着一起使用 常见问题与反馈 1.使用透明主题时,滑动返回看见了 Launcher 保证栈底 Activity 的主题是不透明的。例如 demo 中的首个 Activity 是 SplashA

王浩 2.3k Nov 25, 2022
Repositório para criar layouts e chamar na activity main e melhorar um dos pontos fracos meu (layout).

Repositório para criar layouts e chamar na activity main e melhorar um dos pontos fracos meu (layout). Não se preocupe com os tipos malucos de layouts

Murillo Alves da Silva 1 Dec 14, 2021
Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your development.

Bubbles for Android Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your

Txus Ballesteros 1.5k Jan 2, 2023
[Archived] Highlight the best bits of your app to users quickly, simply, and cool...ly

ShowcaseView The ShowcaseView (SCV) library is designed to highlight and showcase specific parts of apps to the user with a distinctive and attractive

Alex Curran 5.6k Dec 16, 2022
An elegant way to show your menu or messages.

Android View Hover In my opinion, jumping to a new activity to show your menu is a kind of wasting time and life. So, I think, we need a hover view, t

代码家 3.2k Dec 6, 2022
This library provides a simple way to add a draggable sliding up panel (popularized by Google Music and Google Maps) to your Android application. Brought to you by Umano.

Note: we are not actively responding to issues right now. If you find a bug, please submit a PR. Android Sliding Up Panel This library provides a simp

Umano: News Read To You 9.4k Dec 31, 2022
You don’t want your apps look and feel boring, do you? Add some bubbles!

#BubbleAnimationLayout Say hello to Bubble Animation Layout for Android by Cleveroad You don’t want your apps look and feel boring, do you? Add some b

Cleveroad 576 Nov 23, 2022
Draftsman is an on device layout inspector which can be embedded in your android app.

Draftsman Draftsman is an on-device layout inspector for Android apps. It allows you to view various properties of rendered Android Views such as widt

Gojek 243 Dec 22, 2022
Simple way to animate your views on Android with Rx 🚀

This is an Android library to make a simple way to animate your views on Android with Rx.

Lopez Mikhael 583 Dec 9, 2022
Animated-splash-screen - Animate your Splash Screen using Lottie files.

Animated Splash Screen This small project shows how you can add animation into your android projects or create beautiful looking Splash Screen or Laun

Aashish Ace 0 Jan 2, 2022
💪 Rich Android Path. 🤡 Draw as you want. 🎉 Animate much as you can.

?? Rich Android Path. ?? Draw as you want. ?? Animate much as you can. Download sample app: Features Full Animation Control on Paths and VectorDrawabl

Ahmed Tarek 2.3k Dec 20, 2022
Android library to animate Floating Action Button to Bottom Sheet Dialog and vice-versa

FabulousFilter Show some ❤️ and star the repo to support the project This library is the implementation of filter-concept posted on MaterialUp.com. It

Krupen Ghetiya 2.6k Jan 3, 2023
Animate a strike over any image to indicate on/off states. As seen in the Material Guidelines.

StrikedImageView Animate a strike over any image to indicate on/off states. As seen in the Material Guidelines. Gradle allprojects { repositories

null 9 Sep 21, 2022
POC of how you can animate LazyColumn insertions/deletions/moving

Animated LazyColumn/LazyRow POC of how you can animate LazyColumn/LazyRow insertions/deletions/moving Note, this is not production ready or a library,

Roudi Korkis Kanaan 33 Dec 24, 2022
An exploratory playground library to figure out how to Draw and animate using Jetpack Compose

Jetpack Compose Chart Library This is an exploratory playground library to figure out how to Draw and animate using Android Jetpack Compose library. C

null 2 Sep 8, 2022
Grid Shimmer Animate With JetPack Compose

Grid Shimmer Animate With JetPack Compose

mohamed tamer 2 Jun 19, 2022
Backarrow-animation-example - Animate back arrow to close button in Compose using animated drawables

Animate Back Arrow to Close Icon in Compose This is a simple demo for animated v

Jose Mateo 3 Feb 17, 2022