{"id":13428794,"url":"https://github.com/skydoves/ElasticViews","last_synced_at":"2025-03-16T01:33:34.003Z","repository":{"id":46955725,"uuid":"79647613","full_name":"skydoves/ElasticViews","owner":"skydoves","description":":sparkles: An easy way to implement an elastic touch effect for Android.","archived":false,"fork":false,"pushed_at":"2024-04-04T01:49:30.000Z","size":486,"stargazers_count":811,"open_issues_count":0,"forks_count":95,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-03-10T17:54:01.786Z","etag":null,"topics":["action","android-animation","android-library","animation","elastic","elaticviews","skydoves","touch-animation"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/skydoves.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"skydoves","custom":["https://www.paypal.me/skydoves","https://www.buymeacoffee.com/skydoves"]}},"created_at":"2017-01-21T13:34:12.000Z","updated_at":"2025-02-08T15:13:44.000Z","dependencies_parsed_at":"2024-06-21T17:11:31.772Z","dependency_job_id":"9a8c7765-156b-4930-a2e7-51634fb15733","html_url":"https://github.com/skydoves/ElasticViews","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skydoves%2FElasticViews","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skydoves%2FElasticViews/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skydoves%2FElasticViews/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skydoves%2FElasticViews/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skydoves","download_url":"https://codeload.github.com/skydoves/ElasticViews/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243814905,"owners_count":20352037,"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":["action","android-animation","android-library","animation","elastic","elaticviews","skydoves","touch-animation"],"created_at":"2024-07-31T01:01:05.302Z","updated_at":"2025-03-16T01:33:33.666Z","avatar_url":"https://github.com/skydoves.png","language":"Kotlin","readme":"# ElasticViews \n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\u003cimg alt=\"License\" src=\"https://img.shields.io/badge/license-MIT%20License-blue.svg\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://android-arsenal.com/api?level=16\"\u003e\u003cimg alt=\"API\" src=\"https://img.shields.io/badge/API-16%2B-brightgreen.svg?style=flat\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://travis-ci.org/skydoves/ElasticViews\"\u003e\u003cimg alt=\"Build Status\" src=\"https://travis-ci.org/skydoves/ElasticViews.svg?branch=master\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://androidweekly.net/issues/issue-336\"\u003e\u003cimg alt=\"Android Weekly\" src=\"https://img.shields.io/badge/Android%20Weekly-%23336-orange.svg\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://skydoves.github.io/libraries/elasticviews/javadoc/elasticviews/com.skydoves.elasticviews/index.html\"\u003e\u003cimg alt=\"Javadoc\" src=\"https://img.shields.io/badge/Javadoc-ElasticViews-yellow\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n✨ An easy way to implement an elastic touch effect for Android.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/24237865/72123075-73943500-33a3-11ea-883f-9009de998788.gif\" width=\"32%\"/\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/24237865/72123076-73943500-33a3-11ea-92ef-0924cd0b902e.gif\" width=\"32%\"/\u003e\n\u003c/p\u003e\n\n## Including in your project\n[![Maven Central](https://img.shields.io/maven-central/v/com.github.skydoves/elasticviews.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.github.skydoves%22%20AND%20a:%22elasticviews%22)\n[![Kitpack](https://jitpack.io/v/skydoves/ElasticViews.svg)](https://jitpack.io/#skydoves/ElasticViews)\n\n#### Gradle\nAdd codes below to your **root** `build.gradle` file (not your module build.gradle file).\n```gradle\nallprojects {\n    repositories {\n        mavenCentral()\n    }\n}\n```\nAnd add a dependency code to your **module**'s `build.gradle` file.\n```gradle\ndependencies {\n    implementation \"com.github.skydoves:elasticviews:2.1.0\"\n}\n```\n## SNAPSHOT \n[![ElasticViews](https://img.shields.io/static/v1?label=snapshot\u0026message=elasticviews\u0026logo=apache%20maven\u0026color=C71A36)](https://oss.sonatype.org/content/repositories/snapshots/com/github/skydoves/elasticviews/) \u003cbr\u003e\nSnapshots of the current development version of ElasticViews are available, which track [the latest versions](https://oss.sonatype.org/content/repositories/snapshots/com/github/skydoves/elasticviews/).\n```Gradle\nrepositories {\n   maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }\n}\n```\n\n## Usage\n`ElasticViews` lets we use like using normal views and gives all of the Views or GroupViews touch effect very simply.\n\n#### Add XML Namespace\nFirst add below XML Namespace inside your XML layout file.\n\n```gradle\nxmlns:app=\"http://schemas.android.com/apk/res-auto\"\n```\n\n#### OnClick Method\nAll of ElasticViews should be set `OnClickListener` or `onClick` method. If not, nothing happens.\n```java\nElasticButton elasticButton = (ElasticButton)findViewById(R.id.elasticbutton);\nelasticButton.setOnClickListener(new View.OnClickListener() {\n    @Override\n    public void onClick(View v) {\n        // do something\n    }\n});\n```\n\n### ElasticButton\n```gradle\n\u003ccom.skydoves.elasticviews.ElasticButton\n   android:layout_width=\"match_parent\"\n   android:layout_height=\"wrap_content\"\n   android:text=\"Elastic Button\"\n   android:textColor=\"@android:color/white\"\n   android:textSize=\"17sp\"\n   app:button_cornerRadius=\"4dp\"\n   app:button_duration=\"250\"\n   app:button_scale=\"0.87\" /\u003e\n```\n\n### ElasticCheckButton\n```gradle\n\u003ccom.skydoves.elasticviews.ElasticCheckButton\n   android:layout_width=\"match_parent\"\n   android:layout_height=\"45dp\"\n   android:background=\"#30354b\"\n   android:text=\"Text\"\n   android:textColor=\"@android:color/white\"\n   android:textStyle=\"bold\"\n   app:checkButton_cornerRadius=\"4dp\"\n   app:checkButton_alpha=\"0.7\"\n   app:checkButton_duration=\"400\"\n   app:checkButton_scale=\"0.9\" /\u003e\n```\n\n### ElasticImageView\n```gradle\n\u003ccom.skydoves.elasticviews.ElasticImageView\n   android:layout_width=\"23dp\"\n   android:layout_height=\"23dp\"\n   android:scaleType=\"fitXY\"\n   android:src=\"@drawable/ic_question\"\n   android:tint=\"#3d95c9\"\n   app:imageView_scale=\"0.7\"\n   app:imageView_duration=\"300\" /\u003e\n```\n\n### ElasticFloatingActionButton\n```gradle\n\u003ccom.skydoves.elasticviews.ElasticFloatingActionButton\n   android:layout_width=\"64dp\"\n   android:layout_height=\"64dp\"\n   android:src=\"@drawable/ic_add\"\n   android:tint=\"#ffffff\"\n   app:fabSize=\"normal\"\n   app:fabutton_duration=\"400\"\n   app:fabutton_scale=\"0.85\" /\u003e\n```\n\n### ElasticCardView\n```gradle\n\u003ccom.skydoves.elasticviews.ElasticCardView\n  android:layout_width=\"match_parent\"\n  android:layout_height=\"120dp\"\n  app:cardCornerRadius=\"8dp\"\n  app:cardElevation=\"12dp\"\n  app:cardBackgroundColor=\"@color/background\"\n  app:cardView_duration=\"250\"\n  app:cardView_scale=\"0.8\" \u003e\n\n  ...\n\n\u003c/com.skydoves.elasticviews.ElasticCardView\u003e\n```\n\n### ElasticLayout\nElasticLayout gives elastic animation to all child views.\n\n```gradle\n\u003ccom.skydoves.elasticviews.ElasticLayout\n  android:layout_width=\"match_parent\"\n  android:layout_height=\"80dp\"\n  app:layout_cornerRadius=\"4dp\"\n  app:layout_duration=\"500\"\n  app:layout_scale=\"0.85\"\u003e\n\n  \u003cTextView\n      android:id=\"@+id/textView0\"\n      android:layout_width=\"match_parent\"\n      android:layout_height=\"wrap_content\"\n      android:text=\"This is\"\n      android:textColor=\"#ffffff\"\n      android:textSize=\"18sp\" /\u003e\n\n  \u003cTextView\n      android:layout_below=\"@+id/textView1\"\n      android:layout_width=\"match_parent\"\n      android:layout_height=\"wrap_content\"\n      android:layout_alignParentBottom=\"true\"\n      android:text=\"ElasticLayout\"\n      android:textColor=\"#ffffff\"\n      android:textSize=\"18sp\"\n      android:gravity=\"end\" /\u003e\n\u003c/com.skydoves.elasticviews.ElasticLayout\u003e\n```\n\n### ElasticAnimation\nElasticAnimation implements elastic animations for android views and view groups. \u003cbr\u003e\n```java\nnew ElasticAnimation(clickedView).setScaleX(0.9f).setScaleY(0.9f).setDuration(400)\n.setOnFinishListener(onFinishListener).doAction();\n```\n\n\u003cimg src=\"https://user-images.githubusercontent.com/24237865/72123077-742ccb80-33a3-11ea-9262-c4977983247e.gif\" align=\"right\" width=\"30%\"\u003e\n\n#### ViewPropertyAnimatorListener\nwe can set `ViewPropertyAnimatorListener` using `setListener` method and detect animation's status.\n```java\n.setListener(new ViewPropertyAnimatorListener() {\n   @Override\n   public void onAnimationStart(View view) {\n       // do something\n   }\n\n   Override\n   public void onAnimationEnd(View view) {\n       finishListener.onFinished();\n   }\n\n   Override\n   public void onAnimationCancel(View view) {\n       // do something\n   }\n});\n```\n\n#### Kotlin Extension\nElasticAnimation supports kotlin extension `elasticAnimation`.\n```kotlin\nval anim = textView.elasticAnimation(0.8f, 0.8f, 400, object: ElasticFinishListener {\n    override fun onFinished() {\n        // do anything\n    }\n})\nanim.doAction()\n```\n\n#### Kotlin dsl\n```kotlin\nelasticAnimation(this) {\n  setDuration(duration)\n  setScaleX(scale)\n  setScaleY(scale)\n  setOnFinishListener(object : ElasticFinishListener {\n      override fun onFinished() {\n           onClick()\n      }\n  })\n}.doAction()\n```\n\n#### Example : Normal Button\nwe can implement animation on all of the views like below.\n```java\n@OnClick(R.id.button)\npublic void addNewAlarm(View v){\n    // implements animation uising ElasticAnimation\n    new ElasticAnimation(v).setScaleX(0.85f).setScaleY(0.85f).setDuration(500)\n    .setOnFinishListener(new ElasticFinishListener() {\n            @Override\n            public void onFinished() {\n                // Do something after duration time\n            }\n        }).doAction();\n    }\n}\n```\n\n#### Example : ListView Item\nSo also we can implement animation on listView's items like below.\n```java\nprivate class ListViewItemClickListener implements AdapterView.OnItemClickListener {\n    @Override\n    public void onItemClick(AdapterView\u003c?\u003e adapterView, View clickedView, final int pos, long id) {\n        new ElasticAnimation(clickedView).setScaleX(0.9f).setScaleY(0.9f).setDuration(400)\n        .setOnFinishListener(new ElasticFinishListener() {\n              @Override\n              public void onFinished() {\n                  // Do something after duration time\n                  Toast.makeText(getBaseContext(), \"ListViewItem\" + pos, Toast.LENGTH_SHORT).show();\n              }\n          }).doAction();\n        }\n    };\n```\n\n## Find this library useful? :heart:\nSupport it by joining __[stargazers](https://github.com/skydoves/ElasticViews/stargazers)__ for this repository. :star: \u003cbr\u003e\nAnd __[follow](https://github.com/skydoves)__ me for my next creations! 🤩\n\n# License\n```xml\nThe MIT License (MIT)\n\nCopyright (c) 2017 skydoves\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n```\n","funding_links":["https://github.com/sponsors/skydoves","https://www.paypal.me/skydoves","https://www.buymeacoffee.com/skydoves"],"categories":["Libraries","其他","Index","Kotlin"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskydoves%2FElasticViews","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskydoves%2FElasticViews","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskydoves%2FElasticViews/lists"}