### Extend DraggerActivity for Quick Integration Source: https://github.com/ppamorim/dragger/blob/master/README.md This Java code snippet shows a quick way to integrate the Dragger library into your Android activity. By extending `DraggerActivity`, you gain access to its dragging capabilities. You can optionally set a custom shadow view and then set your content view. ```java 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); } } ``` -------------------------------- ### Configure Android Theme for Dragger Library Source: https://github.com/ppamorim/dragger/blob/master/README.md This Android style configuration is essential for the Dragger library's activity transitions. It sets the activity window to be translucent, removes the default window background and title, and disables the default window animation, allowing Dragger to manage the visual transitions. ```xml ``` -------------------------------- ### Dragger Library API Methods Reference Source: https://github.com/ppamorim/dragger/blob/master/README.md This section outlines the key methods available for controlling the behavior and animation of the DraggerView or DraggerActivity. These methods allow customization of drag sensitivity, animation properties, and interaction callbacks. ```APIDOC setDraggerCallback(DraggerCallback) Description: Sets an interface to receive information about the animation progress. setSlideEnabled(boolean) Description: Enables or disables the drag functionality. Useful when integrating with ScrollViews. setHorizontalDragRange(float) Description: Sets the maximum horizontal distance the draggable view can move. setVerticalDragRange(float) Description: Sets the maximum vertical distance the draggable view can move. setRunAnimationOnFinishInflate(boolean) Description: Determines if the initial animation should run when the view is inflated. Useful if only drag functionality is desired. setDraggerLimit(float) Description: Sets the maximum drag limit, expressed as a ratio (default is 0.5, representing the center of the screen). setDraggerPosition(DraggerPosition) Description: Sets the anchor position from which the dragging originates. setTension(float) Description: Configures the tension of the Rebound animation. This value, along with friction, influences the animation's duration. setFriction(float) Description: Configures the friction of the Rebound animation. This value, along with tension, influences the animation's damping. show() Description: Displays the draggable view with a Rebound animation. closeActivity() Description: Closes the current activity with a Rebound animation, based on the chosen DraggerPosition. ``` -------------------------------- ### Add Dragger Library Dependency via JitPack Source: https://github.com/ppamorim/dragger/blob/master/README.md This Groovy snippet demonstrates how to include the Dragger library in your Android project using JitPack. You need to add the JitPack Maven repository to your `build.gradle` file and then declare the library as a dependency. ```groovy repositories { maven { url "https://jitpack.io" } } dependencies { implementation 'com.github.ppamorim:Dragger:Tag' // Replace 'Tag' with the latest release tag, e.g., '1.0.0' } ``` -------------------------------- ### Add Dragger Library Gradle Dependency Source: https://github.com/ppamorim/dragger/blob/master/README.md This Gradle dependency integrates the Dragger library into your Android project. Dragger provides a convenient way to implement a drag-to-close gesture for activities, enhancing navigation and user experience. ```Groovy dependencies { implementation 'com.github.ppamorim:dragger:1.2' } ``` -------------------------------- ### Declare Dragger BaseActivity in Android Manifest Source: https://github.com/ppamorim/dragger/blob/master/README.md This manifest entry demonstrates how to declare an activity that utilizes the Dragger library's functionality. It specifies `com.github.dragger.BaseActivity` as the activity class and applies the custom theme configured for translucent window behavior. ```xml ``` -------------------------------- ### Integrate DraggerView into Android Layout Source: https://github.com/ppamorim/dragger/blob/master/README.md This XML snippet demonstrates how to add the `DraggerView` component to your Android layout. It requires two child views: one for the draggable content (identified by `drag_view_id`) and an optional shadow view (identified by `shadow_view_id`). The `drag_position` attribute specifies the initial anchor point for dragging. ```xml ``` -------------------------------- ### Add Android-ObservableScrollView Gradle Dependency Source: https://github.com/ppamorim/dragger/blob/master/README.md This Gradle dependency adds the Android-ObservableScrollView library, which is crucial for Dragger to interact correctly with various scrollable views such as RecyclerView, ListView, or ScrollView. It enables monitoring of scroll events. ```Groovy dependencies { implementation 'com.github.ksoichiro:android-observablescrollview:VERSION' } ``` -------------------------------- ### Integrate Dragger with RecyclerView using ObservableScrollViewCallbacks Source: https://github.com/ppamorim/dragger/blob/master/README.md This Java code demonstrates how to configure a RecyclerView to work with the Dragger library. By implementing ObservableScrollViewCallbacks, the draggerView's slide capability is dynamically controlled, enabling it only when the RecyclerView is scrolled away from the top, preventing conflicts with initial scroll gestures. ```Java 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) { } }; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.