SwipeBack is an android library that can finish a activity by using gesture.

Overview

SwipeBack Build Status

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 bottom.

Screenshots

image

image

Sample Download

Sample Download

image

Usage

Gradle

dependencies {
   	compile 'com.github.liuguangqiang.swipeback:library:1.0.2@aar'
}

Maven

<dependency>
  	<groupId>com.github.liuguangqiang.swipeback</groupId>
  	<artifactId>library</artifactId>
  	<version>1.0.2</version>
  	<type>aar</type>
</dependency>

SwipeBackActivity

SwipeBackActivity is a base activity for using this library more easier.This Activity will help us to show a shadow.

image

public class CommonActivity extends SwipeBackActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_common);
        setDragEdge(SwipeBackLayout.DragEdge.LEFT);
    }

}

Layout and activity theme.

SwipeBackLayout must contains only one direct child.

<com.liuguangqiang.swipeback.SwipeBackLayout
	xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/swipeBackLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
	
	<!-- SwipeBackLayout must contains only one direct child -->

</com.liuguangqiang.swipeback.SwipeBackLayout>
 <style name="Theme.Swipe.Back" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="windowActionBar">false</item>
        <item name="android:windowNoTitle">true</item>
 </style>

Swipe Direction

You can set DragEdge to change the swipe direction.

 public enum DragEdge {
      	LEFT,
      	
        TOP,
        
        RIGHT,
        
        BOTTOM
    }

Support Views

SwipeBackLayout must contains only one direct child.

Such as:

  • LinearLayout,
  • RelativeLayout,
  • ListView,
  • ViewPager
  • WebView

License

