{"id":13643242,"url":"https://github.com/zoonooz/simple-view-behavior","last_synced_at":"2025-04-07T06:07:32.064Z","repository":{"id":48826101,"uuid":"48904582","full_name":"zoonooz/simple-view-behavior","owner":"zoonooz","description":"Simple and easy way to deal with CoordinatorLayout Behavior","archived":false,"fork":false,"pushed_at":"2018-05-02T21:06:54.000Z","size":10138,"stargazers_count":444,"open_issues_count":5,"forks_count":72,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-03-31T04:07:45.619Z","etag":null,"topics":["android","android-ui","animation","appbarlayout","coordinatorlayout"],"latest_commit_sha":null,"homepage":null,"language":"Java","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/zoonooz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-02T09:11:37.000Z","updated_at":"2024-11-21T01:55:29.000Z","dependencies_parsed_at":"2022-09-18T05:24:41.923Z","dependency_job_id":null,"html_url":"https://github.com/zoonooz/simple-view-behavior","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/zoonooz%2Fsimple-view-behavior","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoonooz%2Fsimple-view-behavior/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoonooz%2Fsimple-view-behavior/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoonooz%2Fsimple-view-behavior/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zoonooz","download_url":"https://codeload.github.com/zoonooz/simple-view-behavior/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247601448,"owners_count":20964864,"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","android-ui","animation","appbarlayout","coordinatorlayout"],"created_at":"2024-08-02T01:01:44.471Z","updated_at":"2025-04-07T06:07:32.025Z","avatar_url":"https://github.com/zoonooz.png","language":"Java","funding_links":[],"categories":["AppBar"],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/zoonooz/simple-view-behavior.svg?branch=master)](https://travis-ci.org/zoonooz/simple-view-behavior)\n\n# simple-view-behavior\n\nSimple View Behavior for Android [CoordinatorLayout](http://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.html).\n\nThis library provide you easy ways to config and setup the view behavior without creating subclass of\n[Behavior](http://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior.html)\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/zoonooz/simple-view-behavior/master/screenshot/example.gif\"/\u003e\u003c/p\u003e\n\n## Installation\n\n```\ncompile 'com.zoonref:simple-view-behavior:1.0'\n```\n\n## Usage\nYou can setup behavior effect by using only xml option.\n\n1. set the layout behavior to this library class `app:layout_behavior=\"com.zoonref.SimpleViewBehavior\"`\n2. set the dependency view by specify resource id by `app:dependsOn=\"@+id/{your view id}\"`\n3. set the type of dependency `app:dependType=\"{x,y,width,height}\"`\n4. set the dependency view target value according to the type you choose `app:dependTargetXXX=\"{value}\"`\n5. set the target appearance that you want your view to animate to\n\nThere are **two** ways to specify the animation when the dependency view changed.\n\n### 1. xml\n\n```\n\u003cView\n        android:layout_width=\"40dp\"\n        android:layout_height=\"40dp\"\n        android:layout_marginTop=\"8dp\"\n        android:layout_marginLeft=\"20dp\"\n        android:rotationX=\"90\"\n        android:elevation=\"10dp\"\n        android:background=\"@android:color/holo_blue_bright\"\n        android:alpha=\"0\"\n        app:layout_behavior=\"com.zoonref.SimpleViewBehavior\"\n        app:dependsOn=\"@+id/app_bar\"\n        app:dependType=\"y\"\n        app:dependTargetY=\"-156dp\"\n        app:targetAlpha=\"1\"\n        app:targetRotateX=\"0\"/\u003e\n```\n\nThis View will depend on the `y` positon of `@+id/app_bar`  which is AppBarLayout. View will animation from current state of AppBarLayout until\ny position of AppBarLayout is `-156dp` with the animation, View will animate alpha to `app:targetAlpha=\"1\"` rotate x to `app:targetRotateX=\"0\"`\n\n**Don't forget to add** `xmlns:app=\"http://schemas.android.com/apk/res-auto\"`\n\n**The output will be**\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/zoonooz/simple-view-behavior/master/screenshot/xml.gif\"/\u003e\u003c/p\u003e\n\n### 2. view animation resource file\n\nWhen you use animation, all of animate target option from xml will be ignored.\n\nfor example\n\n```\n\u003cView\n        android:layout_width=\"100dp\"\n        android:layout_height=\"100dp\"\n        android:layout_gravity=\"center|top\"\n        android:layout_marginTop=\"80dp\"\n        android:elevation=\"10dp\"\n        android:background=\"@android:color/holo_orange_dark\"\n        app:layout_behavior=\"com.zoonref.SimpleViewBehavior\"\n        app:dependsOn=\"@+id/app_bar\"\n        app:dependType=\"y\"\n        app:dependTargetY=\"-156dp\"\n        app:animation=\"@anim/rotate\"/\u003e\n```\n```\n\u003cset xmlns:android=\"http://schemas.android.com/apk/res/android\"\u003e\n    \u003cscale\n        android:duration=\"100\"\n        android:fromXScale=\"1\"\n        android:fromYScale=\"1\"\n        android:pivotX=\"50%\"\n        android:pivotY=\"50%\"\n        android:toXScale=\"40dp\"\n        android:toYScale=\"40dp\"/\u003e\n    \u003crotate\n        android:duration=\"100\"\n        android:fromDegrees=\"0\"\n        android:pivotX=\"50%\"\n        android:pivotY=\"50%\"\n        android:toDegrees=\"360\"/\u003e\n    \u003calpha\n        android:duration=\"100\"\n        android:toAlpha=\"0\"/\u003e\n\u003c/set\u003e\n```\n\n**The output will be**\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/zoonooz/simple-view-behavior/master/screenshot/resource.gif\"/\u003e\u003c/p\u003e\n\n### Options\n\nYou can see all available option at [attrs.xml](https://github.com/zoonooz/simple-view-behavior/blob/master/library/src/main/res/values/attrs.xml)\n\n## Author\n\nAmornchai Kanokpullwad, [@zoonref](https://twitter.com/zoonref)\n\n## License\n\nsimple-view-behavior is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzoonooz%2Fsimple-view-behavior","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzoonooz%2Fsimple-view-behavior","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzoonooz%2Fsimple-view-behavior/lists"}