{"id":20325026,"url":"https://github.com/raghavtilak/simpledragswiperv","last_synced_at":"2025-04-11T19:42:29.221Z","repository":{"id":166285494,"uuid":"388087488","full_name":"raghavtilak/SimpleDragSwipeRV","owner":"raghavtilak","description":"Simple RecyclerViewAdapter library with Swipe to delete and Drag to Sort functionality. Supports all the three Layouts(Vertical, Horizontal, Grid).","archived":false,"fork":false,"pushed_at":"2023-11-11T17:54:49.000Z","size":170,"stargazers_count":3,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T15:49:10.623Z","etag":null,"topics":["android","custom-recyclerview","drag-swipe-recyclerview","dragsort-recyclerview","dragsortview","hacktoberfest","hacktoberfest-accepted","hacktoberfest-android","hacktoberfest2023","java","recyclerview-adapter","swipe-recyclerview"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/raghavtilak.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-21T10:58:27.000Z","updated_at":"2024-06-15T19:17:40.000Z","dependencies_parsed_at":"2023-11-11T18:43:49.625Z","dependency_job_id":null,"html_url":"https://github.com/raghavtilak/SimpleDragSwipeRV","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raghavtilak%2FSimpleDragSwipeRV","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raghavtilak%2FSimpleDragSwipeRV/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raghavtilak%2FSimpleDragSwipeRV/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raghavtilak%2FSimpleDragSwipeRV/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raghavtilak","download_url":"https://codeload.github.com/raghavtilak/SimpleDragSwipeRV/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248468532,"owners_count":21108835,"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":["android","custom-recyclerview","drag-swipe-recyclerview","dragsort-recyclerview","dragsortview","hacktoberfest","hacktoberfest-accepted","hacktoberfest-android","hacktoberfest2023","java","recyclerview-adapter","swipe-recyclerview"],"created_at":"2024-11-14T19:38:29.066Z","updated_at":"2025-04-11T19:42:29.200Z","avatar_url":"https://github.com/raghavtilak.png","language":"Kotlin","funding_links":["https://www.buymeacoffee.com/raghavtilak"],"categories":[],"sub_categories":[],"readme":"# SimpleDragSwipeAdapter\nSimple RecyclerView Adapter with Drag-Sort and Swipe Delete functionality.\n\u003cbr\u003e\n[![\"Buy Me A Coffee\"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/raghavtilak)\n\n[![Generic badge](https://img.shields.io/badge/jitpack-1.0.0-green.svg)](https://shields.io/)\n\n### Functionality #\n1. Swipe UP/DOWN (Horizontal) Swipe RIGHT/LEFT (Vertical) to remove an item.\n2. LongPress and Drag to sort items in RecyclerView.\n\n# Demo 📱 #\n\n\nLinearLayout | HorizontalLayout | GridLayout  \n---\t     | ---              | --- \n|\u003cimg src=\"https://user-images.githubusercontent.com/74963954/126496700-42364828-915c-485b-8db9-fc80712ebfc6.gif\" width=\"70%\" /\u003e|\u003cimg src=\"https://user-images.githubusercontent.com/74963954/126499705-e57764f6-31ab-4612-8567-93be2debf9d3.gif\" width=\"70%\" /\u003e|\u003cimg src=\"https://user-images.githubusercontent.com/74963954/126499749-a59dd8a8-6318-40e3-a3a3-2dc21c39fce1.gif\" width=\"70%\" /\u003e\n\n\n# Usage 🛠️ #\n## Dependency #\n\u003e Step 1. Add the JitPack repository to your build file\n```\n\tallprojects {\n\t\trepositories {\n\t\t\t...\n\t\t\tmaven { url 'https://jitpack.io' }\n\t\t}\n\t}\n```\n\n\u003eStep 2. Add the dependency\n```\n\tdependencies {\n\t        implementation 'com.github.raghavtilak:SimpleDragSwipeRV:1.0.0'\n\t}\n```\n## Model Class #\n```\npublic class UserModel {\n    private String name;\n    private String phone;\n    private String country;\n\n    public UserModel(String name, String phone, String country) {\n        this.name = name;\n        this.phone = phone;\n        this.country = country;\n    }\n    ....\n}    \n```\n## RecyclerView Adapter #\n```\npublic class RVAdapter extends DragSwipeAdapter\u003cUserModel\u003e {\n\n\n    public RVAdapter(@NonNull Context context, List\u003cUserModel\u003e datas, int itemLayoutId, RecyclerView recyclerView, boolean isCanDrag, boolean isCanSwipe, int displayMode, int itemSpacing, OnItemClick onItemClickListener) {\n        super(context, datas, itemLayoutId, recyclerView, isCanDrag, isCanSwipe, displayMode, itemSpacing, onItemClickListener);\n    }\n\n    @Override\n    protected void bindView(UserModel item, DragSwipeAdapter.ViewHolder viewHolder) {\n        if(item!=null){\n            TextView name=(TextView)viewHolder.getView(R.id.textViewName);\n            TextView phone=(TextView)viewHolder.getView(R.id.textViewPhone);\n            TextView country=(TextView)viewHolder.getView(R.id.textViewCountry);\n            name.setText(item.getName());\n            phone.setText(item.getPhone());\n            country.setText(item.getCountry());\n        }\n    }\n\n    @Override\n    public void onItemSwiped() {\n\n    }\n\n    @Override\n    public void onItemMoved() {\n\n    }\n}\n```\n## OnItemClickListener #\n```\npublic class MainActivity extends AppCompatActivity implements DragSwipeAdapter.OnItemClick\u003cUserModel\u003e {\n\t...\n\t\n   @Override\n    public void onClick(View view, int position, UserModel item) {\n        ...\n    }\n    \n        ...\n}\n```\n\n## Attach Adapter to RecyclerView\n```\n...\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n\n        recyclerView=findViewById(R.id.recyclerView);\n        recyclerView.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.VERTICAL,false));\n\n        userList=new ArrayList\u003c\u003e();\n        loadData();\n        listAdapter = new RVAdapter(this,userList,R.layout.item_layout,\n                recyclerView,\n                true,false,RVAdapter.VERTICAL,\n                16,this);\n    }\n    ...\n```\n# Constructor #\n```\n    public DragSwipeAdapter(@NonNull Context context, List\u003cT\u003e datas, int itemLayoutId,\n                            RecyclerView recyclerView,\n                            boolean isCanDrag, boolean isCanSwipe, int displayMode,\n                            int itemSpacing, OnItemClick onItemClickListener)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraghavtilak%2Fsimpledragswiperv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraghavtilak%2Fsimpledragswiperv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraghavtilak%2Fsimpledragswiperv/lists"}