Copyright 2015 Eric Liu

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
  • Sensitivity, DragEdge.VERTICAL and DragEdge.HORIZONTAL

    Sensitivity, DragEdge.VERTICAL and DragEdge.HORIZONTAL

    It will be cool if it will be possible to adjust the sensitivity. A swipe is also simultaneously in different directions, for example DragEdge.VERTICAL and DragEdge.HORIZONTAL.

    opened by KaNcHeR 4
  • add enum DragDirectMode for vertical and horizontal swipe

    add enum DragDirectMode for vertical and horizontal swipe

    Hello. Nice lib! I added enum DragDirectMode for vertical and horizontal swipe.

    This solution will close several issue: https://github.com/liuguangqiang/SwipeBack/issues/34 https://github.com/liuguangqiang/SwipeBack/issues/36 https://github.com/liuguangqiang/SwipeBack/issues/26

    opened by pavel163 2
  • Background screen blank when swipe

    Background screen blank when swipe

    When i was swiping left the activity, the background was blank until complete close of swipe activity.But i want to show background activity on swipe.Any help ??

    opened by riten7 2
  • AppCompat does not support Theme.Swipe.Back features

    AppCompat does not support Theme.Swipe.Back features

    When creating an activity using the SwipeBack theme, the aplication crashes with the following error:

    java.lang.IllegalArgumentException: AppCompat does not support the current theme features: { windowActionBar: false, windowActionBarOverlay: false, android:windowIsFloating: false, windowActionModeOverlay: false, windowNoTitle: false

    Presumably, as a result, swiping back does not show the activity behind it but instead fades it in after the animation completes.

    opened by jacobvisick 1
  • Getting more done in GitHub with ZenHub

    Getting more done in GitHub with ZenHub

    Hola! @pmaingi has created a ZenHub account for the liuguangqiang organization. ZenHub is the leading team collaboration and project management solution built for GitHub.


    How do I use ZenHub?

    To get set up with ZenHub, all you have to do is download the browser extension and log in with your GitHub account. Once you do, you’ll get access to ZenHub’s complete feature-set immediately.

    What can ZenHub do?

    ZenHub adds a series of enhancements directly inside the GitHub UI:

    • Real-time, customizable task boards for GitHub issues;
    • Burndown charts, estimates, and velocity tracking based on GitHub Milestones;
    • Personal to-do lists and task prioritization;
    • “+1” button for GitHub issues and comments;
    • Drag-and-drop file sharing;
    • Time-saving shortcuts like a quick repo switcher.

    Add ZenHub to GitHub

    Still curious? See more ZenHub features or read user reviews. This issue was written by your friendly ZenHub bot, posted by request from @pmaingi.

    ZenHub Board

    opened by pmaingi 1
  • Adding a finish listener

    Adding a finish listener

    On one project I needed to do some tasks after the swipe finish, and not finish the activity immediately. I think the lib allows to do this on someway, but it's not that intuitive. So on this PR I add a onFinishListener to handle this cases.

    opened by juliooa 0
  • Remove attr windowIsTranslucent and add prefix android: before windowActionBar

    Remove attr windowIsTranslucent and add prefix android: before windowActionBar

    Two things

    1. windowIsTranslucent = true worked fine in portrait mode, but not for landscape. Take a look at: Reference It can be possible to add att orientation in AndroidManifest.xml but but it will lead to some unexpected behavior. (for example, onConfigurationChanges...)

    2. windowActionBar ActionBarActivity is deprecated in revision 22.1.0 of the Support Library and so AppCompatActivity. Try with android:windowActionBar for newer library.

    opened by phatnhse 0
  • 向右划与m.astuetz.PagerSlidingTabStrip 控件相冲突

    向右划与m.astuetz.PagerSlidingTabStrip 控件相冲突

    PagerSlidingTabStrip 可以左右滑动 但如果设置了setDragEdge(SwipeBackLayout.DragEdge.LEFT); 导致PagerSlidingTabStrip向右划就失效了

    可否根据用户第一次按下的位置来区分 到底是PagerSlidingTabStrip的切换 or SwipeBackAcitivy的退出?

    opened by Jayin 0
  • Upgrade dependencies in order to work with latest API (32)

    Upgrade dependencies in order to work with latest API (32)

    Upgraded AppCompatActivity dependency and switched from the old Android Support Library the new AndroidX library. These changes allow the library to work with the latest API (32 at the time of this writing). Also set compileSDK and targetSDK to 32 version.

    opened by MariusT-Labs 0
  • How to set trigger area when swiping activity?

    How to set trigger area when swiping activity?

    How to set trigger area when swiping activity? I mean i want to back activity, when i released page from half height or more. For example if i swipe top to bottom a little bit but fast, activity is closes. I dont want to this, I want to back swipe feature run when at least page swipes half of height of activity.

    opened by Mrtckr008 0
  • SwipeBack support fragment

    SwipeBack support fragment

    Thank you for share library

    I have problem with Fragment.

    Could you help me support for swipe on fragment ?

    I saw check this library: https://github.com/ikew0ng/SwipeBackLayout but it don't tap and swipe on middle screen like your library

    opened by tictacpc 0
  • SwipeBack with dialogfragment

    SwipeBack with dialogfragment

    hi thank you for this library

    how can i use it with dialog fragment i put SwipeBackLayout as parent and put other things in it when i call dialog , after swiping app crashes with android.view.ContextThemeWrapper cannot be cast to android.app.Activity

    can you please tell me how to use it with dialog fragment?

    thank you very much

    opened by makhosravi 0
Owner
Eric
Don't reinvent wheel. But you have to learn how to create.
Eric
An Android library that help you to build app with swipe back gesture.

SwipeBackLayout An Android library that help you to build app with swipe back gesture. Demo Apk GooglePlay Requirement The latest android-support-v4.j

ike_w0ng 6.1k Jan 3, 2023
Android Activity 滑动返回。支持微信滑动返回样式、横屏滑动返回、全屏滑动返回

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

王浩 2.3k Nov 25, 2022
Easily add slide to dismiss functionality to an Activity

Slidr Easily add slide-to-dismiss functionality to your Activity by calling Slidr.attach(this) in your onCreate(..) method. Usage An example usage: pu

Drew Heavner 2.7k Dec 29, 2022
Animate your activity!

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 transitio

Pedro Paulo Amorim 1.3k Dec 4, 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
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
A wave view of android,can be used as progress bar.

WaveView ![Gitter](https://badges.gitter.im/Join Chat.svg) A wave view of android,can be used as progress bar. Screenshot APK demo.apk What can be use

Kai Wang 1.3k Dec 28, 2022
A 3D Layout for Android,When you use it warp other view,it can became a 3D view,一秒让你的view拥有3D效果!

ThreeDLayout A 3D Layout,When you use it warp other view,it can became a 3D view 中文文档 preview USAGE 1.compile library allprojects { repositories {

androidwing 490 Oct 27, 2022
Make Android DrawerLayout can be dragged out in real-time within the range of fullscreen

FullDraggableDrawer Make the DrawerLayout can be dragged/pulled out in real-time within the range of fullscreen, like Pure Writer: * Full demo video:

Pure Writer 264 Nov 29, 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
A togglelayout that can be used in setting interface

ToggleExpandLayout A togglelayout that can be used in setting interface. Originally designed by dribbble. And the author said that's why he designed t

Rongchan Liu 893 Dec 6, 2022
Android layout that simulates physics using JBox2D

PhysicsLayout Android layout that simulates physics using JBox2D. Simply add views, enable physics, and watch them fall! See it in action with the sam

John Carlson 689 Dec 29, 2022
A layout to transition between two views using a Floating Action Button as shown in many Material Design concepts

⚠ This library is no longer maintained ⚠️ FABRevealLayout A layout to transition between two views using a Floating Action Button as shown in many Mat

Tomás Ruiz-López 901 Dec 9, 2022
A Playground repository to showcase UI's and transitions built using Motion Layout.

A collection of UI's built to showcase the capabilities of Motion Layout and Constraint Layout 2.0/2.1

Saurabh 163 Dec 22, 2022
Responsive Layout Gird Configuration using Compose. An adaptive layout

ResponsiveGrid Responsive Grid is most followed layout system by the designer as it adapts to screen size and orientation, ensuring consistency across

null 4 Apr 12, 2022
Android library used to create an awesome Android UI based on a draggable element similar to the last YouTube graphic component.

Draggable Panel DEPRECATED. This project is not maintained anymore. Draggable Panel is an Android library created to build a draggable user interface

Pedro Vicente Gómez Sánchez 3k Jan 5, 2023
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