{"id":13829221,"url":"https://github.com/Yalantis/ToDoList","last_synced_at":"2025-07-09T09:32:54.848Z","repository":{"id":43820314,"uuid":"74457837","full_name":"Yalantis/ToDoList","owner":"Yalantis","description":"Micro-Transitions for Smooth Android To-Do List Animations","archived":false,"fork":false,"pushed_at":"2022-10-27T07:29:27.000Z","size":3416,"stargazers_count":1644,"open_issues_count":19,"forks_count":286,"subscribers_count":59,"default_branch":"master","last_synced_at":"2024-11-05T04:02:40.790Z","etag":null,"topics":["android","animation","java","recyclerview"],"latest_commit_sha":null,"homepage":"https://yalantis.com","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/Yalantis.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":"2016-11-22T09:45:29.000Z","updated_at":"2024-11-02T09:37:31.000Z","dependencies_parsed_at":"2023-01-20T08:15:11.701Z","dependency_job_id":null,"html_url":"https://github.com/Yalantis/ToDoList","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yalantis%2FToDoList","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yalantis%2FToDoList/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yalantis%2FToDoList/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yalantis%2FToDoList/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Yalantis","download_url":"https://codeload.github.com/Yalantis/ToDoList/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225533010,"owners_count":17484179,"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","animation","java","recyclerview"],"created_at":"2024-08-04T10:00:28.209Z","updated_at":"2024-11-20T10:30:32.167Z","avatar_url":"https://github.com/Yalantis.png","language":"Java","readme":"# ToDoList\n\n[![License](http://img.shields.io/badge/license-MIT-green.svg?style=flat)]()\n[![](https://jitpack.io/v/yalantis/todolist.svg)](https://jitpack.io/#yalantis/todolist)\n[![Yalantis](https://raw.githubusercontent.com/Yalantis/PullToRefresh/develop/PullToRefreshDemo/Resources/badge_dark.png)](https://yalantis.com/?utm_source=github)\n\n\u003ca href='https://play.google.com/store/apps/details?id=com.yalantis.beamazingtoday\u0026utm_source=global_co\u0026utm_medium=prtnr\u0026utm_content=Mar2515\u0026utm_campaign=PartBadge\u0026pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1'\u003e\u003cimg alt='Get it on Google Play' src='https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png' height=\"70\" width=\"180\"/\u003e\u003c/a\u003e\n\n[Live DEMO on appetize.io](https://appetize.io/app/c72udvwr5h7rgrbm23y2qrbbfc)\n\nCheck this [project on dribbble](https://dribbble.com/shots/2589690-Be-amazing-today)\n\nRead how we did it [on our blog](https://yalantis.com/blog/how-we-used-micro-transitions-for-smooth-android-to-do-list-animations/)\n\n\u003cimg src=\"content_shot_to-do_dribbble.gif\"/\u003e\n\n##Requirements\n- Android SDK 16+\n\n##Usage\n\nAdd to your root build.gradle:\n```Groovy\nallprojects {\n\trepositories {\n\t...\n\tmaven { url \"https://jitpack.io\" }\n\t}\n}\n```\n\nAdd the dependency:\n```Groovy\ndependencies {\n\tcompile 'com.github.yalantis:todolist:v1.0.1'\n}\n```\n\n## How to use this library\n\nAdd ```BatRecyclerView``` to your xml layout\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003cLinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:id=\"@+id/root\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:background=\"@drawable/gradient\"\n    android:orientation=\"vertical\"\u003e\n\n    \u003candroid.support.v7.widget.Toolbar\n        android:id=\"@+id/toolbar\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"?android:attr/actionBarSize\"\n        android:background=\"@android:color/transparent\"\n        app:logo=\"@drawable/ic_menu\"\u003e\n\n        \u003cTextView\n            android:id=\"@+id/text_title\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:layout_gravity=\"center\"\n            android:text=\"14 Feb, 2016\"\n            android:textColor=\"@android:color/white\"\n            android:textSize=\"20sp\" /\u003e\n\n    \u003c/android.support.v7.widget.Toolbar\u003e\n\n    \u003ccom.yalantis.beamazingtoday.ui.widget.BatRecyclerView\n        android:id=\"@+id/bat_recycler_view\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:layout_gravity=\"center_horizontal\"\n        app:add_button_color=\"@drawable/selector_button_add\"\n        app:hint=\"@string/str_add_goal\"\n        app:radio_button_res=\"@drawable/selector_radio_button\" /\u003e\n\n\u003c/LinearLayout\u003e\n```\n\nCreate ```BatListener```\n\n```java\nprivate BatListener mListener = new BatListener() {\n        @Override\n        public void add(String string) {\n            mGoals.add(0, new Goal(string));\n            mAdapter.notify(AnimationType.ADD, 0);\n        }\n\n        @Override\n        public void delete(int position) {\n            mGoals.remove(position);\n            mAdapter.notify(AnimationType.REMOVE, position);\n        }\n\n        @Override\n        public void move(int from, int to) {\n            if (from \u003e= 0 \u0026\u0026 to \u003e= 0) {\n                \n                //if you use 'BatItemAnimator'\n                mAnimator.setPosition(to);\n                \n                BatModel model = mGoals.get(from);\n                mGoals.remove(model);\n                mGoals.add(to, model);\n                mAdapter.notify(AnimationType.MOVE, from, to);\n\n                if (from == 0 || to == 0) {\n                    mRecyclerView.getView().scrollToPosition(Math.min(from, to));\n                }\n            }\n        }\n    };\n```\n\nCreate ```BatAdapter```. Pass to its constructor list of models and ```BatListener```. Note that your model should implement ```BatModel``` interface\n\n```java\nmAdapter = new BatAdapter(mGoals = new ArrayList\u003cBatModel\u003e() {{\n      add(new Goal(\"first\"));\n      add(new Goal(\"second\"));\n      add(new Goal(\"third\"));\n      add(new Goal(\"fourth\"));\n      add(new Goal(\"fifth\"));\n      add(new Goal(\"sixth\"));\n      add(new Goal(\"seventh\"));\n      add(new Goal(\"eighth\"));\n      add(new Goal(\"ninth\"));\n      add(new Goal(\"tenth\"));\n}}, mListener);\n        \nmAdapter.setOnItemClickListener(new OnItemClickListener() {\n      @Override\n      public void onClick(BatModel item, int position) {\n            Toast.makeText(ExampleActivity.this, item.getText(), Toast.LENGTH_SHORT).show();\n      }\n});\n```\n\nInitialize your recycler view\n\n```java\nmRecyclerView.getView().setLayoutManager(new LinearLayoutManager(this));\nmRecyclerView.getView().setAdapter(mAdapter);\n\nItemTouchHelper itemTouchHelper = new ItemTouchHelper(new BatCallback(this));\nitemTouchHelper.attachToRecyclerView(mRecyclerView.getView());\nmRecyclerView.setAddItemListener(mListener);\n```\n\n## Extra\n\nYou can use ```BatItemAnimator``` to animate list items just like in our demo:\n\n```java\nmAnimator = new BatItemAnimator();\nmAdapter = new BatAdapter(mGoals = new ArrayList\u003cBatModel\u003e() {{\n            add(new Goal(\"first\"));\n            add(new Goal(\"second\"));\n            add(new Goal(\"third\"));\n            add(new Goal(\"fourth\"));\n            add(new Goal(\"fifth\"));\n            add(new Goal(\"sixth\"));\n            add(new Goal(\"seventh\"));\n            add(new Goal(\"eighth\"));\n            add(new Goal(\"ninth\"));\n            add(new Goal(\"tenth\"));\n}}, mListener, mAnimator);\nmRecyclerView.getView().setItemAnimator(mAnimator);\n```\nYou need to pass the animator instance to ```BatRecyclerView``` and to ```BatAdapter```.\nAlso it's necessary to pass the position of the moved item in ```move()``` callback:\n\n```java\n@Override\npublic void move(int from, int to) {\n     if (from \u003e= 0 \u0026\u0026 to \u003e= 0) {\n           mAnimator.setPosition(to);\n           BatModel model = mGoals.get(from);\n           mGoals.remove(model);\n           mGoals.add(to, model);\n           mAdapter.notify(AnimationType.MOVE, from, to);\n\n           if (from == 0 || to == 0) {\n                 mRecyclerView.getView().scrollToPosition(Math.min(from, to));\n           }\n     }\n}\n```\nFor more usage examples please review sample app\n\n## Changelog\n\n### Version: 1.0.1\n\n* Cursor fixed. \n* ```cursor_drawable``` attribute and ```setCursorDrawable(@DrawableRes int res)``` method added. \n\tShould be used instead of ```cursor_color``` attribute and ```setCursorColor(@ColorInt int color)``` method \t\trespectively\n\n## Let us know!\n\nWe’d be really happy if you could send us links to your projects where you use our component. Just send an email to github@yalantis.com And do let us know if you have any questions or suggestion regarding the animation. \n\nP.S. We’re going to publish more awesomeness wrapped in code and a tutorial on how to make UI for iOS (Android) better than better. Stay tuned!\n\n## License\n\n\tThe MIT License (MIT)\n\n\tCopyright © 2017 Yalantis, https://yalantis.com\n\n\tPermission is hereby granted, free of charge, to any person obtaining a copy\n\tof this software and associated documentation files (the \"Software\"), to deal\n\tin the Software without restriction, including without limitation the rights\n\tto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\tcopies of the Software, and to permit persons to whom the Software is\n\tfurnished to do so, subject to the following conditions:\n\n\tThe above copyright notice and this permission notice shall be included in\n\tall copies or substantial portions of the Software.\n\n\tTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\tIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\tFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\tAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\tLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\tOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\tTHE SOFTWARE.\n","funding_links":[],"categories":["Java","Available Apps"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FYalantis%2FToDoList","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FYalantis%2FToDoList","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FYalantis%2FToDoList/lists"}