{"id":13644983,"url":"https://github.com/Jude95/SwipeBackHelper","last_synced_at":"2025-04-21T11:32:21.692Z","repository":{"id":49853468,"uuid":"39992820","full_name":"Jude95/SwipeBackHelper","owner":"Jude95","description":"make your activity can swipe to close","archived":false,"fork":false,"pushed_at":"2017-06-12T15:27:48.000Z","size":997,"stargazers_count":1385,"open_issues_count":29,"forks_count":266,"subscribers_count":49,"default_branch":"master","last_synced_at":"2025-04-12T17:46:54.310Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Jude95.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-31T07:32:07.000Z","updated_at":"2025-03-27T01:11:51.000Z","dependencies_parsed_at":"2022-08-27T06:40:59.962Z","dependency_job_id":null,"html_url":"https://github.com/Jude95/SwipeBackHelper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jude95%2FSwipeBackHelper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jude95%2FSwipeBackHelper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jude95%2FSwipeBackHelper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jude95%2FSwipeBackHelper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jude95","download_url":"https://codeload.github.com/Jude95/SwipeBackHelper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250047987,"owners_count":21366152,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T01:02:23.163Z","updated_at":"2025-04-21T11:32:21.666Z","avatar_url":"https://github.com/Jude95.png","language":"Java","readme":"# SwipeBackHelper \n[中文](https://github.com/Jude95/SwipeBackHelper/blob/master/README_ch.md) | [English](https://github.com/Jude95/SwipeBackHelper/blob/master/README.md)\n\nOnly three lines of code makes activity swipe close.\nPart of the code modified from [SwipeBackLayout](https://github.com/ikew0ng/SwipeBackLayout)  \n\n![swipeback.png](swipeback.gif)\n\n## Dependency\n```groovy\ncompile 'com.jude:swipebackhelper:3.1.2'\n```\n\n## Usage\nAdd this to`style.xml`:\n```xml\n    //if you don't set this the background will be black when you slide.\n    \u003citem name=\"android:windowIsTranslucent\"\u003etrue\u003c/item\u003e\n    //set the right in/out animation of Activity,you can change this to yours\n    \u003citem name=\"android:windowAnimationStyle\"\u003e@style/SlideRightAnimation\u003c/item\u003e\n```\n**Attention**  set up a separate theme for your main activity which should be at bottom and can't be swipe.and set the Activity no swipe by `setSwipeBackEnable(false)`\n```xml\n    \u003cstyle name=\"MainTheme\" parent=\"AppTheme\"\u003e\n        \u003citem name=\"android:windowIsTranslucent\"\u003efalse\u003c/item\u003e\n    \u003c/style\u003e\n```\nAdd this code into your activity's lifecycle。\n```java\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        SwipeBackHelper.onCreate(this);\n    }\n\n    @Override\n    protected void onPostCreate(Bundle savedInstanceState) {\n        super.onPostCreate(savedInstanceState);\n        SwipeBackHelper.onPostCreate(this);\n    }\n\n    @Override\n    protected void onDestroy() {\n        super.onDestroy();\n        SwipeBackHelper.onDestroy(this);\n    }\n```\nIf you need more setting,you can use this after `SwipeBackHelper.onCreate()`：\n```java\n    SwipeBackHelper.getCurrentPage(this)//get current instance\n        .setSwipeBackEnable(true)//on-off \n        .setSwipeEdge(200)//set the touch area。200 mean only the left 200px of screen can touch to begin swipe.\n        .setSwipeEdgePercent(0.2f)//0.2 mean left 20% of screen can touch to begin swipe.\n        .setSwipeSensitivity(0.5f)//sensitiveness of the gesture。0:slow  1:sensitive\n        .setScrimColor(Color.BLUE)//color of Scrim below the activity\n        .setClosePercent(0.8f)//close activity when swipe over this \n        .setSwipeRelateEnable(false)//if should move together with the following Activity\n        .setSwipeRelateOffset(500)//the Offset of following Activity when setSwipeRelateEnable(true)\n.setDisallowInterceptTouchEvent(true)//your view can hand the events first.default false;\n        .addListener(new SwipeListener() {\n\n            @Override\n            public void onScroll(float percent, int px) {\n            }\n\n            @Override\n            public void onEdgeTouch() {\n            }\n\n            @Override\n            public void onScrollToClose() {\n            }\n        });\n```\nLicense\n-------\n\n    Copyright 2015 Jude\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","funding_links":[],"categories":["滑动返回"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJude95%2FSwipeBackHelper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FJude95%2FSwipeBackHelper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJude95%2FSwipeBackHelper/lists"}