{"id":13642472,"url":"https://github.com/TUBB/SwipeMenu","last_synced_at":"2025-04-20T16:32:28.676Z","repository":{"id":51242952,"uuid":"43947238","full_name":"TUBB/SwipeMenu","owner":"TUBB","description":"[DEPRECATED] A swipe menu for horizontal/vertical, support left/right and top/bottom directions","archived":false,"fork":false,"pushed_at":"2019-07-11T13:49:01.000Z","size":25689,"stargazers_count":811,"open_issues_count":8,"forks_count":129,"subscribers_count":25,"default_branch":"master","last_synced_at":"2024-11-09T13:38:59.836Z","etag":null,"topics":["listview","recyclerview","scrollview","swipe-menu"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TUBB.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-09T09:53:32.000Z","updated_at":"2024-10-17T07:24:05.000Z","dependencies_parsed_at":"2022-08-25T19:10:20.245Z","dependency_job_id":null,"html_url":"https://github.com/TUBB/SwipeMenu","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/TUBB%2FSwipeMenu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TUBB%2FSwipeMenu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TUBB%2FSwipeMenu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TUBB%2FSwipeMenu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TUBB","download_url":"https://codeload.github.com/TUBB/SwipeMenu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249926431,"owners_count":21346556,"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":["listview","recyclerview","scrollview","swipe-menu"],"created_at":"2024-08-02T01:01:31.854Z","updated_at":"2025-04-20T16:32:27.876Z","avatar_url":"https://github.com/TUBB.png","language":"Java","readme":"SwipeMenu\n=========\nA swipe menu for `horizontal/vertical`, support `left/right and top/bottom` directions, low coupling, can fast rapid integration into your project\n\nFeatures\n======== \n \n * Support LinearLayoutManager、GridLayoutManager and StaggeredGridLayoutManager for RecyclerView (`only horizontal`)\n * Support ListView and GridView (`only horizontal`)\n * Support ScrollView (`only horizontal` and the `[SwipeHorizontal/SwipeVertical]MenuLayout` must be the direct child of ScrollView's direct child )\n * On-off swipe ability\n * Not intercept item touch event\n * Left/Right and Top/Bottom menu support, free switch\n\nPreview\n=======\n![DEMO](https://github.com/TUBB/SwipeMenu/blob/master/art/demo.gif)\n\nUsage\n=====\n\nAdd to dependencies\n```\ndependencies {\n    compile 'com.tubb.smrv:swipemenu-recyclerview:5.4.8'\n}\n```\n\n#### Horizontal\nJust use `SwipeHorizontalMenuLayout`, we use `SwipeHorizontalMenuLayout` ViewGroup to combine item content view and `left/right(at least one)` swipe menu\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003ccom.tubb.smrv.SwipeHorizontalMenuLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:sml=\"http://schemas.android.com/apk/res-auto\"\n    android:id=\"@+id/sml\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    sml:sml_scroller_interpolator=\"@android:anim/bounce_interpolator\"\n    sml:sml_auto_open_percent=\"0.2\"\n    sml:sml_scroller_duration=\"250\"\u003e\n\n    \u003cinclude android:id=\"@id/smContentView\" layout=\"@layout/item_simple_content\"/\u003e\n    \u003cinclude android:id=\"@id/smMenuViewLeft\" layout=\"@layout/item_simple_left_menu\"/\u003e\n    \u003cinclude android:id=\"@id/smMenuViewRight\" layout=\"@layout/item_simple_right_menu\"/\u003e\n\n\u003c/com.tubb.smrv.SwipeHorizontalMenuLayout\u003e\n```\n\nIf you have so many items, you may be want to use our custom RecyclerView\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003candroid.support.v4.widget.SwipeRefreshLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    tools:context=\"${relativePackage}.${activityClass}\"\n    android:id=\"@+id/swipeRefreshLayout\"\u003e\n\n    \u003ccom.tubb.smrv.SwipeMenuRecyclerView\n        android:id=\"@+id/listView\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\" /\u003e\n\n\u003c/android.support.v4.widget.SwipeRefreshLayout\u003e\n```\n\n### Vertical\nJust use `SwipeVerticalMenuLayout`, we use `SwipeVerticalMenuLayout` ViewGroup to combine item content view and `top/bottom (at least one)` swipe menu\n```xml\n\u003ccom.tubb.smrv.SwipeVerticalMenuLayout\n    android:id=\"@+id/sml\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    sml:sml_scroller_interpolator=\"@android:anim/bounce_interpolator\"\u003e\n\n    \u003cLinearLayout\n        android:id=\"@id/smMenuViewTop\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"150dp\"\n        android:orientation=\"horizontal\"\n        android:clickable=\"true\"\n        android:background=\"@android:color/holo_green_light\"\n        android:gravity=\"center_horizontal\"\u003e\n\n        \u003cTextView\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:text=\"top\"\n            android:textColor=\"@color/white\"\n            android:layout_gravity=\"top\"/\u003e\n\n    \u003c/LinearLayout\u003e\n\n    \u003cRelativeLayout\n        android:id=\"@id/smContentView\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:background=\"@color/red\"\u003e\n\n        \u003cButton\n            android:id=\"@+id/btLeft\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:text=\"Top\"\n            android:layout_centerHorizontal=\"true\"\n            /\u003e\n\n        \u003cButton\n            android:id=\"@+id/btRight\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:text=\"Bottom\"\n            android:layout_centerHorizontal=\"true\"\n            android:layout_alignParentBottom=\"true\"/\u003e\n\n    \u003c/RelativeLayout\u003e\n\n    \u003cLinearLayout\n        android:id=\"@id/smMenuViewBottom\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"150dp\"\n        android:orientation=\"horizontal\"\n        android:clickable=\"true\"\n        android:background=\"@android:color/holo_blue_light\"\n        android:gravity=\"center_horizontal\"\u003e\n\n        \u003cTextView\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:text=\"bottom\"\n            android:textColor=\"@color/white\"\n            android:layout_gravity=\"bottom\"/\u003e\n\n    \u003c/LinearLayout\u003e\n\u003c/com.tubb.smrv.SwipeVerticalMenuLayout\u003e\n```\n\nMore details please see the demo project\n\n## Listeners\nWe add a [SwipeSwitchListener][2] for actions like open/close\n```java\nsml.setSwipeListener(new SwipeSwitchListener() {\n    @Override\n    public void beginMenuClosed(SwipeMenuLayout swipeMenuLayout) {\n        Log.e(TAG, \"left menu closed\");\n    }\n\n    @Override\n    public void beginMenuOpened(SwipeMenuLayout swipeMenuLayout) {\n        Log.e(TAG, \"left menu opened\");\n    }\n\n    @Override\n    public void endMenuClosed(SwipeMenuLayout swipeMenuLayout) {\n        Log.e(TAG, \"right menu closed\");\n    }\n\n    @Override\n    public void endMenuOpened(SwipeMenuLayout swipeMenuLayout) {\n        Log.e(TAG, \"right menu opened\");\n    }\n});\n```\n\nIf you case a few actions, just use [SimpleSwipeSwitchListener][3]\n```java\nsml.setSwipeListener(new SimpleSwipeSwitchListener(){\n    @Override\n    public void beginMenuClosed(SwipeMenuLayout swipeMenuLayout) {\n        Log.e(TAG, \"left menu closed\");\n    }\n});\n```\n\nWe also add a [SwipeFractionListener][4] for complete fraction action\n```java\nsml.setSwipeFractionListener(new SwipeFractionListener() {\n    @Override\n    public void beginMenuSwipeFraction(SwipeMenuLayout swipeMenuLayout, float fraction) {\n        Log.e(TAG, \"top menu swipe fraction:\"+fraction);\n\n    }\n\n    @Override\n    public void endMenuSwipeFraction(SwipeMenuLayout swipeMenuLayout, float fraction) {\n        Log.e(TAG, \"bottom menu swipe fraction:\"+fraction);\n    }\n});\n```\n\nIf you case a few actions, just use [SimpleSwipeFractionListener][5]\n```java\nsml.setSwipeFractionListener(new SimpleSwipeFractionListener(){\n    @Override\n    public void beginMenuSwipeFraction(SwipeMenuLayout swipeMenuLayout, float fraction) {\n        Log.e(TAG, \"top menu swipe fraction:\"+fraction);\n    }\n});\n```\n\nCustom\n======\n\nSupported custom attrs:\n\n * `sml_scroller_duration` Scroller duration(ms), `sml:sml_scroller_duration=\"250\"`\n * `sml_auto_open_percent` Swipe menu auto open percent(relative to menu's width), `sml:sml_auto_open_percent=\"0.5\"`\n * `sml_scroller_interpolator` Scroller open/close interpolation, `sml:sml_scroller_interpolator=\"@android:anim/bounce_interpolator\"`\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003cresources\u003e\n    \u003cdeclare-styleable name=\"SwipeMenu\"\u003e\n        \u003cattr name=\"sml_scroller_duration\" format=\"integer\" /\u003e\n        \u003cattr name=\"sml_auto_open_percent\" format=\"float\"/\u003e\n        \u003cattr name=\"sml_scroller_interpolator\" format=\"reference\"/\u003e\n    \u003c/declare-styleable\u003e\n\u003c/resources\u003e\n```\n\nThanks\n======\n\nInspired by [baoyongzhang/SwipeMenuListView][1]\n\nLicense\n-------\n\n    Copyright 2016 TUBB\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    \n[1]: https://github.com/baoyongzhang/SwipeMenuListView\n[2]: https://github.com/TUBB/SwipeMenu/tree/master/library/src/main/java/com/tubb/smrv/listener/SwipeSwitchListener.java\n[3]: https://github.com/TUBB/SwipeMenu/tree/master/library/src/main/java/com/tubb/smrv/listener/SimpleSwipeSwitchListener.java\n[4]: https://github.com/TUBB/SwipeMenu/tree/master/library/src/main/java/com/tubb/smrv/listener/SwipeFractionListener.java\n[5]: https://github.com/TUBB/SwipeMenu/tree/master/library/src/main/java/com/tubb/smrv/listener/SimpleSwipeFractionListener.java\n","funding_links":[],"categories":["Java","滑动删除"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTUBB%2FSwipeMenu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTUBB%2FSwipeMenu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTUBB%2FSwipeMenu/lists"}