{"id":13642681,"url":"https://github.com/nikhilpanju/RecyclerViewEnhanced","last_synced_at":"2025-04-20T20:32:25.084Z","repository":{"id":144578882,"uuid":"58257336","full_name":"nikhilpanju/RecyclerViewEnhanced","owner":"nikhilpanju","description":"Android Library to provide swipe, click and other functionality to RecyclerView","archived":false,"fork":false,"pushed_at":"2019-01-29T21:47:27.000Z","size":886,"stargazers_count":1047,"open_issues_count":29,"forks_count":184,"subscribers_count":35,"default_branch":"master","last_synced_at":"2025-04-12T23:39:38.301Z","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/nikhilpanju.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}},"created_at":"2016-05-07T08:37:00.000Z","updated_at":"2025-03-22T23:49:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"af9da38e-0282-4247-ae50-b096c7a97811","html_url":"https://github.com/nikhilpanju/RecyclerViewEnhanced","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/nikhilpanju%2FRecyclerViewEnhanced","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikhilpanju%2FRecyclerViewEnhanced/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikhilpanju%2FRecyclerViewEnhanced/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikhilpanju%2FRecyclerViewEnhanced/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nikhilpanju","download_url":"https://codeload.github.com/nikhilpanju/RecyclerViewEnhanced/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647254,"owners_count":21139081,"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:01:34.884Z","updated_at":"2025-04-20T20:32:25.064Z","avatar_url":"https://github.com/nikhilpanju.png","language":"Java","funding_links":[],"categories":["RecyclerView"],"sub_categories":[],"readme":"# RecyclerViewEnhanced\nAndroid Library to provide swipe, click and other functionality to RecyclerView\n## Usage\n\nAdd this to your build.gradle file\n\n```\ndependencies {\n  compile 'com.nikhilpanju.recyclerviewenhanced:recyclerviewenhanced:1.1.0'\n}\n```\n\n## Features\n* Supports API 14+ (Earlier APIs not tested\n* Supports any view for \"Swipe Options\"\n* Doesn't require any new adapters or new views. Works with any existing RecyclerViews.\n* Requires adding `OnItemTouchListener` to the RecyclerView\n* Supports clicking and swiping functionalities.\n* Supports disabling clicking and swiping for particular items/rows.\n* Supports `independentViews` in your items/rows (Read below for more information)\n* Supports `fadeViews` in your items/rows (Read below for more information)\n\n## Demo\nBuild the sample application to try RecyclerViewEnhanced\n![alt text](https://github.com/nikhilpanju/RecyclerViewEnhanced/blob/master/sample/src/common/images/Demo.gif \"Demo\")\n\n## Configuring\n* #### Create an instance of `RecyclerTouchListener`\n  `onTouchListener = new RecyclerTouchListener(this, mRecyclerView);`\n  \n* #### Set `IndependentViews` and `FadeViews` (If required)\n  `IndependentViews` are views which can be clicked separately from the entire row. Their clicks have different functionality from row clicks. `FadeViews` are views which fade in and out as the rows are swiped closed and opened respectively.\n  \n  ```\n  onTouchListener.setIndependentViews(R.id.rowButton)\n                 .setViewsToFade(R.id.rowButton)               \n  ```\n  \n* #### Implement `OnRowClickListener` using `setClickable()`\n  `setClickable()` will enable clicks for the recycler view items and the `IndependentViews`\n  \n  ```\n  .setClickable(new RecyclerTouchListener.OnRowClickListener() {\n            @Override\n            public void onRowClicked(int position) {\n                // Do something\n            }\n\n            @Override\n            public void onIndependentViewClicked(int independentViewID, int position) {\n                // Do something\n            }\n        })               \n  ```\n  \n* #### Enable Swipe Functionality\n\n  Set the views for which you require a click listener and enable swiping by using `setSwipeable()`\n  ```\n  .setSwipeOptionViews(R.id.add, R.id.edit, R.id.change)\n  .setSwipeable(R.id.rowFG, R.id.rowBG, new RecyclerTouchListener.OnSwipeOptionsClickListener() {\n            @Override\n            public void onSwipeOptionClicked(int viewID, int position) {\n                if (viewID == R.id.add) {\n                    // Do something\n                } else if (viewID == R.id.edit) {\n                    // Do something\n                } else if (viewID == R.id.change) {\n                    // Do something\n                }\n           }\n       });\n  ```\n  \n* #### Adding the listener to the RecyclerView\n\n  In `onResume()` add the listener: \n  ```\n  mRecyclerView.addOnItemTouchListener(onTouchListener);\n  ```\n  In `onPause()` remove the listener: \n  ```\n  mRecyclerView.removeOnItemTouchListener(onTouchListener);\n  ```\n       \n## Additional Functionality\n* Use `onRowLongClickListener` to receive long click events\n  ```\n  .setLongClickable(true, new RecyclerTouchListener.OnRowLongClickListener() {\n                    @Override\n                    public void onRowLongClicked(int position) {\n                        ToastUtil.makeToast(getApplicationContext(), \"Row \" + (position + 1) + \" long clicked!\");\n                    }\n                })\n  ```\n  \n* Use `setUnSwipeableRows()` to disable certain rows from swiping. Using this also displays an \"difficult-to-slide\" animation when trying to slide an unswipeable row.\n* Use `setUnClickableRows()` to disable click actions for certain rows. (Note: This also prevents the independentViews from being clicked).\n* `openSwipeOptions()` opens the swipe options for a specific row.\n* `closeVisibleBG()` closes any open options.\n* Implement `OnSwipeListener` to get `onSwipeOptionsClosed()` and `onSwipeOptionsOpened()` events.\n\n  \n### Closing swipe options when clicked anywhere outside of the recyclerView:\n* Make your Activity implement `RecyclerTouchListener.RecyclerTouchListenerHelper` and store the touchListener\n```\nprivate OnActivityTouchListener touchListener;\n\n@Override\npublic void setOnActivityTouchListener(OnActivityTouchListener listener) {\n    this.touchListener = listener;\n}\n```\n* Override `dispatchTouchEvent()` of your Activity and pass the `MotionEvent` variable to the `touchListener`\n```\n@Override\npublic boolean dispatchTouchEvent(MotionEvent ev) {\n    if (touchListener != null) touchListener.getTouchCoordinates(ev);\n        return super.dispatchTouchEvent(ev);\n}\n```\n## Author\n* Nikhil Panju ([Github](https://github.com/nikhilpanju))\n\n\n## License\nCopyright 2016 Nikhil Panju\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n([http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0))\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikhilpanju%2FRecyclerViewEnhanced","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnikhilpanju%2FRecyclerViewEnhanced","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikhilpanju%2FRecyclerViewEnhanced/lists"}