• Stars
    star
    1,299
  • Rank 36,217 (Top 0.8 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 9 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Animate your activity!

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.

More Repositories

1

Cult

Toolbar is so boring
Java
483
star
2

PrismView

ViewHelper to provide one activity applications
Java
148
star
3

RecyclerRenderers

RecyclerView is love
Java
98
star
4

ThreadExecutor

Implement executors on your application
Kotlin
23
star
5

Amazing-MVP

Working here...
Java
14
star
6

simdjson-cocoa

C++
5
star
7

M

Media Player for Android and FirefoxOs, not for iOS.
Java
5
star
8

Swinjected

Sample app that provides a MVP structure using Swinject that allow a clean architecture
Swift
5
star
9

ruqqus-rust

SQLPL
5
star
10

pagarme-android

Pagar.me's Android API
Java
4
star
11

TextureView-Sample

TextureView sample with possibility to stream video and audio
Java
4
star
12

meilisearch-studio

Powerful, fast, and an easy to use search engine
Swift
4
star
13

bitrise-osx-logger

Nice logger on your status bar, fast and comfortable
Swift
4
star
14

xxyyzz

Java
4
star
15

GeradorGoiaba

Java
4
star
16

okoshi

OkHttp + Moshi
Kotlin
3
star
17

O-sul-meu-pais

Source code of O Sul é Meu País application
3
star
18

kotlin-native-blockchain

Kotlin
3
star
19

Mocky

Mocky makes mockies more monckerful
Java
3
star
20

Abstractor

Code less, do more
Java
3
star
21

Bound

https://dribbble.com/shots/2106614-GIF-Mobile-App-Profile-View?list=animated&sort=popular&timeframe=now&offset=87
Java
3
star
22

ESP32-ST7789V

Tutorial to connect the Waveshare display ST7789V to the ESP32
C
3
star
23

Afresco

A tiny wrapper around Fresco library!
Java
2
star
24

HeroinPlayer

A tiny wrapper around AVPlayer!
Objective-C
2
star
25

chaos-face

Written in Kotlin!
Kotlin
2
star
26

Mirage

Mirage is a social network to look for interesting places around with augmented reality geolocation.
Java
2
star
27

Temor

AccountManager made easy
2
star
28

how-not-to-be-a-shame

How to be a good developer :)
2
star
29

SmallProject

Actual size: 218kb!
Java
2
star
30

bank_fix

Shell
2
star
31

ipcamera-for-android

Automatically exported from code.google.com/p/ipcamera-for-android
Java
2
star
32

Calculator

Faster than wind...
Java
1
star
33

AlpacaServer

Written in Swift, running on AWS. Empty right now, only here.
1
star
34

PagerListView

Java
1
star
35

HojeSextaFeira-Android

Everyday is Sexta-Feira
1
star
36

Ledge

Floating Toolbar!
Java
1
star
37

binance-bot

Rust
1
star
38

NoSqlBattle

Test performance of NoSQL libraries for Android
Java
1
star
39

Oculos-Opressor

Coxinhas, coxinhas, coxinhas.
Java
1
star
40

rust-sample

CARGO and an shameful implementation of HTTP, I will be happy if you understand.
C++
1
star
41

SimpleToolbarSlider

A simple implementation of Collapsible Toolbar
Java
1
star
42

kaldi-crash

C++
1
star
43

NonExistentClass

Dagger + Kotlin = NonExistentClass
1
star
44

Godo

C#
1
star